Business Rule

yoli1
Tera Contributor

Hi Team i have a field that is from CMDB Integration and when i try to call him in business rule it doesn't work does anyone know why ? 

 

 

 if (current.name_of_field === 'Active')

 

 

 

 

10 REPLIES 10

yoli1
Tera Contributor

@Uncle Rob i also tried a background script and it's also doesn't work

 

 

Uhh... that would only work if the x_snsab_snow_sam_i_snow_status was a field on the cmdb_ci_computer table.  That doesn't sound likely as that x_snsab shows that its in a different scope.

 

Why didn't you try to do what I talked about:   Log out the values of the fields before you query for them.

yoli1
Tera Contributor

@Uncle Rob How can i do that ?

Hi yoli1,

 

In your background script try

 

var gr = new GlideRecord('cmdb_ci_computer');
gr.addQuery('x_snsab_snow_sam_i_snow_status', 'Quarantined');
gr.query();
while (gr.next()) {
  gr.operational_status = 'deactivated';
  var result = gr.update();
  gs.info(" Result from updating cmdb_ci_computer record is: " + result);
}

Is there a value 'deactivated' for the choice for that field 'operational_status'?  and as Robert indicates, there may be some application scope related issues here. If you don't get the sys_id value in 'result', the update failed.

var dontUseGrAsAVariableName = new GlideRecord('cmdb_ci_computer');
dontUseGrAsAVariableName.addQuery('x_snsab_snow_sam_i_snow_status', 'Quarantined');
gr.query();

gs.info("Always check if you're actually selecting the right data before you start updating");
gs.info("This is how many we retrieved: " + dontUseGrAsAVariableName.getRowCount());