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

@Savitha4 You have written glide wrong

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();

It should be

var sap = new GlideRecord('sc_task');
sap.addQuery('request_item', current.sys_id);
sap.query();
if(sap.next()){
var agrp = sap.current.variables.assignment_group.name;
gs.log('agrp is' + agrp);
sm.setStringParameter("assignmentgroup", agrp);
gs.log('assignmentgroup' + sap.assignment_group.name);
}

 

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

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.

Savitha4
Tera Contributor

Thank you. It worked.