How does Form Widget determine what view to use?

gaf627
Tera Expert

I'm using the form widget to display a form depending on the type of record selected (incident, requested item, demand, etc.) from an open records page.  How does the form widget determine which view to use?

Examples:

  1. Logged into Service Portal as a user with no role (ess user). Select an open incident. The form widget displays the Self Service view, as I would expect.
  2. Logged into Service Portal as a user with itil role.   Select an open incident. The form widget displays the Service Portal view.  I expected it to display the Default view, which is what is displayed when I log into the backend.

Thanks!

1 ACCEPTED SOLUTION

ChrisBurks
Mega Sage

The form widget looks for the parameter "view" or "v" on the url or as an option from the option schema. 

URL example: <instnace_name>.service-now.com/sp?id=form&table=sc_req_item&sys_id=<record_sys_id>&view=<name_of_view>  

If a view name is not given in the url or the option, I believe it will default to "sp" (service portal). If a "Service Portal" view isn't found then depending on roles it will default to "Default" view or the view the user is allowed to see.

 

 

View solution in original post

7 REPLIES 7

gaf627
Tera Expert

Ahh, understood.  Thanks for all the help!

ChrisBurks
Mega Sage
The first place the widget will look at is the URL however if you look at the form widget code it would look at a few different places for the view. URL (view or v parameters) Option (even if there isn't one in the option schema) Input In order to pass as an option if there isn't a view property in the option schema, you would use the JSON field in the widget instance when viewing from the platform UI. Or if you've embedded it you would set the option when calling the form widget.

Sri Harsha5
Mega Contributor

Even though in URL i have mentioned the view name, for the end user its still opening the self service view.

Does anyone have a solution for this issue????