Name

sn_em_mobile.createPushMsgContent

Description

This being used by 4 push message content using the same common code

Script

var createPushMsgContent = Class.create();
var json = {};

createPushMsgContent.prototype = {
  initialize: function(title) {
  	var MAX_NUM_OF_CHAR = gs.getProperty("evt_mgmt.em_mobile.max_num_of_char", 299);
  
  	var layoutFieldGenerator = new global.NotificationLayoutFieldGenerator();
  	var identifier = layoutFieldGenerator.layoutField(current.getTableName(), current.sys_id, "name");
  	var tmpDescription = JSON.stringify(layoutFieldGenerator.layoutField(current.getTableName(), current.sys_id, "short_description"));
  	var description = JSON.parse(tmpDescription.substr(0, MAX_NUM_OF_CHAR));
  	var status = layoutFieldGenerator.layoutField(current.getTableName(), current.sys_id, "severity");

  	json = {
  		"aps" : {
  			"sound" : "default"
  		},
  		"Redirection" : {
  			"Title" : title + " severity had changed",
  			"To" : "Embedded",
  			"Destination": {
  				"DocumentId": "b0790c92b7a43300c929facbde11a96b",
  				"ItemId": current.sys_id
  			},
  			"Context" : {
  				"ContextType": "RECORD",
  				"TableName": "cmdb_ci_service_discovered",
  				"RecordId": current.sys_id
  			}
  		},
  		"Layout" : {
  			"Status": status,
  			"Identifier" : identifier,
  			"Description" : description
  		}
  	};
  },
  get: function() {
  	return json;
  },
  type: 'createPushMsgContent'
};

Sys ID

8d80de15b76573003f0a9b86ce11a99a

Offical Documentation

Official Docs: