The CreatorCon Call for Content is officially open! Get started here.

How to grab the Number of the Record Using Business Rule

mark141230
Tera Expert

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.

find_real_file.png

Here is the Incident created

find_real_file.png

find_real_file.png

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);

6 REPLIES 6

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.


mark141230
Tera Expert

Hi Vardhan,



I already fixed the issue many thanks.