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

@vidhya_mouli 

are you sure the field name is state and not u_state since it's a custom table?

what's the error in browser console? what happens when user clicks on it?

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

The field name is state as it is extended from task table.

The browser error I get is as follows:

Screenshot 2023-03-23 1.56.11 PM.png

 

When the user clicks on the link, nothing happens.

@vidhya_mouli 

in script your function name is wrong

it should be this

showClosedActivities and not showClosedActivites

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