- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2022 12:51 PM
Hello ,
I am trying to create a catalog task using business rule, so the requirement is when first task created through workflow when this task is closed complete one variable is editable in this task if someone select that variable as Yes the it should create the other task however I cannot acheive this through workflow as the workflow is triggered already and we have to introduce this task in middle thats why need to use business rule
I have tried with below code but it is not working
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord('sc_task');
gr.initialize();
gr.request_item = current.sys_id;
var rfsTitle = current.variables.RFS_Title;
gr.short_description = "Create SOW - " + rfsTitle;
var rfsDetailedDescription = current.variables.Detailed_description_Requirement;
gr.description = rfsDetailedDescription;
;gr.insert();
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2022 01:08 PM
Try to add an additional condition in the BR condition field as "current.variables.XXXXX.changes()" as mentioned here:
and see if this restricts the BR on every update.
Edit:
It would be even better if you remove your variable condition in the condition builder and write this only in the condition field of the BR:
current.variables.XXXXX.changesTo(value);
Replace "value" with the backend name of "Yes" and XXXXX as the variable name.
Don't forget to check the "update" check box in the BR.
Give it a try.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2022 12:58 PM
Hi,
I think you need to run this BR on update so check update in the BR and give it a try.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2022 12:59 PM
Hello Sunjyot,
Thanks for your reply.
For update it is working but what is happening is everytime whenever RITM record is updated it is creating as new task.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2022 01:08 PM
Try to add an additional condition in the BR condition field as "current.variables.XXXXX.changes()" as mentioned here:
and see if this restricts the BR on every update.
Edit:
It would be even better if you remove your variable condition in the condition builder and write this only in the condition field of the BR:
current.variables.XXXXX.changesTo(value);
Replace "value" with the backend name of "Yes" and XXXXX as the variable name.
Don't forget to check the "update" check box in the BR.
Give it a try.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2022 09:03 PM
Hello Sunjyot,
Yes it is working correctly . Thanks for your help