I cannot set UI Policies nor Client Scripts on agile_board.do

jordimsant
Kilo Sage

Hi community,

 

In my organization, we have a requirement for certain stories to fill some fields when they reach "Complete" state.

 

I already knew that when a user tries to move a story from "Draft" to another state, then a form opens if the acceptance criteria are not filled.

 

jordimsant_0-1769071437778.png

 

 

Hence, my idea was to copy this UI Policy and adapt it for my purposes. Nonetheless, I cannot say why but it is not working, and that's why I am here. The info in my UI Policy is the following:

  • Conditions: state is complete, type is not spike and original task.task type is story
  • Global: true
  • On_load: true
  • Reverse if false: true
  • Inherit: false
  • UI Actions: u_test_result (mandatory and visible), u_testing_resolution (mandatory and visible)
  • Execute if true:
function onCondition() {
	//Type appropriate comment here, and begin script below
    var getType = g_form.getValue('u_category'); // Get Type of change request
    var getState = g_form.getValue('state'); // Get state of change request

    if (getType == 80) {
        if (getState == '3') { // Scheduled State
            var modal = new GlideModal("glide_confirm_standard", false, 600);
            modal.setTitle("Modal Title");
            modal.setPreference("title", "Modal Body");
            // modal.setPreference("warning", "false");
            modal.setPreference("onPromptComplete", function() {
                alert("Ok");
            });
            modal.setPreference("onPromptCancel", function() {
                alert("Cancel");
            });
            modal.render();
        }
        else {
            return false;
        }
    }
}​

Does anybody know why the form is not opening? How could I solve this problem?

 

Thanks for your help in advanced!

2 REPLIES 2

Ankur Bawiskar
Tera Patron

@jordimsant 

why not use client script for scripting?

UI policy is used when requirements are simple.

For your UI policy conditions to work those fields which you are using in condition should be present in form view.

is that happening?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Dr Atul G- LNG
Tera Patron

Hi @jordimsant 

You cannot make a UI Action mandatory.
The UI Actions u_test_result and u_testing_resolution must be visible and mandatory via a UI Policy or client script.
What is your use case?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************