- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 04:06 AM - edited 11-06-2023 04:10 AM
HI,
When we set the state to on hold and on hold reason field to any one option, then we want to populate the date/time on "On Release" field level.
During the process, when we change the on hold reason field to any other options without changing the state from on hold then we don't want to change the populated date/time.
And the populated the time should change only when we change the state from on hold.
We wrote the below business rule to run when state changes to on hold and it's working fine.
Now the requirement is we don't want to populate date/time when the "on hold reason" field option is either A or C.
Can anyone please help us to adjust the below script to skip the date/time.
(function executeRule(current, previous /*null when async*/ ) {
//functionality configurations
var tz = "America/New_York";
var hours = 48;
var rightNow = new GlideDateTime();
var dur = new GlideDuration(3600000 * hours);
var schedule = new GlideSchedule('021479371bdb99d04649c845604bcb58', tz);
var releaseDT = schedule.add(rightNow, dur);
current.u_hold_release = releaseDT;
})(current, previous);
Thanks,
LARA REDDY
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2023 02:04 AM
HI Lara,
Hope the below script helps you.
AR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 04:26 AM
Hi Lara,
Why don't you make use of Condition field available under advance option in BR form. In condition field you can check the current value of any field if it only matches then only the below script will run.
You can write something like below in condition:
current.on_hold_reason !="a" || current.on_hold_reason != "c"
If my answer helps then please mark it correct.
Thanks,
Utpal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 04:41 AM - edited 11-06-2023 04:46 AM
Hi Utpal,
Many thanks for the response.
We tried the above logic but no luck.
Example:
1. State is On hold && on hold reason is B = 2023-11-08 04:35:25 [date/time is populated]
2. State is still same && on hold reason is changed to A == On Reason field populated date/time is cleared
3. And now still state is same and on hold reason is changes to B or D == We need to set the first populated date/time [2023-11-08 04:35:25] again because we're not changed the state from on hold.
I hope you got my requirement/issue.
Thanks,
LARA Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 04:52 AM
Hi @LaraReddy ,
You probably can use another field to temporarily save the value of On Release, then populate to value back to On Release as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 04:47 AM
Hi @Ankur Bawiskar ,
Could you please us here.
Thanks,
LARA