When problem is updated. get short description of the incident whose description is same as of this short description we have to set it in problem statement field

JOHN221
Kilo Contributor

this short description we have to set it in problem statement field.

1 ACCEPTED SOLUTION

Dan H
Tera Guru

Hi John,

Business rule running on the problem table:

find_real_file.png

Advanced tab script:

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

	var problemShortDescription = current.short_description;
	var incidentShortDescription = '';
	
	var incidentGR = new GlideRecord('incident');
	incidentGR.addQuery('description', problemShortDescription);
	incidentGR.query();
	if(incidentGR.next()){
		incidentShortDescription = incidentGR.short_description;
	}
	current.problem_state = incidentShortDescription;

})(current, previous);

 

Edit: This script may need to be updated, if it doesn't work as intended, please outline your requirement again as it's quite unclear

Please mark answer as helpful/correct based on impact

View solution in original post

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi John,

You should be able to build this flow via flow designer. https://docs.servicenow.com/bundle/rome-servicenow-platform/page/administer/flow-designer/concept/fl...

Let me know if you hit a roadblock.

Dan H
Tera Guru

Hi John,

Business rule running on the problem table:

find_real_file.png

Advanced tab script:

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

	var problemShortDescription = current.short_description;
	var incidentShortDescription = '';
	
	var incidentGR = new GlideRecord('incident');
	incidentGR.addQuery('description', problemShortDescription);
	incidentGR.query();
	if(incidentGR.next()){
		incidentShortDescription = incidentGR.short_description;
	}
	current.problem_state = incidentShortDescription;

})(current, previous);

 

Edit: This script may need to be updated, if it doesn't work as intended, please outline your requirement again as it's quite unclear

Please mark answer as helpful/correct based on impact

JOHN221
Kilo Contributor

Thanks