New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class
844 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]]) == 😎
{
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;
}

}

 

 

0 Likes
2 Replies
Highlighted
Fleet Admiral
Fleet Admiral

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

 

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hello Ramesh

Can you elaborate more on the above post ?

Abhinav
Kindly assign kudos if the post is helpful!
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.