- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2022 12:30 PM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2022 12:44 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2022 12:00 AM
Hi,
It depends where you are trying to retrieve the value of a Reference Variable. Please see the steps below to achieve your requirement:
1) Server side: Can be a Business Rule, or a Workflow then you need to use the syntax as below:
current.variables.VariableName (Assuming BR is on RITM or Catalog Task Table)
2) If it is a client Side Operation then you can use getReference as shown below in an On Change script for example as below:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var getVarValue = g_form.getReference('variables.VariableName', getRefValue); // Replace your Variable Name here
function getRefValue(getVarValue) {
alert(getVarValue.name); //name is just an example you can replace it with any other field name
alert(getVarValue.email);
}
//Type appropriate comment here, and begin script below
}
There are other methods available as well through which you can retrieve the Reference Variable Value. You need to elaborate on what you are looking for and someone from community can assist you to get to a solution.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke