- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 04:02 AM
I have a Variable Set (existing_printer) inside my record producer, I want to check value of a variable from variable set in my record producer script. I tried using producer.<variableSet_name>.<varibale_name> as below:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 04:30 AM
producer.existing_printer[0].what_type_of_department_printer == "HOD"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 05:36 AM
Yes, i am using Multi-row variable set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 04:18 AM
@Ankur Bawiskar Can you please help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 04:23 AM
There are two type of Variable Sets - single row, and multi row. With both, there is not a no-code method to map the variables to a field. In your producer Script, for a single row variable set, treat it as you would any other variable with the syntax
current.field_name = producer.variable_name;
A multi-row variable set requires a few more lines as you have to loop through the value for each row, so let me know if that's what you're dealing with, then you have to decide how you want to handle the mapping of multiple values to a single value field.
For variables outside of a variable set, it's always best to use the non-scripting method if it's a basic mapping with no lookup/manipulation needed as you are selecting the field by name rather than typing in the field name and variable name, so there's less room for error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 04:30 AM
Are you really just copying answers from others on other questions without even reading the question properly? At least have the decency to quote the person giving the answer if you do a copy/paste: https://www.servicenow.com/community/guided-learning-itsm/how-to-access-variableset-s-variables-in-r...
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 04:30 AM
producer.existing_printer[0].what_type_of_department_printer == "HOD"