Populating ServiceNow variable through the Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 01:26 AM
I have a Workflow script, that is assigning values to different variables. Below is that script:
I have created a new variable Approval to Hire ID, and I want to assign this value also. I've written the below line but that's not working:
grReqItem.variables.u_approval_to_hire_id = current.variables.u_approval_to_hire_id;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 02:48 AM
so you have record producer and then you are creating RITM and REQ and copying variable to RITM
variable "u_approval_to_hire_id" in record producer is of what type?
variable "u_approval_to_hire_id" in catalog item is of what type?
Are you able to print the value in log?
current.variables.u_approval_to_hire_id;
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 02:58 AM
The variable type is "Single Line Text" in record producer and catalog item.
And I'm not able to print it's value. It is empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 03:49 AM
if it's empty then how it will get set in RITM during creation
That's expected behavior.
What's your requirement here if that variable is empty?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 04:06 AM
No, it's empty in the RITM.
I have entered a value in that variable on the record producer, but it's not populating on the RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2025 04:21 AM
but you said when you printed in logs it gave empty?
share that variable configuration screenshot? is that variable part of some variable set?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader