-
Notifications
You must be signed in to change notification settings - Fork 694
change state if RITM state changes #1399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Create before insert/update business rule on sc_req_item table and give condition if state changes to 2 OR cat_item.sc.catalogs is "yourchoice"
readme file to provide details on business rule to change state.
gr.orderBy('order'); | ||
gr.setLimit(1); | ||
gr.query(); | ||
if (gr.next() && gr.getValue('state') == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you added this condition to the query, you would not need to check the state for '1' (the magic number).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed "if" condition from the script, instead added inside the query.
var gr = new GlideRecord("sc_task"); | ||
gr.addQuery('request_item', current.sys_id); | ||
gr.orderBy('order'); | ||
gr.setLimit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if more than one sc_task is under RITM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed setLimit(1) so that it will update all the sc_task related to RITM
|
||
var gr = new GlideRecord("sc_task"); | ||
gr.addQuery('request_item', current.sys_id); | ||
gr.orderBy('order'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to sort the results if you don't have a clear reason, in this case, you are sorting a list with one record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the orderBy query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a look at the added comments and resubmit your script accordingly. Thanks.
updated the script : sc_task will change the state from open to work in progress when RITM state changes to work in progress (set this condition in filer condition).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the script : sc_task will change the state from open to work in progress when RITM state changes to work in progress (set this condition in filer condition).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the script, please review it and let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, leaving merge up to @Lacah
This business rule is to set state of sc_task table when sc_req_item state changes.
Create before insert/update business rule on sc_req_item table and give condition if state changes to 2 OR cat_item.sc.catalogs is "take your choice".