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.

Field type "Document ID" to be used in a business rule

sowmyarajaram
Kilo Guru

Hello All,

Could anyone help me to query on field type "Documnet id"?. I'm currently using below

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


var gr1 = new GlideRecord("policy");
gr1.addQuery('number', current.number);
gr1.query();
while(gr1.next()){
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery('document_id', current.sys_id);
gr.query();
while(gr.next()){
if(gr.state == "approved"){
current.state = "published";
current.active = true;
current.update();
action.setRedirectURL(current);
}
}
}
})(current, previous);

 

Here i'm not able to get into second while loop, field "document_id" is of the type "Document ID".

 

Sowmya

12 REPLIES 12

Table: Policy

condition: state is awaiting approval

Not familiar with that table and can't find one with that name in my developer instance

Ah.. actual name is "sn_compliance_policy"