You need to sign in to do that
Don't have an account?
Need to pass record ID to class related to Lightning Component for .csv download
I've been working with the compent offered on this site:
https://sfdcmonkey.com/2017/04/19/download-csv-file-data-salesforce-lightning-component/
It's working perfectly, but one thing I missed is that it seems to pull all user records in my org, but really I just want to see those that are related to the Programming__c record where the button is clicked.
Is there a way to achieve this in my class?
https://sfdcmonkey.com/2017/04/19/download-csv-file-data-salesforce-lightning-component/
It's working perfectly, but one thing I missed is that it seems to pull all user records in my org, but really I just want to see those that are related to the Programming__c record where the button is clicked.
Is there a way to achieve this in my class?
public class User_List { @AuraEnabled public static list <User_List__c> fetchList(){ List <User_List__c> returnUserList = new List < User_List__c > (); for(User_List__c ul: [SELECT id, First_Name__c, Last_Name__c, Email__c, Extension_Number__c, Type_of_User_License__c, Phone_Model__c, Language__c, Outbound_Number_Display__c, Outbound_Name_Display__c, Voicemail_Option__c, CFNR_Number__c From User_List__c LIMIT 1000]) { returnUserList.add(ul); } return returnUserList; } }
How are Programming__c and User_List__c associated with each other? If the button is placed on the Programming__c object record page, then you need to implement the force:hasRecordId interface in your aura component. By implementing this interface, you will get the record if of programming record in your aura component by using component.get("v.recordId"). You can then pass this recordId to your apex controller and use the recordId in the WHERE clause of the SOQL to filter the records. Please let me know if you have any questions.
Thanks,
Ravi
Thanks for your response! You assumed correctly. The button is on Programming and the User List is a related list. They are linked by Lookup fields...they are not Master/Detail.
I'm still a little stuck...here's what I have so far....
I added the recordID attribute to my component: I then added the compenent.get to my controller:
Do I need to add anything to my helper? Like should I also be adding "component.set" for the programming?
Finally, I'm not sure how to phrase my WHERE statement in my class. I thought I would say WHERE the lookup fields matches my variable, but I get errors so I'm assuming I misunderstand.
Any additional help would be appreciated!!