- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2019 06:36 AM
Howdy,
I am getting "undefined" result when I run script on workflow. It worked for different Variable types but not if I'm using a "Reference" variable.
Variable set type is "Reference"
Code "current.variables.student_info.request_for"
Please help.
Thank you
Rochellee
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2019 11:26 AM
Looks like you are trying to dot walk to the request_for field.
If you were referencing the sys_user table for example, you could do current.variables.student_info.email and that would give you the email address off of the user record for that user.
If you are just trying to get the request_for field on the Student Info catalog item then it's just current.variables.request_for
One thing to keep in mind too is a reference field is going to return the sys_id. You can use .getDisplayValue() to get the actual text instead of the sys_id. Or you can dot walk like I mentioned above to get to any of the fields on the referenced record.
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2019 10:33 AM
what's exactly your variable name ?
current.variables.student_info.request_for
current.variables.student_info
current.variables.request_for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2019 10:45 AM
Hi,
If your reference type variable name is student_info, then
current.variables.student_info
is correct, but verify that when you're doing a furthermore dot-walk, then make sure that the table to which you're referencing in student_info variable does have a field named request_for or not? If not, then there is the issue, and that's the reason you're getting undefined return value for this expression. Please verify and correct it.
Hope this helps.
Mark helpful or correct based on impact.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2019 11:26 AM
Looks like you are trying to dot walk to the request_for field.
If you were referencing the sys_user table for example, you could do current.variables.student_info.email and that would give you the email address off of the user record for that user.
If you are just trying to get the request_for field on the Student Info catalog item then it's just current.variables.request_for
One thing to keep in mind too is a reference field is going to return the sys_id. You can use .getDisplayValue() to get the actual text instead of the sys_id. Or you can dot walk like I mentioned above to get to any of the fields on the referenced record.
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2019 11:14 PM
Thanks that did it. So in the script itself I added .getDisplayValue
From this : current.variables.student_info.request_for
To This : current.variables.student_info.request_for.getDisplayValue()
Thanks everyone.
Rochellee