Assignment Related to Business Rule

Shubham Rai
Tera Contributor
  • Create a table called ‘incident_temp’ with below two fields
    Incident Number
    Short Description
  • Create a business rule, this should execute only whenever any new incident created on ‘Incident’ table
  • Create a new record in ‘incident_temp’ table from above newly created Incident record and set Incident Number and short description values and save the record in ‘incident_temp’ table

Please, help me with 2nd point

1 ACCEPTED SOLUTION

Hi,

script looks ok

I hope BR is after insert on incident table

are you sure the table name is incident_temp or it is u_incident_temp

(function executeRule(current, previous /*null when async*/) {

var rec = new GlideRecord('u_incident_temp');
rec.initialize();
rec.u_number = current.number; // field name is correct?
rec.u_string_1= current.short_description; // field name is correct?
rec.insert();

})(current, previous);

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Hi,

script looks ok

I hope BR is after insert on incident table

are you sure the table name is incident_temp or it is u_incident_temp

(function executeRule(current, previous /*null when async*/) {

var rec = new GlideRecord('u_incident_temp');
rec.initialize();
rec.u_number = current.number; // field name is correct?
rec.u_string_1= current.short_description; // field name is correct?
rec.insert();

})(current, previous);

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Shubham Rai
Tera Contributor

Hii Ankur,

my bad 

i have put wrong table name .now it is working fine.

 

Thanks and Regards,

Astik Thombare

@Astik Thombare 

Glad to know.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

I have marked it as correct.

Thanks for your help.

regards,

Astik