Service portal form views defaults

brendanhamman
Giga Contributor

Use:
- I want to show a specific form view to all users (ITIL and ESS (user with no role)) using the "form" widget on portal.
- Using the widget, it can accept the "view" parameter from the URL, which works as expected for ITIL users.

Issue:
- If the user is an ESS user viewing the same page as an ITIL user, any "sc_req_item" record displayed through the form widget ignores any view you passed to the widget, and it will default to the "Self Service view".

Troubleshooting:
- Incidents had this behaviour too, but I've found that there is a business rule called "incident functions" that will change the view for ESS service portal users if the name of the view does not start with "ess". 
- If there is a business rule for this on sc_req_item table, I cannot find it.
- Doesn't matter what the view is named. I have tried sp, spview, ess_sp
- Haven't found the answer on the community
- There is no client script running that would be overriding the view
- There is no "view rule" that is overriding sc_req_item view (as view rules don't apply to users with no roles)
- The widget shouldn't be overriding the sc_req_item view
- It is only doing it for ESS users, not ITIL
- Can't find a sys_properties that would be overriding for sc_req_item view

Steps to Reproduce: 

1) Create a form view on sc_req_item called "spview"
2) Create a portal page named "test", with only 1 widget: Form
3) As an ITIL user, display the portal page, and pass in a table / sysid / view URL parameters: e.g. /sp?id=test&table=sc_req_item&sys_id=25a3ecb7dbe50410d185fef86896195d&view=spview - success.
4) As an ESS user (a user with no roles), display the same portal page with the same url parameters, and your view will be overridden with the "Self Service view".

I am at a complete loss. My only other option is just customizing the baseline "Self Service view", but that doesn't give me the variable view options that I want. 

 

3 REPLIES 3

johansec
Tera Guru

May be a hack but a possible work around. 

Can you embed the form widget within a newly created container widget. 

Add logic in the server script of the container widget to determine the view you would like based on the current user. 

Fetch the form widget in the server script with the view you would like as an agrument. 

Display the fetched widget in the html. 

 

You also can make the same parameters that for widget has so you can use it the same way you normally use the form widget but now it has built in logic specific to your need. 

 

Hopefully you find a better way than this but was what popped up in my head. 

Thanks for your response.

"Can you embed the form widget within a newly created container widget." - I tried this as well, even though you can see the "view" parameter is brought in from the same line in the form widget server code:

data.view = options.view || $sp.getParameter("view") || $sp.getParameter("v");

It is "accepting" my view when I pass it in, since it works and shows the correct view when you impersonate an ITIL user, or you are viewing an incident record in the form. But when you impersonate an ESS user and view an sc_req_item, it defaults back to the "Self Service view" no matter what you do.

Super frustrating. We use the "Self Service view" for something else, so I do not want to customize that view for my other purpose of showing a separate view to certain ESS users. 

True, even if we hardcode the value for view in the widget, it still keeps opening the ritm record in Self Service view only for the ess users.

Still looking for any solution/workaround.