UI Action Form Link

vidhya_mouli
Giga Sage

For a table I have to configure a form link "Show closed activities". This link should only be visible for users with role "emp_admin". When link pressed, the system should open a new tab with list of all closed records that apply to the same Employee. 

 

UI Action.png

 

When I click on the link, nothing is happening. What am I doing wrong?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@vidhya_mouli 

gs object is server side and your UI action is client side.

So it's not working.

do this

I hope your state field name and choice value for Closed is correct. if yes then this will work

function showClosedActivites(){

	var url = '/u_manager_activites_sv_list.do?sysparm_query=u_employee=' + g_form.getValue('u_employee') + '^state=Closed';
	g_navigation.open(url, '_blank');
}

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

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@vidhya_mouli 

gs object is server side and your UI action is client side.

So it's not working.

do this

I hope your state field name and choice value for Closed is correct. if yes then this will work

function showClosedActivites(){

	var url = '/u_manager_activites_sv_list.do?sysparm_query=u_employee=' + g_form.getValue('u_employee') + '^state=Closed';
	g_navigation.open(url, '_blank');
}

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

I changed the code but still when I click on the link nothing is happening. My filed names are right, the state value for Closed is 6. I tried that too and it did not work.

@vidhya_mouli 

can you share your latest script?

did you check any browser console error?

is pop-up enabled in your browser?

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

Screenshot 2023-03-23 1.52.42 PM.png

 

I have no pop-up blocker enabled. But I do have some browser errors:

Screenshot 2023-03-23 1.56.11 PM.png