- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2020 09:45 AM
We are creating a catalog item for our Service Desk to generate General IT Requests. Sometimes they will be assigned to a different group, sometimes they will assign it to themselves and consider it completed (think first call resolution).
The catalog item includes variables to identify the assignment group and assigned to data.
In the workflow, through a script activity, I am able to edit the assignment group field on the REQ & RITM with the variable data. I am unable to find a way to update the Assigned To field on the RITM with the corresponding 'assigned to' variable.
This is what I currently have in the Run Script activity.
var at = current.getValue(variables.sdGenReq_assginedTo);
gs.log('SD Gen request Assigned to value -current.variables.sdGenReq_assginedTo.user- is ' + at);
current.assigned_to = at;
current.update();
I have tried to directly assign the assigned_to field with current.variables.sdGenReq_assignedTo value and that didn't work either.
If you are wondering - the gs.log reports that the value of the 'at' variable is undefined.
I have attempted a number of different options to get the value of the variable - the above script just shows my latest attempt.
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2020 11:12 AM
If you go the var at route you should still get a sys_id if you assign it like this
var at = current.variables.sdGenReq_assginedTo.toString();
But that's going to be the sys_id of the record on sys_user_grmember, so instead use this
var at = current.variables.sdGenReq_assginedTo.user.toString();
gs.log('SD Gen request Assigned to value is ' + at);
current.assigned_to = at;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2020 10:33 AM
Hi DChandlerky,
Replace var at = current.getValue(variables.sdGenReq_assginedTo); with var at = current.variables.sdGenReq_assginedTo;
- Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2020 10:40 AM
Assignment Group and Assigned to are both reference fields on the sc_req_item table, so there's not much difference in the way you populate them. If the workflow that includes this script runs on the sc_req_item table, and you have a variable named sdGenReq_assginedTo that is a reference to sys_user, then all you need to update the RITM Assigned to is
current.assigned_to = current.variables.sdGenReq_assginedTo;
Do not add a current.update()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2020 10:47 AM
Thanks
I agree that it *should* be that simple... but I have tried both of those before and it is not taking the value from the variable and updating the 'Assigned to' of the RITM. The gs.log says "SD Gen request Assigned to value -current.variables.sdGenReq_assginedTo- is undefined"
EDIT: The Assignment Group variable looks at the Groups table. The Assigned To variable looks at the sys_user_grmember table and has a dependency to the Assignment Group variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2020 11:12 AM
If you go the var at route you should still get a sys_id if you assign it like this
var at = current.variables.sdGenReq_assginedTo.toString();
But that's going to be the sys_id of the record on sys_user_grmember, so instead use this
var at = current.variables.sdGenReq_assginedTo.user.toString();
gs.log('SD Gen request Assigned to value is ' + at);
current.assigned_to = at;