Activity Forums Salesforce® Discussions Related list

  • Posted by Meddimala Ranjith on April 23, 2018 at 6:40 am

    If the account has related list Address and there is checkbox name primary, then record insert in Address then each account has only one address with checkbox true if records exist already in an address with checkbox true then make them false.

     

    Manpreet replied 6 years, 7 months ago 2 Members · 1 Reply
  • 1 Reply
  • Manpreet

    Member
    April 25, 2018 at 10:22 am

    Hi Ranjith,
    You need to use inner sub Query and perform your custom logic as per your requirement something like this :
    for(Account acc : [SELECT Id, primary__c, (SELECT Id FROM Address__r ) FROM Account]){

    if((acc.primary__c == TRUE) && (acc.Address__r.size() > 0)){
    acc.primary__c == FALSE;
    }

    //Your custom logic
    }

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos