The CreatorCon Call for Content is officially open! Get started here.

How to add a button to a form within a list in a workspace?

matthew_hughes
Kilo Sage

In the below form in my workspace , I'm wanting to add a new button that will take the user to a particular catalogue item on our service portal if one of the fields on the form has a certain value:

matthew_hughes_0-1756475942880.png

 

I don't have much experience with workspaces or UI Builder and I was just wondering if anyone has done something similar before.

4 REPLIES 4

GlideFather
Tera Patron

Hi @matthew_hughes,

 

go to sys_declarative_action_assignment table and create a new button, label it, select order and then give it the behaviour, something similar to Ankur's suggestion:

https://www.servicenow.com/community/developer-forum/need-help-on-ui-action-to-redirect-to-portal/m-...

 

But what's the use case? Portal is for end users (less technical) and Workspace for admins and agents, why would agent need to go to Portal from Workspace??? They can find most of the information in the Workspace..

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Its_Azar
Tera Guru
Tera Guru

Hi there @matthew_hughes 

I have been there once, so if you want buttons there are a few options for you, you can use declarative action, buttons or simply, you can still use UI action ( in ui action scroll down to the end and you can see the workspace section just enable it and works like a charm). so if its just a button to redirect to a portal Ui, i suggest to use a workspace ui action, very simple.

 

 

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.




Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG

 Microsoft MVP (AI Services), India

Hi @Its_Azar In my UI Action, what code would I need to put in to get the button to work. At the moment, the following doesn't work:

matthew_hughes_0-1756715203917.png

 

Hi @matthew_hughes,

 

and if you try to adjust the OOTB code with action.setRedirectURL()?

 

//OOTB code for "Submit demand" UI Action

current.state = '2';
current.submitted_date = gs.now();
current.submitter = gs.getUserID();
current.update();

action.setRedirectURL(current);

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */