Assignment group

Savitha4
Tera Contributor

We need to assign the assignment group of the SCTASK to a variable to pass it through 3rd party integration through rest message. I have used the var grp= current.assignment_group but the value is coming as undefined. How to get the value of the assignment group? Thanks.

1 ACCEPTED SOLUTION

Vikram Singh
Giga Expert

Instead of writing :

var agrp = sap.current.variables.assignment_group.name;

 

You can directly write:

var agrp = sap.assignment_group.name;

 

This way it will directly get the name of sc_task assignment group. By accessing it through current.variables it is going to the catalog variables and getting the value which has been assigned to it while raising request.

 

Please mark helpful if it works.

View solution in original post

7 REPLIES 7

BharathChintala
Mega Sage

@Savitha4  can you confirm where you wrote that current.assignment_group?

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

Savitha4_0-1676649651738.png

testRule();

function testRule() {
var sm = new sn_ws.RESTMessageV2("Okta Workflow Endpoint", "POST");
var site_option = current.variables.site_option;
sm.setStringParameter("requestNumber", current.number);
sm.setStringParameter("ApplicationName", current.variables.application_name);
sm.setStringParameter("requestSysid", current.sys_id);
sm.setStringParameter("requestedfor", current.requested_for);
sm.setStringParameter("requestedemail", current.requested_for.email);
sm.setStringParameter("requestuserid", current.requested_for.user_name);
sm.setStringParameter("action", current.variables.actions);

sm.setStringParameter("site_option", current.variables.site_option);
sm.setStringParameter("role", current.variables.role.getDisplayValue());
gs.log('role is' + current.variables.role);
gs.log('siteoption is' + site_option);
var sap = new GlideRecord('sc_task');
sap.addQuery('request_item.number', current.number);
//sap.addQuery('assignmentgroup', current.assignment_group);
var agrp = sap.current.variables.assignment_group.name;
gs.log('agrp is' + agrp);
sm.setStringParameter("assignmentgroup", agrp);
gs.log('assignmentgroup' + sap.assignment_group.name);
sap.query();
sap.next();
sm.setStringParameter("task_number", sap.number);
gs.log('tasknumberisnew is' + sap.number);
sm.setStringParameter("task_sysid", sap.sys_id);
gs.log('tassysidnew is' + sap.sys_id);
var response = sm.execute();

}

@Savitha4  I mean business rule or workflow runscript or custom RestAPI script?

 

If it is BR current will represent table it running
if it workflow runScript:

current will represent RITM record

 

So can you confirm what type script you are writing

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

But I've glided sc_task table and using the syntax sm.setStringParameter("assignmentgroup", sap.assignment_group);