Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Page focus is dirty in logs when trying to run a UI action

sn_ella
Kilo Explorer

In my PDI I am creating a script to approve all of the items associated with a request and have the script below to approve all of the items. However, in the logs I am getting "Page focus is dirty". I am unsure what would cause this and how to resolve the issue. I have attached the script below: 

function reqApproval() {
	gs.log("approval running");
    var ritm = new GlideRecord("sc_req_item");
    ritm.addQuery('number', current.number);
    ritm.query();
	
	current.state = '3';
	current.update();
    //set current record to approved
    while (ritm.next()) {
		gs.log("ritm approved");
		ritm.approval = "Approved";
		ritm.req_state = "Approved";
		ritm.update();
    }
	
	var req = new GlideRecord("sc_request");
	req.addQuery('number', current.request);
	req.query();
	
	while(req.next()){
		gs.log("req approved");
		req.state = '3';
		req.update();
	}
	
	gs.log("approval complete");
}

 

Additionally here is the configuration to the script: 

find_real_file.png

1 REPLY 1

Harish LS
Giga Guru

Hi sn_ella,

Looks like this is because of some other script.

Please check the below link. Hope this will be useful to debug.

https://community.servicenow.com/community?id=community_question&sys_id=aa761b8fdb663010be625ac2ca96...

 

If my reply is Helpful/Correct, please mark the answer as Helpful/Correct.

Thanks,

Harish