Service Portal Form Widget - does not display the variables and the view is not per the $sp.getForm parameter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2019 07:52 AM
I created a category, catalog, and catalog item and using a clone of the Form widget to display the sc_cat_item. I have an ACL that allows anyone to read the sc_cat_item for my particular catalog item. I also created a view named 'minimum' for the sc_cat_item that contains Opened, Opened By, Watchlist, Request, Variable Editor, Activities. The form is initialized with: $sp.getForm('sc_req_item', <ritm sys_id>, '', 'minimum');
Four user groups, the requested_for user, and various sc_cat_item variable values are used to determine which sc_cat_item records the sys_user is allowed to accessed and which is working as expected.
Issue:
For any user that is not in one particular user group, the view actually displayed in the form widget is the 'ess' view and the variables are not displayed. The form data 'view' attribute is also set to 'ess'.
Attempts to resolve:
1. Checked all sc_req_item ACLs to verify there is no access control for the one user group for my catalog item.
2. From a console log of the form data resulting from the $sp.getForm, verified that no scripts, etc. relative to the form affects access.
3. From $sp.getRecord('sc_req_item',<ritm sys_id>); canWrite() returns true.
4. From $sp.canReadRecord('sc_req_item',<ritm sys_id>; canRead() returns true.
I appreciate any assistance!
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2019 10:09 AM
Hi Janet,
I hope you found an answer already (if so, please share).
If not, my first thought was about view rules, but I'm not even sure $sp.getForm would honor these or if it would appear in the form data you logged.
Also, are you sure this is the ess view? If you update this view, do you see your change reflected on the portal?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2019 08:29 AM
I did find a work around. Apparently the 'ess' view is the default for all users. I had to create a group with the view_changer role and programmatically add users to the group on submit of the request. Here is the code to add users to a group:
function addUserToGroup(groupSysId, userSysId) {
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', groupSysId);
gr.addQuery('user', userSysId);
gr.query();
// If the user is not currently in the group then add.
if (!gr.hasNext()) {
gr.initialize();
gr.group = groupSysId;
gr.user = userSysId;
gr.insert();
}
}