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

Opening a form on onclick event in service portal

ravish2
Giga Expert

i want to open a form when i click on an image in service portal.

I have already created the widget with image and onclick function is working but how can i get a form to open like given in below image.

3 REPLIES 3

Gurpreet07
Mega Sage

Hi Ravish,


Try with adding an angular directive ng-href="link" to the HTML element;


Form link should be in below format


?id=form&table=table_name&sys_id=record_sys_id&view=view_name


Shamma Negi
Kilo Sage
Kilo Sage

Hi Ravish,



You can either use a "href" or you can use "Link to this page" option and then specify "form" in that page. form is the oob page created by servicenow whoch takes the sys_id of that record and opens up in form view.



Regards,


Shamma


Regards,Shamma Negi

nathanfirth
Tera Guru

The way you would do this is:


  1. Create new widget that contains the image
  2. Trigger a modal window (use ng-click instead of "onclick").
    See this tutorial for working with modals: https://serviceportal.io/modal-windows-service-portal/
  3. In the template of the modal you will want to embed the form widget
    See this article for embedding widgets: https://github.com/service-portal/documentation/blob/master/documentation/widget_embedded.md