- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2021 04:23 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2021 03:13 AM
Hi
Thanks a lot for helping and having patience. Finally, I am able to resolve this.
ac.update() will not work for saving(updating) values in table for reference field.
ac.updateWithReferences(); is correct method for it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2021 05:07 AM
Hello
Can You please tell the use case?
which Business Rule You are Using?
to set a particular Variable please do as below
var contractNumber = 'FSD1111';
gr.setDisplayValue('u_contract', contractNumber);
gr.update();
but Point is based on Your Use Case we need to select the Business Rule
before or After followed by insert or update or delete
Mark my Response as Correct or Helpful, if you find it Appropriate.
Gaurav Shirsat
https://www.linkedin.com/in/gauravshirsat/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2021 05:22 AM
Hi,
I am creating script include to update records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2021 05:24 AM
Hi Gaurav,
I have written background script, where I want to update reference field value. When ac.update() written inside while loop it does not update field, but when written outside of while loop its inserting record instead of updating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2021 05:26 AM
Reference fields take a sys_id as their value so you either need to pass in a sys_id eg:
gr.u_contract = '<sys_id>';
Or you can use setDisplayValue() to set the value of the field by the display value, this will obviously require that the display value on the referenced table is unique. eg:
gr.u_contract.setDisplayValue(contractNumber);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2021 05:26 AM
Hi Dubz,
I have written background script, where I want to update reference field value. When ac.update() written inside while loop it does not update field, but when written outside of while loop its inserting record instead of updating