1

I created a custom quick action lightning component. This component contains a form with a lookup field to an Opportunity (see simplified code below).

<aura:attribute name="config" type="DTOConfig" />
<aura:attribute name="project" type="Project__c"
                    default="{ 'sobjectType' : 'Project__c' }" />

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

.
.

   <force:inputField class="slds-input" aura:id="opportunityLookup" value="{!v.project.Opportunity__c}" />

Whenever a platform user clicks on the button, they get error message:

aura://ComponentController: org.auraframework.throwable.AuraExecutionException: ui.force.components.controllers.field.InputFieldProvider: org.auraframework.throwable.AuraRuntimeException: markup://force:inputField: cannot find field: v.project.Opportunity__c.

I am looking for a solution to display a user friendly error message [for platform users] saying that they 'cannot use this feature'.

in {!c.doInit}, I call a function that sets the config attribute with an apex class with variables. One of them:

boolean userHasAccessToOpp;

I have tried:

  1. surrounding the force:input field as following:
<aura:renderIf isTrue={!v.config.userHasAccessToOpp}> 
    <force:inputField class="slds-input" aura:id="opportunityLookup" value="{!v.project.Opportunity__c}" />
</aura:renderIf>

however the same error is still thrown.

  1. using <aura:if isTrue={!v.config.userHasAccessToOpp}> tags:

this works, the form is able to load, however the <force:inputField> does not render. It is only the <force:inputField> that is not rendering as other fields within the <aura:if> still render properly.

I was wondering if anyone had any solution(s) that could work. I need to prevent this field from being bound to project.opportunity__c if the user has a Platform License. The force:inputField has been proving to be very problematic and is causing many problems.

A possible idea i had was to rerender the form [or field] after init (possibly using renderer.js), but I am unsure if this is possible or where to start.

As a fallback, if I cannot find a solution I will have to create new page layouts for platform users that do not display the quick action button. This is NOT an ideal solution because we have multiple record types for this project__c object and I would have to clone all of the page layouts for each record type and maintain them.

Your Answer

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

Browse other questions tagged or ask your own question.