dot walked filter condition not working in business rule

jayakaru
Kilo Explorer

Hello guys
i have this business rule to   copy value and update on another filed based on a dot walked filter condition

its not working when fields are dot walked

any suggestions

find_real_file.png

13 REPLIES 13

lSurya 24
Giga Guru

Can you also share screenshot of script?


Hi Surya,
this business rule is on sc_task table and wanting to copy the filed value from parent.sate and update it on request item table (state is the change table)


it works if iam not dot walking , but on dat walked filter fields it is not


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


{


var requestID = current.request_item;


var rec = new GlideRecord('sc_req_item');


rec.addQuery('sys_id',requestID);


rec.query();


if(rec.next())


{



rec.u_change_status = current.parent.state;


gs.addInfoMessage("changeupdated");


rec.update();


}



})(current, previous);


Michael Ritchie
ServiceNow Employee
ServiceNow Employee

If I am following your use case, are you wanting to update the sc_task when the parent state changes?   If so this BR won't work because it only executes when the sc_task is updated and NOT when the parent record is updated.   To solve this you need to create a business rule on the parent table instead.


Michael
m looking at your approach, but iam trying to do this in the workflow using if condition


first iam Gliding to sc_task table get the parent number and then with that parent number iam gliding the change table to validate the change.sate


M not getting the format right


Please help me correct this or any other solution : end result is   i have the sctask attached to a change and the work flow should move by getting the change status


this is the code


function ifScript()


{


var curID10 = current.sys_id;



var rec10 = new GlideRecord('sc_task');


rec10.addQuery('request_item', curID10);



rec11 = rec10.parent;


gs.addInfoMessage(rec11);




var change = new GlideRecord('change_request');


change.addQuery('number',rec11);



change.query();


while (change.next())


{


if(change.state == '3')


gs.addInfoMessage(change.state);


{



return 'yes';


}


return 'no';


}


}