- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2023 06:30 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2023 02:52 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2023 06:54 AM
@Savitha4 can you confirm where you wrote that current.assignment_group?
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2023 08:01 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2023 08:26 AM
@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
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2023 09:13 AM
But I've glided sc_task table and using the syntax sm.setStringParameter("assignmentgroup", sap.assignment_group);