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

Aakash Shah4
Tera Guru

Use this setValue instead of getValue


current.related_incident.setValue(gr.sys_id);


Not working.





Mark Anthony Joson


Expert


EIG / Support Services / Project and System Maintenance



0917 588 9364 mrjoson@globe.com.ph <avillanueva@globe.com.ph>



2199090 https://business.globe.com.ph



<https://www.facebook.com/globebusiness>


<https://twitter.com/Globe_Business>


<https://www.linkedin.com/company/globe-business>




"GOOD GOVERNANCE and DOING THINGS RIGHT the FIRST TIME to AVOID WASTAGE to


multiply OPPORTUNITIES on our journey to service and operational EXCELLENCE





On Thu, Sep 28, 2017 at 7:14 PM, aakashshah <


var gr = new GlideRecord('x_glti_incident_ma_incident_management_table');


  gr.addQuery('u_customer_reference_no',current.sys_id);


  gr.query();


  if (gr.next()) {


gs.log('sys id is'+gr.sys_id);


  current.related_incident=gr.sys_id;


gr.setWorkflow(false);


gr.update();


  }


I think prior to my previous script, I did this one and is not working.




Mark Anthony Joson


Expert


EIG / Support Services / Project and System Maintenance



0917 588 9364 mrjoson@globe.com.ph <avillanueva@globe.com.ph>



2199090 https://business.globe.com.ph



<https://www.facebook.com/globebusiness>


<https://twitter.com/Globe_Business>


<https://www.linkedin.com/company/globe-business>




"GOOD GOVERNANCE and DOING THINGS RIGHT the FIRST TIME to AVOID WASTAGE to


multiply OPPORTUNITIES on our journey to service and operational EXCELLENCE





On Thu, Sep 28, 2017 at 7:28 PM, harshvardhansingh <