Business Rule and UI Policy Combination

r_t_bryan
Kilo Expert

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

8 REPLIES 8

Shloke,


Your idea was simple but pure client side implementation is not secure enough. Any users, who understand the browers, can get around the UI policy to submit tickets.



Since Robert has implemented a business rule and a UI policy, he can just tweat a little to achieve his objectives.



Thank you.


Shishir Srivast
Mega Sage

Hi Robert,



There is no issue with using the BR and UI Policy on the same field. You can have both, but this can be achieved by the way Shloke suggested.



Just adding few things here



For Scenario:


Submission needs to be restricted if planned start/end date is before today and if it's NOT an emergency change.


In this case you can either need to make another fields (Like planned Start/End date) mandatory to stop submitting the form otherwise you need to have a Before BR to validate the date.



Please try with condition:


find_real_file.png


And execute onCondition Scripting if it's true with:



function onCondition() {


  //alert('Date Cannot be Less Than Current Date');


  if(g_form.getValue('type') == 'emergency')


  {


  g_form.setMandatory('justification', true);


  g_form.setVisible('justification', true);


  alert('Please provide the justification why Planned Start/End dates are prior to Current Date');


  }


  else


  {


  g_form.clearValue('end_date');


  g_form.clearValue('start_date');


  g_form.setMandatory('end_date',true);


  g_form.setMandatory('start_date',true);


  g_form.setVisible('justification',false);


  alert('Planned Start/End Date Cannot be prior to Current Date');


  }


}



Please check if this fulfill your business requirements.


SanjivMeher
Kilo Patron
Kilo Patron

Hi Robert,



You should use UI Policy and Data Policy instead of Business rule. UI policy will restrict at UI level and Data policy in List View or Background Scripts.


Using business rule will make it redundant, since UI policy is already restricting users from submitting.



Also the Start and end dates, compare them with Change Opened date, instead of current Date.



Please mark this response as correct or helpful if it assisted you with your question.

shloke04
Kilo Patron

Hi Robert,



If your query is Resolved, would you mind marking the answer as correct and close this thread.



Regards.


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke