Business Rule when update

Avinash Dubey2
Tera Contributor

Create a Business Rule which will trigger when record is updated in Incident table then update a record in Customer Incident table with updated field

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hello @Avinash Dubey 

Seems you have pasted same requirement of insert business rule (your another question).

What I understood, you need to update customer table incident if regular incident updates.

You need to create After business rule runs on "Update" only. Add filter conditions as which fields going to update. For example, state changes then triggers the business rule.

 

find_real_file.png

 

 

find_real_file.png

 

Script - 

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

	var gr = new GlideRecord('customer_incident'); //enter customer incident table name
	gr.addQuery('parent_incident', current.sys_id);
    gr.query();
    if (gr.next()) {
	
	gr.state=current.state;
	
	//similarly mapp all required fields.
	gr.update();
	}
   gs.addInfoMessage("The customer incident " + gr.number +" has been updated");

})(current, previous);

 

Mark Correct if this solves your issue and also mark ???? Helpful if you find my response worthy based on the impact. 

Thanks
Akshay Kangankar

 

 

View solution in original post

5 REPLIES 5

Community Alums
Not applicable

Hello,

Here what is "Customer Incident table". Are you talking about any third party tool. If yes then it needs integration.

 

Regards,

Akshay 

Customer Incident  Table:

Table Name - Customer Incidents
Fields - 
Inc Number - autogenrated number
Parent Inc Number- number
Short Description - String 250 Mandatory
Description - HTML Mandatory
State - Choice (values same as incident State field values)
Category - Choice ( Same as Incident Category field values)
Subcategory - Choice ( Same as Incident Category field values)
Caller - Reference ( ref to sys_user table filter only active records)
Assignment Group - Reference - (ref to sys_user_group table)
Assigned to - reference - (ref to sys_user table)
Additional Comments - Journal input ( same as incident)
work notes - Journal input

Detail statement :

Create a Business Rule which will trigger when new record will be inserted in Incident table then create a new record in Cusetomer Incident table with below values 
Parent Inc Number, Short Description, Description, State, Category, Subcategory, caller
*Inc Number should be autogenerated.
Once record is inserted show info message on form with new Inc number which will be created on Customer Incident table.

Community Alums
Not applicable

Hello @Avinash Dubey 

Seems you have pasted same requirement of insert business rule (your another question).

What I understood, you need to update customer table incident if regular incident updates.

You need to create After business rule runs on "Update" only. Add filter conditions as which fields going to update. For example, state changes then triggers the business rule.

 

find_real_file.png

 

 

find_real_file.png

 

Script - 

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

	var gr = new GlideRecord('customer_incident'); //enter customer incident table name
	gr.addQuery('parent_incident', current.sys_id);
    gr.query();
    if (gr.next()) {
	
	gr.state=current.state;
	
	//similarly mapp all required fields.
	gr.update();
	}
   gs.addInfoMessage("The customer incident " + gr.number +" has been updated");

})(current, previous);

 

Mark Correct if this solves your issue and also mark ???? Helpful if you find my response worthy based on the impact. 

Thanks
Akshay Kangankar

 

 

Hi ,

thanks for the help .Solution is working