Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Two variables only Mandatory when changing to Closed Complete

Community Alums
Not applicable

Good Morning! 

 

I'm stuck a few days at the following problem: On that SCTASK I have 3 variables: 

- Reject (checkbox) true/false;

-Posting Date (date)

- SAP Number (Text line) 

 

I need that Posting Date and SAP Number be mandatory ONLY when changing state to Closed Complete and Reject is not flagged (false) - so agents can work/edit those variables anytime they need but when closing the task - if reject is false - then those two variables (SAP and Posting Date) need to be mandatory! 

I've tried Client Script OnChange and OnSubmit but I failed because I always say 'if g_form,getValue(state) is == Closed Complete but it was wrong because it is when (CHANGING to does not allow to let variables x and y empty).

 

I want to make this work with client script and not BR or duplicate the UI ACTION 'Close task'. 

Does someone have some idea? 🙂 

2 REPLIES 2

Sohail Khilji
Kilo Patron

Why not use Ui policy ? Did you try to create it ?


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Community Alums
Not applicable

My problem is the same, How to say 'only when changing to State Closed Complete'?