You need to sign in to do that
Don't have an account?
Vikas U Mishra
Not able to set value for force:inputfield which is standard account lookup field on Opportunity Object
We are setting value force:inputField for Account Lookup field on Opportunity object for Lightning Component.
component.set("v.newOpportunity.AccountId", accountDetailsId);
// we need this for the actual 'pill' in the lookup field
var values = [{
type: 'Account',
id: accountDetailsId,
label: component.get('v.account.Name'),
icon : {
url:'/img/icon/t4v35/standard/account_120.png',
backgroundColor:'A094ED',
alt:'Account'
}
}];
component.find("accountName").get("v.body")[0].set("v.values", values);
Do we have any other workaround for this?
Even after setting value, I am getting undefined for following code.
component.find("accountName").get("v.body")[0].get("v.values")
Component side code:
<div class="slds-form-element">
<label class="slds-form-element__label"
for="accountName">Account Name: </label>
<div class="slds-form-element__control">
<force:inputField aura:id="accountName" value="{!v.newOpportunity.AccountId}" required="true"/>
</div>
</div>
component.set("v.newOpportunity.AccountId", accountDetailsId);
// we need this for the actual 'pill' in the lookup field
var values = [{
type: 'Account',
id: accountDetailsId,
label: component.get('v.account.Name'),
icon : {
url:'/img/icon/t4v35/standard/account_120.png',
backgroundColor:'A094ED',
alt:'Account'
}
}];
component.find("accountName").get("v.body")[0].set("v.values", values);
Do we have any other workaround for this?
Even after setting value, I am getting undefined for following code.
component.find("accountName").get("v.body")[0].get("v.values")
Component side code:
<div class="slds-form-element">
<label class="slds-form-element__label"
for="accountName">Account Name: </label>
<div class="slds-form-element__control">
<force:inputField aura:id="accountName" value="{!v.newOpportunity.AccountId}" required="true"/>
</div>
</div>