Business Rule to change Due Date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2023 01:46 PM
Hello Everyone,
We have a current requirement for Due Date on Tasks be set to match a field called Target Date on the Request Item. I've tried different options for Business Rules but none have worked for me so far. Is there anyone who has a proper script for this or knows the best way to achieve this?
Thanks in advance
Gemma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2023 02:36 PM
I tried several variations from the following community help, but didn't get very far and just overwhelmed. 😔
Any ideas would be appreciated, I'm not very good at scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2023 02:46 PM
You potentially need 2 business rules for this. One on the sc_task table to run on create and pull down the date from the RITM. Something like this:
And then one on the RITM to run on Update to propagate changes to the Target Date to all associated tasks, like this:
Please mark as correct/helpful if this helps solve your problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2023 08:31 PM
Thanks so much for all the feedback! I added the 2 business rules. Attached are the conditions and scripts. Unfortunately, the task due date is still not matching task target date. any other ideas to try?
I will be ooo tomorrow but will follow up on Friday.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2023 05:45 AM
On the first business rule, for RITM, it needs to look for a change in Target Date, not Due Date. Sorry if my screenshot was a little confusing - I didn't add Target Date to my record and instead used an existing field - Expected Start. I then edited the script before posting to put in Target Date to match your example, but missed changing the first line that checks for a change. That said, the comparison obviously doesn't need to be done in script. It can be done via the Condition as you attempted - again, you were just looking at the wrong field.
With regards to the business rule on the catalog task table, it doesn't need to look for a field change at all. It should just set the value on Insert. That takes care of the initial value and the BR on the RITM handles any changes that might happen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2023 06:51 AM
Thank you all so much for the help! I used the br you suggested and attached is a screenshot of how I configured when to run, actions and the script. I also had to create a new field Due date. So far the due date is matching target date...Good news!
However now I noticed the request item list is not populating due date..
Do you think I just need another business rule for it? Something like :
current.u_due_date = current.sc_req_item.u_target_date;
current.update();