Able to fetch required result in background script but the same logic is unable to give expected results when ran on Business rules.

Aindrila Mondal
Tera Expert

Able to fetch required result in background script but the same logic is unable to give expected results when ran on Business rules.

This the logic we tried in background script,working as expected it printed 6 times:

image

The same logic when tried on Business rule doesn't even print once:

image

 

Any help is appreciated!

 

Thanks.

 

9 REPLIES 9

johnfeist
Mega Sage
Mega Sage

Hi Aindrila,

Working with sys_ids can be tricky.  The issue is around sys_ids not being strings.  The general rule of thumb is to use code like this:

var num3 = current.sys_id.toString();

I suspect that adding a toString() to getUniqueValue() will give you the same result.

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

   Hi,

Thanks for your reply.I tried as you mentioned but still it didn't workout.

var num3=current.getUniqueValue().toString();//sys_id of result record in scan_result

    var s=new GlideRecord('scan_suite_execution');
    s.addEncodedQuery('result='+num3);
    s.query();
    
    while(s.next()){
        gs.log('record is matching');
        
    }

Hi Aindrila,

Have you run your BR through the debugger?  That will let you see what value is going into num3.  Also for debugging purposes you can add:

var sQuery = s.getEncodedQuery();

Did you try

var num3=current.sys_id.toString()

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

SumanthDosapati
Mega Sage
Mega Sage

Hi,

Try current.sys_id instead of current.getUniqueValue()

If still didnt work, then put a log for num3 and see what value is printed..

 

Regards,
Sumanth