You need to sign in to do that
Don't have an account?
Rick Culbreth
How to find the related Account Owner information in Lightning Component
I have a lightning Component on an object related to account. I am trying to get the account owner information to take different action based off owner. I have tried several things but they all come back as undefined. the lookup field on the custom object to account is called Practice_Provider. Just wondering what the correct path, I can use ID or Name to do what I need.
Some of the code I have tried, all say undefined:
Window.alert('Account 1 Ownerid ' + component.get('v.sObjectInfo.Practice_Provider__r.OwnerId'))
window.alert('Account 2 Owner.Id ' + component.get('v.sObjectInfo.Account.Owner.Id'))
window.alert('Account 3 Owner.Id ' + component.get('v.sObjectInfo.Practice_Provider__r.Owner.Id'))
window.alert('Account 3 Owner.Id ' + component.get('v.sObjectInfo.Account.OwnerId'))
window.alert('Sobject OwnerId ' + component.get('v.sObjectInfo.ownerId'))
window.alert('Sobject OwnerId ' + component.get('v.sObjectInfo.OwnerId'))
window.alert('Account Owner Name ' + component.get('v.sObjectInfo.Practive_Provider__r.Owner.Name') )
if (''+component.get('v.sObjectInfo.Account.Business_Partner_Identifier_Code__c')+'' == 'FL') ----- This part works it returns value in Account Field.
Some of the code I have tried, all say undefined:
Window.alert('Account 1 Ownerid ' + component.get('v.sObjectInfo.Practice_Provider__r.OwnerId'))
window.alert('Account 2 Owner.Id ' + component.get('v.sObjectInfo.Account.Owner.Id'))
window.alert('Account 3 Owner.Id ' + component.get('v.sObjectInfo.Practice_Provider__r.Owner.Id'))
window.alert('Account 3 Owner.Id ' + component.get('v.sObjectInfo.Account.OwnerId'))
window.alert('Sobject OwnerId ' + component.get('v.sObjectInfo.ownerId'))
window.alert('Sobject OwnerId ' + component.get('v.sObjectInfo.OwnerId'))
window.alert('Account Owner Name ' + component.get('v.sObjectInfo.Practive_Provider__r.Owner.Name') )
if (''+component.get('v.sObjectInfo.Account.Business_Partner_Identifier_Code__c')+'' == 'FL') ----- This part works it returns value in Account Field.
That could be interesting to display the complet object in the console.
If you never read the field, you could never work with any try.
The content depends on the controller (apex) or a Lightning Data Service.
Without the component and the controllers (js / apex), it is impossible to verify the code
You have used one of these techniques:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/data_service_load_record.htm
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_actions_call.htm