1

I have a page which displays the product family picklist.

However, the picklist is not visible if I open the page from my site. I have given access to fields on Public Access settings but still its not visible.

  • Check if the site user has edit level permission on product object as well, is it problem for one or other fields as well? – Raul Jan 4 at 12:38
  • @Raul Yes I have permission to all fields for read and edit. Its not working for other fields also. – Srujan Jan 4 at 13:06
2

Edit access to Product2 object, regardless of how you establish FLS on individual fields is not possible by default for the Sites guest user when you look at Public Access CRUD Settings for standard objects.

But there is a workaround:

Use the guidelines in this SFSE post on access to standard objects using Sites guest user

Update

To display the product family picklist, do something like this:

public String selectedFamily {get; set;}
public SelectOption[] availableFamilies {
   get {
    if (availableFamilies == null) {
      availableFamilies = Util.getPickListVF(Product2.Family);
    }
    return availableFamilies;
   } private set;
}

where the Util method looks like:

public static List<SelectOption> getPickListVF(SObjectField fieldname ) {
        SelectOption[] res = new List<SelectOption> ();
        for (Schema.PickListEntry ple: getPickListEntries(fieldname))
            res.add(new SelectOption(ple.getLabel(),ple.getValue()));
        return res; 
    }
private static List<Schema.PickListEntry> getPickListEntries(SObjectField fieldname) {
    return fieldName.getDescribe().getPickListValues();
}

and use VF markup for apex:selectList as you see fit on the page

  • Hi, I only want to show the product family picklist on site. I'm dont do any update on product object. – Srujan Jan 5 at 4:08
  • @Srujan - I updated my answer – cropredy Jan 6 at 2:51
  • Hi, Thanks for response but I too got this idea, the reason why I didnt implemented this is the page needs to be Bilingual, It is for both English and French, So if I use standard inputField that values are displayed based on the language parameter I pass to the apex page tag ? Is it possible to get the Translated values from fieldName.getDescribe().getPickListValues() ? – Srujan Jan 7 at 10:29
  • @srujan you should ask a separate question on how to get translated vals from pick list via apex – cropredy Jan 7 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.