You need to sign in to do that
Don't have an account?
Rodrigo_Rocha
How to get the component (field) id within a standard lightning page?
I created a custom junction object (PS_Relationship__c) with 2 lookup fields (Advisor__c and Private_Staff__c) to the User object.
If I run a query, I'm able to get th advisors name related to a specific private staff like:
SELECT Advisor__r.Name FROM PS_Relationship__c WHERE Private_Staff__c != null
What I want is to create a component to list all the advisors the private staff is related to. So if I'm looking into a record within this custom object, for the private staff listed on the record, I want to be able to return all the other advisors related to the same Private Staff (Private_Staff__c) in the same page.
How do I get the field (component) ID for the private staff?
If I run a query, I'm able to get th advisors name related to a specific private staff like:
SELECT Advisor__r.Name FROM PS_Relationship__c WHERE Private_Staff__c != null
What I want is to create a component to list all the advisors the private staff is related to. So if I'm looking into a record within this custom object, for the private staff listed on the record, I want to be able to return all the other advisors related to the same Private Staff (Private_Staff__c) in the same page.
How do I get the field (component) ID for the private staff?
So I guess you want to create a custom lightning component to display the advisors, right ?
If so,use force:hasRecordId to automatically get the current user record id:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_interfaces_force_hasrecordid.htm
Then your apex should look like
Where as the recordId is a variable in the apex controller for this lightning component
The problem is: I need to pass to the recordId variable, the populated value for a custom field, and not the record id for a record within my custom object.
Does it make sense?
Thanks.
yes it does make sense.
If you use the force:hasRecordId attribute on your lightning component, the record id of the current record on that page layout is v.recordId
check it out here: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_interfaces_force_hasrecordid.htm