How to grab the Number of the Record Using Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 04:10 AM
Dear All,
I am having problem in grabbing the Incident Number to the New Application I created.
Please see my script below, please let me know what needs to be done. Here is the scenario.
I have this Customer Service Module App. Once I submitted a record and it was identified as Incident, it will automatically create an Incident Record.
The problem is Is I need to grab the Incident Record number to the "Related Incident" reference field to serve as a reference. Please see screenshot.
Submit a customer service ticket.
Here is the Incident created
As you can see I make sure the customer reference number is available in the incident so that I will be able to query it using glide record.
Below is my script.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('x_glti_incident_ma_incident_management_table');
//gr.addQuery('active','true');
gr.addQuery('u_customer_reference_no',current.sys_id);
gr.query();
if (gr.next()) {
current.related_incident.getValue(gr.sys_id);
gr.update();
}
})(current, previous);
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 04:55 AM
var gr = new GlideRecord('x_glti_incident_ma_incident_management_table');
var sysID = gr.insert();
current.related_incident= sysID;
var mySysID = current.update();
gr.setWorkflow(false);
gr.update();
if i am not wrong you want to create incident once you save the record. and once it create should come in related incident field. try now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 07:59 PM
Hi Vardhan,
I already fixed the issue many thanks.