• vishnu sundar
  • NEWBIE
  • 0 Points
  • Member since 2017


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have custom object called RoleLevel__c . Supervisor__c is self lookup in RoleLevel__c. My requirement is to get the Top record in RoleLevel__c. for Example,

I am having records as below R1->R2->R3->R4->R5->R6->R7->R7->R8->R9->R10->R11

R11(record) have Supervisor__c lookup to R10(record), R10(record) have Supervisor__c lookup to R9(record) like wise it goes

we have another field names TopRole__C which would be updated by before trigger based on the Supervisor__c it gets the next record until Supervisor__c become null ... currently we are achieving this functionality by SOQL inside while loop to get toprecord . Any possibility to get the Top record without multiple SOQL ?
Iterating something like Supervisor__r.Supervisor__r.Supervisor__r.id did not work after 5 levels. R1 , R2 names are used for example .
I have a salesforce account - daniel.wymer@teradata.com - and get into endless loop and cannot reach Trailhead.  It seems like I have a Salesforce account, have established a password, but cannot login to Trailhead.