Using a Variable in Record Producer to send incident to assignment group

Tom Thompson
Tera Expert

I have a select box variable called "name_of_application

3 Choices to select

Depending on what is selected it would create Incident to that group.

 

Tried below script and it only goes to last group. If I remove the last lines its always blank assignment.

 

Any help on what is wrong?

 

 

 

if(producer.name_of_application == "Sleep"){
current.assignment_group = "22f23e1fdba188544a7f5818489619ad";
} else if(producer.name_of_application == "Neurology"){
current.assignment_group = "d8ba6d004f63b6009f547f75f110c772";
} else if(producer.name_of_application == "GI"){
current.assignment_group = "4474a8de4fd95200cd3d97dd0210c703";
} else {
current.assignment_group = "6af5f36c4f321a4063fa495d0210c73f"; // default group sys_id
}

2 ACCEPTED SOLUTIONS

Brad Bowman
Kilo Patron
Kilo Patron

Hi Tom,

I suspect that "Sleep", "Neurology", and "GI" are not the value of the question choices for the variable.  The value can be different than the Text, which is what is displayed in the drop-down box.  As an example:

BradBowman_0-1701970164814.png

 

 Value is what needs to be used in the producer script.

View solution in original post

If the existing if/else conditions are working, you would just add an OR (||) in a repeating manner: 

if (producer.name_of_application == "Nihon Kohden Polysmith" || producer.name_of_application == "Somnostar - NICU Sleep" || producer.name_of_application == "Inspire Cloud software (not the device - ENT)" || producer.name_of_application == "CleveMed" || producer.name_of_application == "Philips Care Orchestrator" || producer.name_of_application == "GENE Activ") {
    current.assignment_group = "22f23e1fdba188544a7f5818489619ad"; // Sleep Applications
} else if (...

or you could try a SWITCH statement.

https://www.w3schools.com/js/js_switch.asp 

 

View solution in original post

7 REPLIES 7

Brad,

Thank you for the help, Now they are asking if we can list the application and by what they select in the dropdown it will assign to one of those 3 groups.   I tried just adding on the apps but get coding errors..  

I can get the 1st choices to work but can't add on the rest..   see code.

 

if(producer.name_of_application == "Nihon Kohden Polysmith"){
current.assignment_group = "22f23e1fdba188544a7f5818489619ad"; // Sleep Applications
} else if(producer.name_of_application == "Autonomic Filemaker"){
current.assignment_group = "d8ba6d004f63b6009f547f75f110c772"; // Neurological
} else if(producer.name_of_application == "Medtronic Bravo Reflux"){
current.assignment_group = "4474a8de4fd95200cd3d97dd0210c703"; // GI, Prov
} else {
current.assignment_group = "6af5f36c4f321a4063fa495d0210c73f"; // default group sys_id
}

 

 

So for the 1st line i need these apps to go to sleep App group, not sure how to code them in. 

 

Nihon Kohden Polysmith
Somnostar - NICU Sleep
Inspire Cloud software (not the device - ENT)
CleveMed
Philips Care Orchestrator
GENE Activ

If the existing if/else conditions are working, you would just add an OR (||) in a repeating manner: 

if (producer.name_of_application == "Nihon Kohden Polysmith" || producer.name_of_application == "Somnostar - NICU Sleep" || producer.name_of_application == "Inspire Cloud software (not the device - ENT)" || producer.name_of_application == "CleveMed" || producer.name_of_application == "Philips Care Orchestrator" || producer.name_of_application == "GENE Activ") {
    current.assignment_group = "22f23e1fdba188544a7f5818489619ad"; // Sleep Applications
} else if (...

or you could try a SWITCH statement.

https://www.w3schools.com/js/js_switch.asp 

 

Thank you for this help.  It worked great.