Issue in Business Rule

Service now11
Tera Contributor

Hi,

 

I have created a "Reopened" checkbox with a read-only condition in the Incident record and set its default value to false.

Scenario:

When the incident is in any state up to Resolved, the Reopened checkbox is unchecked (false). Once the user wants to reopen the incident (i.e., the state changes from Resolved to New, In Progress, or On Hold), the Reopened checkbox should be automatically checked (true) and set to read-only. Additionally, I want the Resolution Notes and Resolution Code fields to be cleared when the incident is reopened.

I have implemented this in Business Rule. But not getting solution. Can anyone help me on this?

 

Thanks,

Abirami

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@Service now11 

you can use before update business rule

State Changes from Resolved

AND

State Changes to New OR State Changes to In Progress or State Changes to On Hold

Script:

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

	// Add your code here
	current.u_reopened = true;
	current.close_code = '';
	current.close_notes = '';

})(current, previous);

Also use onLoad client script to check if the field Reopened = true then make it readonly

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

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

@Service now11 

I suggested to use business rule and onLoad client script

what did you try so far and what didn't work?

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

@Service now11 

Hope you are doing good.

Did my reply answer your question?

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

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

@Service now11 

Hope you are doing good.

Did my reply answer your question?

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

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