dot walked filter condition not working in business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2017 11:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2017 11:06 AM
Can you also share screenshot of script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2017 11:10 AM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2017 11:07 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2017 04:06 PM
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';
}
}