Public Facing form not showing Multi-Row Variable Set

Luke51
Tera Contributor

Hi all, 


I've created a public facing form in my PDI and setup multiple variables and MRVS, see screenshot below:

Public Facing Record Producer.png

 

When accessing the form as a public user the MRVS isn't visible, see below screenshot:

 

No MRVS on Public Facing form.png

 

The permissions on the variables in the MRVS are all set to public.

 

Is there a catalog script or workaround to getting this one solved?

 

Have also read about limitations within this KB article as well - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0681861

 

Thanks and appreciate the assistance.

1 ACCEPTED SOLUTION

Markus Kraus
Kilo Sage

The closest I've got is displaying a MRVS, but unfortunately adding a new entry is not possible. Fixing this isn't possible in an OOTB way and as such I suggest you to instead give method a try:

0.) Read this post: https://www.servicenow.com/community/developer-articles/show-case-the-service-portal-experience-app-...

1.) Create two custom tables (one for the main form and one for the "MRVS" table) with proper ACLs

2.) Configure the Form of the custom table to your likings

3.) Add a new (custom!) relationship that will allow you to put the MRVS table on the main form as an "embedded list"

 

If you're interested in the "public MRVS display way":
1.) Create a new public page

2.) Create a new Scoped Cache named "public_cat_items"

3.) Add a new Widget Instance with the following widget:
HTML: 

<sp-widget widget="::data.cat_item" />

Server Script:

(function() {
	data.cat_item = $sp.getWidget("widget-sc-cat-item-v2");

	var itemSysID = $sp.getParameter("sys_id") + "";
	var guestCriterias = ["76f09af6cb1200108ad442fcf7076dbf"];
	var cGr = new GlideRecord('sc_cat_item_user_criteria_mtom');
	cGr.addQuery("sc_cat_item", itemSysID);
	cGr.addQuery("user_criteria", "IN", guestCriterias);
	cGr.setLimit(1);
	cGr.query();
	if (cGr.hasNext()) {
		var catItem = null;
		if (gs.getUser().getName() == "guest") {
			catItem = JSON.parse(sn_scoped_cache.ScopedCacheManager.get('public_cat_items', itemSysID));
		} else {
			catItem = $sp.getCatalogItem({
				sys_id: itemSysID,
				is_ordering: true
			});
			sn_scoped_cache.ScopedCacheManager.put('public_cat_items', itemSysID, JSON.stringify(catItem));
		}

		if (catItem) {
			data.cat_item.data.sc_cat_item = catItem;
		}
	}
})();

4.) You need to load the public page using an regular/admin user first (this makes the widget load the full catalog item variables + mrvs).

5.) Loading the widget as a "Guest" user will then show the catalog item (but again: the MRVS "Add Row" Popup will show an empty dialog....)

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Luke51 

try giving the variables within the MRVS the public role and check once

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi Ankur, thanks for replying but have tried that already. 
Set all variables to public, see below screenshot:
Variable Permissions.png

Markus Kraus
Kilo Sage

The closest I've got is displaying a MRVS, but unfortunately adding a new entry is not possible. Fixing this isn't possible in an OOTB way and as such I suggest you to instead give method a try:

0.) Read this post: https://www.servicenow.com/community/developer-articles/show-case-the-service-portal-experience-app-...

1.) Create two custom tables (one for the main form and one for the "MRVS" table) with proper ACLs

2.) Configure the Form of the custom table to your likings

3.) Add a new (custom!) relationship that will allow you to put the MRVS table on the main form as an "embedded list"

 

If you're interested in the "public MRVS display way":
1.) Create a new public page

2.) Create a new Scoped Cache named "public_cat_items"

3.) Add a new Widget Instance with the following widget:
HTML: 

<sp-widget widget="::data.cat_item" />

Server Script:

(function() {
	data.cat_item = $sp.getWidget("widget-sc-cat-item-v2");

	var itemSysID = $sp.getParameter("sys_id") + "";
	var guestCriterias = ["76f09af6cb1200108ad442fcf7076dbf"];
	var cGr = new GlideRecord('sc_cat_item_user_criteria_mtom');
	cGr.addQuery("sc_cat_item", itemSysID);
	cGr.addQuery("user_criteria", "IN", guestCriterias);
	cGr.setLimit(1);
	cGr.query();
	if (cGr.hasNext()) {
		var catItem = null;
		if (gs.getUser().getName() == "guest") {
			catItem = JSON.parse(sn_scoped_cache.ScopedCacheManager.get('public_cat_items', itemSysID));
		} else {
			catItem = $sp.getCatalogItem({
				sys_id: itemSysID,
				is_ordering: true
			});
			sn_scoped_cache.ScopedCacheManager.put('public_cat_items', itemSysID, JSON.stringify(catItem));
		}

		if (catItem) {
			data.cat_item.data.sc_cat_item = catItem;
		}
	}
})();

4.) You need to load the public page using an regular/admin user first (this makes the widget load the full catalog item variables + mrvs).

5.) Loading the widget as a "Guest" user will then show the catalog item (but again: the MRVS "Add Row" Popup will show an empty dialog....)