i want to make assigned to mandatory

PRAGHATIESH S
Tera Expert

Hi,

 

There is OOB Ui action for interaction table "Close".  when we click on that close button it needs to make "assigned to" mandatory.

can anyone let me know, how can i make changes on here.

PRAGHATIESHS_0-1735554766866.png

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@PRAGHATIESH S 

Please remember this is an OOB UI Action and if you update it then during upgrade it will be skipped

is it for native or workspace that you want to make it mandatory?

Client Script:

function closeInteraction() {

	if(g_form.getValue('assigned_to') == ''){
		g_form.addInfoMessage('Please fill assigned to');
		g_form.setMandatory('assigned_to', true);
		return;
	}

	var dialog = new GlideModal("close_confirmation");
	var msg = getMessage('Confirmation');
	dialog.setTitle(msg);
	dialog.setPreference("sys_id", g_form.getUniqueValue());
	dialog.render();
}

Workspace client script:

function onClick(g_form) {

    getMessage("Are you sure you want to close this interaction?", function(msg) {

        if (g_form.getValue('assigned_to') == '') {
            g_form.addInfoMessage('Please fill assigned to');
            g_form.setMandatory('assigned_to', true);
            return;
        }

        g_modal.confirm(getMessage("Confirmation"), msg, function(confirmed) {
            if (confirmed) {
                g_form.setValue('state', 'closed_complete');
                g_form.save();
            }
        });
    });

    return false;
}

AnkurBawiskar_0-1735558823226.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

9 REPLIES 9

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @PRAGHATIESH S 

 

You can add code in UI action or better create a UI policy on interaction table where state = Closed and make assigned to mandatory. 

*************************************************************************************************************
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/atul_grover_lng [ Connect for 1-1 Session]

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

Hi @Dr Atul G- LNG 

i tried ui policy, but its not working when we click on close button.
I try to add the code on the UI Action, that is also not working

Hi @PRAGHATIESH S 

 

could you please share both codes snippet.

*************************************************************************************************************
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/atul_grover_lng [ Connect for 1-1 Session]

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

Hi @Dr Atul G- LNG 

PRAGHATIESHS_2-1735555658646.png