Community User access to skuid.utils.decodeHTML (?)

  • 1
  • Question
  • Updated 2 years ago
I have a field render snippet that pushes in picklist values.  It is working fine, but doesn't work in my community.

I solved some previous community issues by cloning skuid VF pages - like for the ExportData function.

This makes me suspect that my community user may not have access to the skuid.utils.decodeHTML but I don't see a way to grant access (or confirm that they have access.)  I use that based on this thread:
https://community.skuid.com/skuid/topics/how_do_i_render_custom_picklist_values

Here's my snippet that works for internal users, including when logged into the community, but not for my community user profiles.

The users do have access to the contentTags model.  Are there any other places I should check for community access? We've been using Skuid pages in our community for a long time, so the basics work just fine.



var field = arguments[0],
value = skuid.utils.decodeHTML(arguments[1]),
$ = skuid.$;

var contentTagsMdl = skuid.model.getModel('contentTags');
var picklistEntries = field.metadata.picklistEntries;
picklistEntries.length = 0;

if (field.mode === 'edit') {
    var tagsForPicks = [];
   
    skuid.$.each(skuid.model.getModel('contentTags').getRows(), function(i,row) {
        tagsForPicks.push({
            active: true
            ,defaultValue: false
            ,label : row.contentTagc
            ,value : row.contentTagc
        });
    });

    var customMultiselect = skuid.ui.renderers.MULTIPICKLIST.edit({
            entries : tagsForPicks,
            required : false,
            value : value
        }).change(function(newValue) {
            var selectedOptions = '';
            for(i = 0; i < newValue.target.selectedOptions.length; i++) {
                selectedOptions += newValue.target.selectedOptions[i].value + ';';
            }

            //Update the row in the target object
            field.model.updateRow(field.row, 'contentTagc', selectedOptions);
        });
    //Append the MULTIPICKLIST to the DOM element
    field.element.append(customMultiselect);
} else {
    //If the mode is anything other than edit, display the field as Text
    var formattedValue = '';
    if(value !== null) {
        formattedValue = value.split(';').sort().join(', ');
    }
    skuid.ui.fieldRenderers.TEXT.read(field, formattedValue);
}
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Bump.  Anyone see any red flags that may cause this snippet not the run for a Community User?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Shot in the dark, but you may want to check which skuid permission sets, pages, and classes are assigned to your community user.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
also, when you use your page as the community user, can you access skuid.utils in the console?
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Yes, they are able to see skuid.utils in the console. Rats... it must be some other problem.  Thanks for the lead!

This profile is already using a skuidifid community, so the perm sets and permissions appear to be good.  I'll hunt around more in this snippet and on this custom object to see if I see anything further.

Page loads fine for the user, but the custom field render snippet just isn't pushing the values in.

Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
OK.... I've been playing around on a test page and have narrowed down the problem.

I can confirm:
community user can access the Salesforce CRM content objects (ContentVersion, ContentWorkspace, etc) and see records

community user can access my custom Content_Tags__c object, an object we built to re-build a ui for users to search for Content using tags and see records

The problem is when the user tries to access Content_Tags__c using an aggregate model.  Standard model... good.  Aggregate model... no records returned.  So, does anyone know if there is a permission to aggregate (in Salesforce) or something in Skuid to allow aggregate models for community users?  This would be my first aggregate community model.

Thanks!
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Further narrowed down... aggregate models themselves are not the problem, user can see another aggregate just fine.  There is a condition being passed to my aggregate from another model.  Turn off that condition, the user sees data.  But not with the condition on.  Not sure why, so still digging.