Appending/Updating records field value of one table based on other
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2022 02:23 AM
Hi All,
I have created a custom table which has a field which contains a list of applications. I would like to be able to create a BR which upon creation of the row within this custom table, will update/append to a particular list field within the application table. I have tried doing this however it does not seem to work.
I have set the BR to after and ticked insert (please let me know if I have done wrong). The code I have used is below:
var gr=new GlideRecord('existing table');
gr.addQuery('field on existing table' ,'CONTAINS', 'field on custom table');
gr.query();
while(gr.next()){
gr.field = gr.field+ current.field; /*gr.field is relating to the one on exisiting table which I wish to append current.field too */
gr.update();
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2022 06:35 AM
The existing table is the application table. Is the line you have proposed the only change needed? Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2022 06:46 AM
If it is application table then above change will work
Since 'field on custom table' is list collector field of applications, it return sys_id of all selected application as coma separated text.
So, you use the above changes. Make sure you are passing correct field name
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2022 07:15 AM