Please fix this script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 06:24 AM
var ritmGR = new GlideRecord("sc_req_item");
ritmGR.get(current.sys_id);
var groupName = ritmGR.variables.group_name;
gr.initialize();
current.description="added + " + groupName;//here i am fetching sys_id not group name , requirement is fetching group name.
gr.insert();
I am fetching sys_id in description not group name so please fix it
- Labels:
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 06:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 06:34 AM
Hello @1dusjhyahnt ,
Please replace your line number 3 to below and it will work as expected, I have validated in my PDI.
var groupName = ritmGR.variables.group_name.getDisplayValue().toString();
Please mark this as accepted if this works for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 06:52 AM - edited 02-13-2024 06:53 AM
Hi @1dusjhyahnt ,
Please be sure and explain the business case for this script.
You are using the current.sys_id to get a reference of record from RITM table and again updating the description of same record using the current.description.
and this gr.initialize() and gr.insert() , what's role of these two lines in this code because this gr not declared ( may be you have more code but not shared here )
if you are trying to copy groupname to description in the same record then only one line of code will update that.
current.description = current.group_name.getDisplayValue().toString();
So explain the use case and where you are using this script code ( script include, BR, fix script etc. )
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution