
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2019 08:57 AM
I am looking to create a record producer that updates an existing record on a table rather than inserting a new entry.
This is to enable a non ITIL user to submit an update on a table that I created for the team.
The record producer contains one reference variable.
Once a selection is chosen, I have a script that populates 4 single line variables with the relevant information from the table.
These variables are editable and a user can update what is pre-populated.
They also add text (reason) which I want to add to a journal field on the record.
So far, I have only managed to get it to insert a new record - I guess thats why its called a record producer!
Is there any script that I can user in order to update the record based on the details on the record.
The reason for wanting to do as a producer over a RITM with workflow is that I also want to give them the option to create a new record down the line.
MAny thanks for any help you can provide
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2019 04:06 AM
I have now completed this requirement by using the following script:
var record = producer.u_job_category;
var review = new GlideRecord('u_agency_rate_a');
review.addQuery('sys_id', record);
review.query();
//if we find a record update it
if (review.next()) {
review.u_agency_charge_rate_a = producer.rate_a;
review.u_agency_charge_rate = producer.rate_b;
review.u_average_rate_a = producer.rate_a_weekly;
review.u_average_rate_b = producer.rate_b_weekly;
review.u_agency_journal = producer.journal;
review.update();
gs.addInfoMessage("The record has now been updated");
current.setAbortAction(true);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2019 01:31 AM
Thanks for this and seems like the right path.
As my scripting is poor! please can you take it back a step for me? How would I initially query the reference field?
An example so far being:
current.u_agency_journal = producer.journal;
current.setAbortAction(true);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2019 04:06 AM
I have now completed this requirement by using the following script:
var record = producer.u_job_category;
var review = new GlideRecord('u_agency_rate_a');
review.addQuery('sys_id', record);
review.query();
//if we find a record update it
if (review.next()) {
review.u_agency_charge_rate_a = producer.rate_a;
review.u_agency_charge_rate = producer.rate_b;
review.u_average_rate_a = producer.rate_a_weekly;
review.u_average_rate_b = producer.rate_b_weekly;
review.u_agency_journal = producer.journal;
review.update();
gs.addInfoMessage("The record has now been updated");
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2023 12:16 PM
Does the abort action works in scoped app as well?