set string variable when another reference variable has a value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 05:10 AM
I am trying to set a string field whenever another field, which is a reference field, has a value.
When hand reciept holder 3 has a value, I would like to copy that value to hand receipt holder 1 which is a string field
This sets the reference field:
My attempt at pushing the value to the string field:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 05:18 AM - edited ‎11-15-2022 05:19 AM
Change it to run on-change on the variable "hrh_ref" , and use g_form.getDisplayValue('hrh_ref'); to retrieve the displayvalue and save it to your string field
Best regards,
Sebastian Laursen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 05:31 AM
It needs to check the field when the value of the "In DPAS" field changes to No...then it should check the value of hand receipt holder 3 and populate that value to hand receipt holder 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 05:46 AM
Then do it in the other client script so you do it at the same time 🙂
Best regards,
Sebastian Laursen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 05:30 AM
hello @Andre8 i think the on change variable that you are using is wrong .Use hand receipt holder3 in on change variable field in your script and then try it .
You might get the sys_id of the user in string field as hand receipt holder3 is reference so while setting it use get reference and then set it like below
var usr = g_form.getReference('hrh_ref', doAlert); // doAlert is our callback function }
function doAlert(usr) { //reference is passed into callback as first arguments
g_form.setValue('your_string_field_name',usr.name);
}
Hope this helps
mark the answer correct if this helps you
Thanks