Skip to main content
deleted 5 characters in body
Source Link
Eric
  • 54.4k
  • 11
  • 104
  • 196

The field accessibility will show access to the fields assuming they profile has access to the object.

Ensure the profile has edit or create access to the PriceBookEntryPriceBook object and at least read on the product since you are coming from the object pricebookentry in your class

Here is an example for you:

  1. Profile: PriceBook (Read)
  2. Profile: Product (Read)

Apex Class

public class productTestController{

    public PriceBookEntry pbe {get;set;}
    public Opportunity opp {get;set;}
    public productTestController(){
        pbe = New PriceBookEntry();
        opp = New Opportunity();
    }

}

Visualforce Page

<apex:page Controller="productTestController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:inputField value="{!Opp.AccountId}" label="Account"/>
                <apex:inputField value="{!pbe.Product2Id}" label="Product"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Result

enter image description here

Now, Update the profile to provide create or edit (whichever you choose) access to the Price Book object

Result

enter image description here

The field accessibility will show access to the fields assuming they profile has access to the object.

Ensure the profile has edit or create access to the PriceBookEntry object and at least read on the product since you are coming from the pricebookentry

The field accessibility will show access to the fields assuming they profile has access to the object.

Ensure the profile has edit or create access to the PriceBook object and at least read on the product since you are coming from the object pricebookentry in your class

Here is an example for you:

  1. Profile: PriceBook (Read)
  2. Profile: Product (Read)

Apex Class

public class productTestController{

    public PriceBookEntry pbe {get;set;}
    public Opportunity opp {get;set;}
    public productTestController(){
        pbe = New PriceBookEntry();
        opp = New Opportunity();
    }

}

Visualforce Page

<apex:page Controller="productTestController">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:inputField value="{!Opp.AccountId}" label="Account"/>
                <apex:inputField value="{!pbe.Product2Id}" label="Product"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Result

enter image description here

Now, Update the profile to provide create or edit (whichever you choose) access to the Price Book object

Result

enter image description here

added 56 characters in body
Source Link
Eric
  • 54.4k
  • 11
  • 104
  • 196

The field accessibility will show access to the fields assuming they profile has access to the object.

Ensure the profile has edit or create access to the productsPriceBookEntry object and at least read on the product since you are coming from the pricebookentry

The field accessibility will show access to the fields assuming they profile has access to the object.

Ensure the profile has access to the products object

The field accessibility will show access to the fields assuming they profile has access to the object.

Ensure the profile has edit or create access to the PriceBookEntry object and at least read on the product since you are coming from the pricebookentry

Source Link
Eric
  • 54.4k
  • 11
  • 104
  • 196

The field accessibility will show access to the fields assuming they profile has access to the object.

Ensure the profile has access to the products object