workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
HI team ,
need help in script
I have a catalog item called ' SWA AD '
in that we have reference field ' Application Name ' which refers to cmdb_ci_service_auto table .
approvals has to trigger to the application service >> approval group
As this is old catalog already WF configured .
So i am trying to achieve via script
my scipr is not working
please help me what was the mistake
(function executeRule(current, workflow) {
var groupId = "";
if (current.u_application_name) {
var app = new GlideRecord("cmdb_ci_service_auto");
if (app.get(current.application_name)) {
groupId = app.change_control; // adjust field name
}
}
workflow.scratchpad.approvalGroup = groupId;
return groupId;
})(current, workflow);
could you please prrovide me the updates script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Pass .toString() when using get() on a reference field. -> app.get(current.u_application_name.toString())
Try maybe it will work!
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution and helpful so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @nameisnani ,
Try Below script
(function executeRule(current, workflow) {
var groupId = "";
if (current.u_application_name) {
var app = new GlideRecord("cmdb_ci_service_auto");
if (app.get(current.u_application_name)) {
groupId = app.change_control;
}
}
workflow.scratchpad.approvalGroup = groupId;
return groupId;
})(current, workflow);
Regards,
Ranjit Nimbalkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
56m ago
@Ranjit Nimbalka not worked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
update as this in your workflow advanced script for approval activity
answer = [];
answer.push(current.variables.u_application_name.change_control.toString()):
Approval - Group workflow activity
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader