HPE Service Manager / Service Center Support and News Forum
Showing results for 
Search instead for 
Do you mean 

SMS assignment group using JScript

Super Advisor

SMS assignment group using JScript

Hi all,


I have a JavaScript which works to send out SMS to contacts. Attached is the setup on system.


However, I'm trying to send SMS notification to an assignment group (multiple operators in a group).


Appreciate if someone can guide me URGENTLY how this can be achieved. 


Below is the JScript:


* Find a persons or email address for notifications from any file
* Parameters:
* file: dbdict file name to search
* uniqueid: unique field of the dbdict used to locate the desired record within "file"
* trigger: control field that will be evaluated within the target record to determine if recipients should be retrieved.
* if trigger is not supplied then recipients WILL be retrieved
* fields: field(s) within the record as determined by field & uniqueid that contain the desired recipients
* The fields parameter must be an array of text!! {"field1","field2"}
*function getRecipientFromRecord(file, uniqueid, trigger, fields)


function getRecipientFromRecord(file, uniqueid, trigger, fields)
var ftable = new SCFile(file);
var uField;
var control = true;

// Here we grab the unique id field for common tables, we were passed the needed table in the function call
case "company": {uField = "imsitenumber";break;}
case "contacts": {uField = "contact.name"; break;}
case "assignment": {uField = "name";break;}
case "incidents": {uField = "incident.id";break;}
case "ocmq": {uField = "number";break;}
case "probsummary": {uField = "number";break;}
case "device": {uField = "logical.name";break;}
case "location": {uField = "location.code";break;}
default: {uField = "name";break;}

// Query the record of the table provided in the function call
ftable.doSelect(uField + " = \"" + uniqueid + "\"");

// Here we need to convert the SC array to a Javascript array and
// change the field name from SC convention to Javascript convention by replacing periods with underscores

fields = fields.toArray(); // change the fields array from SCDatum to Javascript
var index = fields.length; // determine the number of elements
var recipients = new SCDatum(8);

if (trigger != null || trigger != "")
//control = functions.evaluate(functions.parse(ftable.trigger));

for(index in fields)
fields[index] = fields[index].replace(".", "_");

// If any of the supplied fields are arrays we must test for this and loop through adding elements to recipients 1 at a time
// otherwise just add the text field

if(system.functions.type(ftable[fields[index]]) == 8)
var x = 0;
//print("The array is this long: " + ftable[fields[index]].getSize());

var arr = new SCDatum(8);
arr = ftable[fields[index]].toArray();

x = x + 1;
}while(x < ftable[fields[index]].getSize())



if(control == true)

return recipients;




Honored Contributor

Re: SMS assignment group using JScript

Why cannot use simple notification of type "page" to fire page events for operators belonging to that particular assignment group...


Msg Class          :          pm

Msg No              :          501

Arguments          :          Your own arguments which you can pass to eventout record

Condition            :          true

Notify method      :         page

Recepients         :          assignment in $L.file

Group file           :          assignment


Regular Advisor

Re: SMS assignment group using JScript

Hello Ramesh

Can you elaborate more on the above post ?