Using UI action to update multiple child records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2019 01:24 PM
Hello everyone,
Thank you in advance for your interest and assistance! I am trying to create a UI action that will live on the project record that if clicked will update a custom field on it's associated cost plans. I am combing through existing UI actions for guidance, if anyone knows of any threads or has any suggestions on how I can best accomplish this I would be incredibly grateful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2019 02:02 PM
Have you tried anything so far?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2019 02:05 PM
the script to udpate the child expense lines would look something like this...
var el = new GlideRecord('fm_expense_line');
el.addQuery('source_id',current.sys_id);
el.query();
while (el.next()){
el.u_your_custom_field = 'whatever value you want';
el.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2019 02:12 PM
You should use server side UI Action (Client is unchecked) with the code like
var gr = new GlideRecord("cost_plan");
gr.addQuery("task", current.getUniqueValue());
gr.setValue("u_customField", "custom value");
gr.updateMultiple();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2019 02:23 PM
That's way better than mine 😞