
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2017 10:50 AM
Dear All,
Greetings Everyone,
I am testing something in my personal instance for self learning. I created a custom field like "reason". I have Priority values from 1-5.
Now What my requirement is.. When ever the Priority changes from P4 or P5 to something else ( P1,or P2 or P3), My custom reason field should be visible and be made mandate. And when the severity changes from P4 to P5, nothing should happen.
The reason because, I have a SLA set up for P1 to P3 tickets.. So when the ticket is upgrading from P4 to P3, the SLA is getting attached with the time already elapsed. So I want to enter the reason to review the ticket for upgrade..
I have my code working for all the priority changes but what I want is only for when the priority gets upgrade from either P4 of P5 to P1/P2 and P3..
Any suggestions would be greatfu;
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2017 03:42 PM
Try with this.
newValue != oldValue && ( (oldValue == P4 || oldValue == P5) && (newValue == P1 || newValue == P2 || newValue == P3))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2017 11:06 AM
When you build an on-change client script you have a couple values available by default: oldValue and newValue
The oldValue contains, predictably, what the field was before it was changed. newValue contains the new value. You can build your logic around these.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2017 01:09 PM
Thanks for the suggestion Kevin,
I had the code figured out for newValue != oldValue and my setDisplay and mandate are working fine as expected.
However, I am stuck with the display and mandate should happen only if the priority is changed from P4/P5 to something else.. but not always.. Here in this If condition.. I need some assistance..
Thanks
Shan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2017 03:42 PM
Try with this.
newValue != oldValue && ( (oldValue == P4 || oldValue == P5) && (newValue == P1 || newValue == P2 || newValue == P3))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2017 08:09 AM
Thanks Deepak,
That logic worked.
Thanks
Shan