- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 07:38 AM
Hi experts,
we have created variables called 'firstname', 'last name' & 'middle name' in a variable set of a record producer.
Our record producer creates a record in incident table. We have custom fields 'firstname', 'last name' & 'middle name' on Incident table and guest table (custom table).
My requirement is when record producer is submitted, we need to update 'firstname', 'last name' & 'middle name' both in incident and guest tables.
For incident, I have mapped the fields and it is working fine. But how can I update custom table fields.
Can someone help. TIA
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 08:22 AM
@rajasekar reddy it need not be any field because second line is to filter the records that you want to update .
Lets say if you want to update a particular record with active as true so you can write like
var gr = new GlideRecord('your_custom_table');
gr.addQuery('active',true);
gr.query();
if(gr.next())
{
gr.your_first_name_field_backend_name = producer.your_first_name_variable_backend_name;
gr.your_last_name_field_backend_name = producer.your_last_name_variable_backend_name;
gr.your_middle_name_field_backend_name = producer.your_middle_name_variable_backend_name;
gr.update();
}
Like this as per your requirement if you have any particular records to be updated in your custom table then build a query accordingly just like the above .
Mark the answer correct if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 10:31 AM
@rajasekar reddy did the above script work ?
if yes mark the answer correct and close the thread so that it benefits future readers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2024 02:51 PM
Hi Mohith,
I have a similar requirement and cannot get the script to work. My record producer's table is x_nuvo_eam_elocation (Location), however the Location record has a field (Reservable) that is not in the Location table's dictionary and resides in x_nuvo_eam_space (Space).
I have tried 2 methods but neither work. Any help would be greatly appreciated, thanks.
- current.space.reservable = producer.reservable;
- revising your script:
gr.addQuery('active',true);
gr.query();
if(gr.next())
{
gr.reservable = producer.reservable;
gr.update();