How to compare table form data and current catalog form variables data

raj149
Giga Guru

Hello All,

 

In workflow if activity i am trying to check current catalog form variables and table  data .

If table data is not is equal to catalog variables data then i need to trigger an approval by using approval activity.

 

I am using below script but it is not working 

 

var BA = current.variables.select_business_application_name;
var gr = new GlideRecord('cmdb_ci_business_app');
gr.addQuery('sys_id', BA);
    gr.query();
    if (gr.next()) {
 
if(gr.name != current.variables.name ||gr.install_status != current.variables.install_status ||gr.assignment_group != current.variables.assignment_group ||gr.support_vendor != current.variables.support_vendor ||gr.platform != current.variables.platform ||gr.application_service != current.variables.application_service ||gr.business_criticality != current.variables.business_criticality ||gr.data_classification != current.variables.data_classification ||gr.workshift != current.variables.workshift ||gr.application_url != current.variables.application_url ||gr.documentation_url != current.variables.documentation_url){
answer = true;
}else{
answer = false;
}
}

 

 

What i am missing in above script..

 

 

Thanks in advance 

 

Best Regards,

Raj

 

2 REPLIES 2

Harsh_Deep
Giga Sage
Giga Sage

Hello @raj149 

 

You are not passing sys_id of the record.

gr.addQuery('sys_id', 'sys_id'); // please pass sys id here

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

Hello @Harsh_Deep 

How can i pass the sys_id of the record

gr.addQuery('sys_id',BA.sys_id);

 

or is there any other way...?