- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 08:21 PM
I have a before business rule that populates a string field with the concatenated value of a reference field and a string field; all on the same form/table. Concatenation works, but I get the sys ID of the reference field value. I have tried a bunch of script examples, but this is the "base". BusApp is the reference field. Please help. 🐵
Condition: current.u_business_application.changes() || current.u_profile.changes() || current.operation() == 'insert'
Script:
//Get the values of your two objects
var curBusApp = current.getValue('u_business_application');
var curProfile = current.getValue('u_profile');
//Set the display Value
current.setDisplayValue('u_name', curBusApp + '-' + curProfile);
current.update();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 08:23 PM
Hi Sarah,
since it is a reference field it will give sys_id if you use getValue; use getDisplayValue() to get the display value
//Get the values of your two objects
var curBusApp = current.getDisplayValue('u_business_application');
var curProfile = current.getValue('u_profile');
//Set the display Value
current.setDisplayValue('u_name', curBusApp + '-' + curProfile);
current.update();
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 08:23 PM
Hi Sarah,
since it is a reference field it will give sys_id if you use getValue; use getDisplayValue() to get the display value
//Get the values of your two objects
var curBusApp = current.getDisplayValue('u_business_application');
var curProfile = current.getValue('u_profile');
//Set the display Value
current.setDisplayValue('u_name', curBusApp + '-' + curProfile);
current.update();
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 08:44 PM
I KNEW it would be a simple fix. Thank you!!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 08:46 PM
Hi,
There can be two ways one which Ankur said and other which i think:
//Get the values of your two objects
var curBusApp = current.u_business_application.name; //This name is a name field on that reference table i.e. where business application is referring two. It can be u_name or name or may be somethere field also you can use if you want.
var curProfile = current.getValue('u_profile');
//Set the display Value
current.setDisplayValue('u_name', curBusApp + '-' + curProfile);
current.update();
Thanks,
Ashutosh