Business Rule Blocking Change Creation From Incidents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 10:10 AM
Good Afternoon,
We have a business rule on our changes that keep a normal low priority change where it can't be created if the planned start date is less than 14 days (in the new state). This is working as intended from the Change > Create New page. However, when trying to create similar changes from an Incident record it blocks being able to create a change (never opens the change form to be filled out). I tried taking off "before insert" and the rule only being "before update" thinking it would run in the new state when a user "requests approval". However, this never ran in the new state with the planned start date being prior to 14 days.
Is there a way to set the default "planned start date" when the change form launches? I am thinking this might resolve the issue. I am also open to other solutions.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 12:01 PM
Hi there @tiguin2798
Yes i guess you can set up a default value for the planned start date field on the change form. This default value should ensure that it meets the criteria specified in your business rule (e.g., at least 14 days in the future).
Use a client script or UI policy to set the default value for the planned start date field when the change form is launched.
The script can calculate the default value based on the current date plus 14 days, ensuring compliance with your business rule.
Instead of blocking the creation of changes based on the planned start date in the business rule, perform the validation when the form is submitted.
Use a server-side script in an onSubmit client script or a business rule triggered on insert/update to validate the planned start date against the business rule criteria.
If the planned start date does not meet the criteria, display an error message to the user and prevent the change record from being created.
If this helps kindly accept the response thanks much.
Kind Regards,
Mohamed Azarudeen Z
Developer @ KPMG
Microsoft MVP (AI Services), India
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 02:38 PM - edited 04-22-2024 02:39 PM
Thank you, I think this will work. However, I do not have much experience with scripting UI Policies and Client Scripts. I found an older post with the below script. Would it be correct to enter this in a UI Policy Script as I have it below? Or would a Client Script be better? (I am not sure that this script is still valid as the post was from 2014.)
For more information, I also did try this client script with onLoad function and it did not work.