Business Rule and UI Policy Combination
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2017 08:44 AM
Hi All,
I have a business requirement to prevent users from submitting a change request with planned start / end dates prior to the current date, unless it is an emergency change, to which they must supply justification. I have taken the approach of using a BR to abort the action if the change is anything other than an emergency, and if it is an emergency the justification field is empty. Additionally, I have used a UI policy to hide / show the field and make the field mandatory if the change type is emergency and the planned start / end date is prior to the current date.
Can someone tell if this is good practice, and if not what the best solution would be? I'm not sure if the UI policy and BR would clash, or act unexpectedly because they are operating on the same field.
Thanks in Advance,
Robert
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2017 09:26 AM
BR and UI policy are both different as BR runs on Server side and UI policy on Client side. This does not give any performance impact. You are on right way.
Please like or mark helpful if this answer your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2017 09:32 AM
Robert,
The key field to your scenario is the change type.
You can use a UI policy to set the Justification to be visible and mandatory if the change type is emergency not necessary to include the planned start / end date is prior to the current date.
You can use a business rule to handle the planned start / end date vs. the current date requirement. Use condition in the business rule to check If the change type is emergency, then the planned start / end date can be in the past. Otherwise, the business rule enforce the dates to be in the futures.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2017 10:22 AM
Data validation needs a two-fold approach, server side and client side. Since client side is javascript and can be circumvented, server side gives you ultimate control over what actions are able to be taken. The only thing is if you just set abort in the BR, the user may not know what is going on.
Use a client script to give a meaningful message to the user before they submit the form too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2017 10:46 AM
Hi,
You don't need a Business Rule for your Requirement. Simply an UI Policy on the Client Side would be enough to perform your requirement as explained below:
1) Create A UI Policy on the Change Request Table with Conditions as "Planned End Date Before Today" and use the below Script :
Script:
function onCondition() {
if(g_form.getValue('type') != 'emergency')
{
alert('Date Cannot be Less Than Current Date');
g_form.clearValue('end_date');
}
else if(g_form.getValue('type') == 'emergency')
{
alert('Date Cannot be Less Than Current Date');
g_form.clearValue('end_date');
g_form.setMandatory('justification',true);
}
}
Please refer the below screen shots on configuring the UI Policy as mentioned above:
So As per the above UI Polciy configured, it will throw an alert and clear out the Field Value i.e. not allowing the User to submit the form. And if the Change Type is Emergency, it will have the same Date Validation as well as it will make the Justification field on the CHange form as Mandatory.
Similarly you can do it for Planned Start Date also.
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke