Retrieving Values for Reference Variable in RITM

Abbey Brown
Kilo Explorer

Hello all, 

Fairly new to SN. I am trying to retrieve the values for a reference variable on an RITM. Any suggestions or links would be much appreciated. I've seen getReference() which isn't working. I am trying to retrieve reference value for Employee Name, which is a sys_user reference. 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

You can dot-walk the values on that reference field:

current.variables.employee_name.name.getValue()
OR
current.variables.employee_name.email.getValue()

Something like that. Is there specific data you are attempting to retrieve from that reference field? Can you please elaborate on your use case?

View solution in original post

5 REPLIES 5

Community Alums
Not applicable

You can dot-walk the values on that reference field:

current.variables.employee_name.name.getValue()
OR
current.variables.employee_name.email.getValue()

Something like that. Is there specific data you are attempting to retrieve from that reference field? Can you please elaborate on your use case?

Saurav11
Kilo Patron
Kilo Patron

You can do it using the below in a workflow run script:-

current.variables.employee_name.field_name.getValue();

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

if you wish to set some other variable based on the reference variable then you can write onChange client script on that and use either

1) getReference() with callback

OR

2) GlideAjax

Can you share your current script configuration and screenshot

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Gaurav Shirsat
Mega Sage

Hello

as You have mentioned you tried with getReference "I've seen getReference() which isn't working."

so, getReference won't support in Portal that Efficiently. better You go for Client Callable Script Include with onChange Catalog Client Script with GlideAjax.

You can refer @Harneet Sital  answer in this Thread 

if not please expalin your entire use case in brief:-

based on selection of User, which variables needs to be auto-populated with what data from user table.

Mark my Response as Correct or Helpful, if you find it Appropriate.
Gaurav Shirsat
https://www.linkedin.com/in/gauravshirsat/