function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Christos KolonisChristos Kolonis 

How to retrieve the Account id

I need to retrieve the Account id and insert it to my method. Get the Basket__r.Account__r.id and place it to the Account id inside the for loop. How can i do that?
 
list<Configuration__c> conf = [select id, name, Basket__r.id, Basket__r.Account__r.id  from Configuration__c where Basket__r.id = : basketId];
    
    
    for (Configuration__c confList: conf){
    
    Attachment att = [select id, body from Attachment where name like parentId = :confList.id];
    system.debug(att);
    system.debug(att.Body);
    system.debug(att.Body.toString()); 
    list <Guarantee_Line__c> guara = new list <Guarantee_Line__c>();
    
    guara = GuaranteeCreator.createGuarantee(att.Body.toString(), confList, Account id);
    }

 
Best Answer chosen by Christos Kolonis
RituSharmaRituSharma
You may get account id by using below syntax:

confList.Basket__r.Account__r.id

All Answers

RituSharmaRituSharma
You may get account id by using below syntax:

confList.Basket__r.Account__r.id
This was selected as the best answer
Christos KolonisChristos Kolonis
I did this but i get an error of incorrect signature. My method:
 
public static list <Guarantee_Line__c> createGuarantee(String jsonStr, Configuration__c pConf, Account acc){

 
RituSharmaRituSharma
As per signature, you are passing handle of account as the last parameter. So pass confList.Basket__r.Account__r.
Christos KolonisChristos Kolonis
Thank you for your responses! I resolved it!