How to bypass mandatory fields of Actual start date and Actual end date, it can be cancelled

SrinivasuSagi
Tera Contributor

Hi Community,

 

Requirement: Make mandatory of Actual Start date and Actual end date fields in Change request at time of state is "Ready for deployment" but it will bypass this rule for requestor wants to cancel the change requests (means whenever requestor clicks the Cancel UI action button those Actual Start date and Actual end date fields are not mandatory and those can be cancelled

 

I have used below UI policy to Make it mandatory for Actual Start date and Actual end date fields, it works fine to set mandatory for those fields 

 

SrinivasuSagi_0-1734011057578.png

 

here we have a Cancel UI Action button but i am not sure how to set Not Mandatory for fields of Actual start date and Actual end date

SrinivasuSagi_1-1734011260238.png

the below screenshots are "Cancel" UI action button scripts

SrinivasuSagi_2-1734011501591.png

 

SrinivasuSagi_4-1734011567663.png

 

Please check & advise how to set Not Mandatory for those felids whenever requestor clicks Cancel button

 

Thanks,

Srinivasu

 

 

 

2 REPLIES 2

Zach Koch
Giga Sage
Giga Sage

You don't need to do anything. Your UI action is all server side. UI Policies are not enforced on the server side, only client side, and since your UI policy is driven by the state being Ready for Production Deployment, after clicking your UI action, the state will be changed to Canceled and the form will no longer require those to be mandatory client side automatically.

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

Runjay Patel
Giga Sage

Hi @SrinivasuSagi ,

 

You need to make client callable UI Action, use below script in your script.

function cancelChange() {
  
  g_form.setMandatory('work_start', false);
 g_form.setMandatory('work_end', false);

  gsftSubmit(null, g_form.getFormElement(), 'cancel_rfc'); 
}

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------