Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

we want to hide form action of create incident from form context menu of SIR form

Siva_Prasad
Tera Contributor

we want to hide form action of create incident from form context menu of SIR form after one incident is created from the security incident ?Is there any solution for this?

 

18 REPLIES 18

I have added this logic in condition , but it is not working in  SIR workspace , still create incident form action is coming after one incident is created 

Lets try with on-load client script removal as a fallback If you cannot change the workspace action or if the action is injected by a plugin, hide it on the client after the form loads. Example

function onLoad() {
  // Wait until the form model is ready and then check the incident field
  if (g_form && g_form.getValue('incident')) {
    g_form.removeContextAction('create_incident'); // replace with your actual action name siva
  }
}

 

This is a fallback and may require tweaking for the workspace environment. In some Now Experience apps you need to hook into the view model instead of g_form.

@lakshaysharma 

I couldn't find any documentation for this method.

Could you please share that?

May be it's not documented but did it work for you? Please share screenshots for the same so that it helps to know if it works in workspace.

g_form.removeContextAction

 

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

Ankur Bawiskar
Tera Patron
Tera Patron

@Siva_Prasad 

please share screenshots of that button and what change you did

are you sure it's Normal UI action OR it's a form Action

 

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

Ok sure I will share screenshot