how to populate the worknotes of change task without using current.update in the business rule

mounika32
Tera Contributor

I have written a BR on change  task table to update the worknotes when incident created . its updating the worknotes only when I use current.update(). as current.update is not  used in BR so I removed and try to give like this but the worknotes of ctask is not updating.

mounika32_0-1704259974885.png

 

How to update the worknotes ithout using current.update() in the BR?

1 ACCEPTED SOLUTION

Tai Vu
Kilo Patron
Kilo Patron

Hi @mounika32 

Let's try to change your Business Rules as following

1. When to run

Before update

Conditions: Work notes changes

2. Advanced

 

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

    //insert new Incident [inc]
    var inc = new GlideRecord('incident');
	inc.initialize();
	inc.urgency = 2;
	//etc
	inc.insert();
	
	current.assigned_to = '';
	current.state = 1;
	//etc

	//set comments
    current.comments = 'Incident ' + inc.number + ' has been raised to handle this task since automation failed.';

	//remove update();

})(current, previous);

 

 

Cheers,

Tai Vu

View solution in original post

6 REPLIES 6

mounika32
Tera Contributor

@Tai Vu , its working now thanks for your help

Vinay2509
Tera Contributor

@Tai Vu Hi Tim, Hope you are doing well,

 

Same issue for me as well, But my case I need to update worknotes and activities once CI(configuration Item) got generated on Change_Task form.

 

For this I have not created any BR but using existing worknotes update function on Create equipment record producer, which uses script include. Its OOB function.. sometime it works but for some instances it will not update.

 

please advise, do I need to create BR for this?

Vinay2509_0-1709636512207.png