- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 07:12 AM
Hi, when a user creates a new form on the related list, I want the product owner to be auto filled with the same value as the product owner on the form they are creating the related form from.
This is the form where the product owner is filled from:
Here you can see the related list below it:
Here is the form that pops up when you click new, I want to auto fill Product Owner with the same value as PO on the main form. They are both referencing the User table.
Any help appreciated!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 07:36 AM
Hi Shane,
I've commented a few points below, hope this helps clear up a few things but let me know.
var gr = new GlideRecord('u_gbts_code_release_management');
gr.addQuery('number', current.parent); //change number to sys_id. current.parent will return a sys_id and you need to match like for like
gr.query();
while(gr.next()) {
current.u_approver2 = gr.u_product_owners; //product_owners implies plurality, what sort of field is this?
}
gr.update(); //you haven't changed anything on the glide record so this line is not needed.
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 07:56 AM
You could do it onLoad but you would need a Glide Ajax to get the information from the parent record.
Does the product owner change regularly? It would be preferable to have an on update business rule running on the parent to update the child records when the product owner changes (or some other viable work around), you want to keep as much of your script as possible running on the server rather than the client.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 07:58 AM
Just read your edit.
Display is perhaps preferable to onLoad but it's still processing script every time the form loads, it might seem marginal but these things have a habit of creeping up on you and before you know it you're making a cup of tea whilst waiting for your form to load. Best to have something trigger the script to change the value rather than populating it every time the form loads.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2017 08:18 AM
Thanks David, the product owner will not usually change after it's been set. I'll see if I can figure out how to do it like you've said.