BR Filter condition appearing as error message

Anubhav24
Mega Sage
Mega Sage

Hi All,

We have configured a new BR on [pm_project] table in that we are creating a request using cart API and then we are trying to update the "Requested For" on [sc_req_item] table. This RITM has group approval

 

The moment the update statement executes , we receive an error message stating the condition of a BR written on [sysapproval_group] table.
The error message is like : "Conditon 'Condition: current.startsWith("CHG") && (current.parent.state == '-5' || current.parent.state == '-4')' in business rule 'Validation of approval' on sysapproval_group: GAPRV1504408 evaluated to null; skipping business rule".

This is a filter condition written in the "Condition" field on BR and this is nowhere printed as an statement.


The approval number displayed is the approval generated at RITM level for the newly created Request. I can not understand why is approval BR which is not even getting executed and getting skipped is displaying its condition as an error message.

 

Could it be like since the RITM is awaiting approval we can not update any fields on it?

Any advise would be appreciated. Thanks in advance

1 ACCEPTED SOLUTION

Anubhav24
Mega Sage
Mega Sage

My bad misread the condition "current.startsWith("CHG")" it should have been current.number.startsWith("CHG")

Closing this thread 

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Anubhav24 

please share some screenshots of your BR condition and the script

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

The BR condition is : Start Date of Archiving is not empty

Script is :

var cartItem = cart.addItem('c4e1ed3bf7bed110ec1ceeb74851e0ff'); 

cart.setVariable(cartItem, 'registered_with_lever', 'no'); 
cart.setVariable(cartItem, 'mail_id', 'abc@aqwe.com');
cart.setVariable(cartItem, 'request_category', requestcategory); 
cart.setVariable(cartItem, 'comment_query', comment_query);
cart.setVariable(cartItem, 'requested_for', current.project_manager);


try
{
var req = cart.placeOrder();
gs.addInfoMessage('Request Raised is '+ req.number);
}
catch(ex)
{
    gs.error('Error occured while raising request for when the Start Date of Archiving is populated '+ ex);  
}

var grREQ = new GlideRecord('sc_request');
if(grREQ.get(req.getUniqueValue()))
{
    grREQ.requested_for = current.project_manager;
    //grREQ.company = current.project_manager.company;
    grREQ.update();
}

var grRITM = new GlideRecord('sc_req_item');
if(grRITM.get('request',req.getUniqueValue()))
{
    grRITM.company = current.project_manager.company;
    //grREQ.requested_for = current.project_manager;
    //grRITM.update(); // This is the statement causing issues
}

Anubhav24
Mega Sage
Mega Sage

My bad misread the condition "current.startsWith("CHG")" it should have been current.number.startsWith("CHG")

Closing this thread