1

How do i fix access Check issue? as per the documentation i have to perform isAccessable() check as well as component should have global access which i did. still doesn't work. Can you guys help me in fixing this issue.

my component

<aura:component controller="leadController" implements="force:lightningQuickAction,force:hasRecordId" access="global">
   <aura:handler name="init" value="{!this}" action="{!c.init}"/>
    <aura:attribute name="lead"  type="Lead" default="{ sobjectType: 'Lead'}"/>

    <aura:attribute name="ownervalue" type="String" />
    <label class="slds-form-element__label" for="select-01">
    <abbr class="slds-required" title="required">*</abbr>Change Lead Owner</label>
    <br/>
        <force:inputField value="{!v.lead.OwnerId}"/>
    <br/>
        <label class="slds-form-element__label" for="select-01">
        <abbr class="slds-required" title="required">*</abbr>Not My Lead Options</label>
    <br/>
        <!--Update this section when picklist values issue fixed by salesforce -->
        <div class="slds-form-element__control">
            <div class="slds-select_container">
             <select id="selid" class="slds-select" value="{!v.lead.pickvalues__c}" >
                <option value="-- None --">-- None --</option>  
                <option value="pickvalue1">pickvalue1</option>
                <option value="pickvalue2">pickvalue2</option>
              </select>
            </div> 
        </div>
    <br/>
        <label class="slds-form-element__label" for="select-01">
        <abbr class="slds-required" title="required">*</abbr>Not My Lead Comments</label>
    <br/>
        <force:inputField value="{!v.lead.Awesome_Comments__c}"/> 

    <br/>
    <button class="slds-button slds-button--neutral">Cancel</button>
      <button class="slds-button slds-button--brand" press="{!c.saveLeadjs}">Save</button>
</aura:component>

my controllerjs

({
    init : function(component, event, helper) {
        var ldid = component.get("v.recordId");
        console.log("init");

            var action = component.get("c.getLead");
            action.setParams({
               "leadid": ldid
            });
            action.setCallback(this, function(response){
                var state = response.getState();
                var toast = $A.get("e.force:showToast");
                if(component.isValid() && state ==="SUCCESS"){
                    component.set("v.lead", response.getReturnValue());
                    console.log("Component loaded successfully!");
                    if (toast){
                    //fire the toast event in Salesforce1
                    toast.setParams({
                        "title": "Success!",
                        "message": "The component loaded successfully."
                    });
                    toast.fire();
                    }
                } else {
                    console.log("we have an error");
                }
                console.log(response.getReturnValue());
            });
          $A.enqueueAction(action);
    },
})

my apex controller

    @AuraEnabled
    public static Lead getLead(id leadid){
    string ld = leadid;
    Lead s = new Lead();
    if (Schema.sObjectType.Lead.fields.OwnerId.isAccessible()) {
        s = [SELECT Name,Street,Phone, OwnerId, Industry FROM Lead where id =: ld ];  
}else {
     s = [SELECT Name,Street,Phone, OwnerId, Industry FROM Lead where id =: ld ];
    }
    upsert s;
    return s;
    }

and error logs from console as well as uienter image description here enter image description here

thank you for your time :)

1

Please find the below link, it might be useful

https://success.salesforce.com/issues_view?id=a1p3A000000eaxfQAA

  • thank you @Raj_SFDC that was the exact issue i was facing, guess i need sharpen my searching skills. – naruto-sfdc Oct 28 '16 at 21:35

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