Business Rule script to populate a reference field from a string field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2019 10:27 PM
Hi all
I have a String field "u_wrnumber" that is populated from the email body using a business rule
i need to populate a Reference field "Parent" from the u_wonumber fiild and have tried the following script in a business rule that is not working
These are the two fields on the form
current.parent=current.u_wrnumber;
i can manually put the WR Number in the Parent field as it exists in the task table
could anyone please assist with how i populate the parent field
Thankyou
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2019 11:53 PM
Hi Kev,
Please use this code:-
current.setDisplayValue('parent',current.u_wrnumber);
please mark helpful if it solve your issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2019 02:48 PM
Hi all
we are so close 🙂 many thanks for all the advice
current.setDisplayValue('parent',current.u_wrnumber);
The above Scipt that you have suggested is working with one minor hiccup. it doesnt work on insert but if i set the business rule to run on insert and update it updates the field after i have opened the form and saved it again
do you have any suggestions on how to get the form to update on insert?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2019 07:46 PM
Hi Kev,
I don't think you can update the form when it is inserted. Don't you have that value before insert itself?
Regards
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
05-16-2019 08:07 PM
Hi Ankur
The u_wrnumber field is populated as part of an inbound email action, im not sure if that means the value is avaialble before the business rule runs though
Regards Kev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2019 12:27 AM
use Glide Record and by using Glide Object you can update like gr.update();
Please mark helpful if it solve your issue