Re: SMS assignment group using JScript (120 Views)
Reply
Super Advisor
amykoh
Posts: 568
Registered: ‎10-03-2005
Message 1 of 3 (397 Views)

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
switch(file)
{
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();
do
{
recipients.push(arr[x]);

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

}
else
{
recipients.push((ftable[fields[index]]));
}

}

if(control == true)
{
//system.library.onscreen.displayPopUp(recipients.getText());
//print(recipients);

return recipients;
}

}

 

 

Honored Contributor
ramesh9
Posts: 1,084
Registered: ‎04-19-2011
Message 2 of 3 (359 Views)

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

 

Frequent Advisor
abhin88
Posts: 88
Registered: ‎01-07-2013
Message 3 of 3 (120 Views)

Re: SMS assignment group using JScript

Hello Ramesh

Can you elaborate more on the above post ?

Abhinav
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.