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
SFDummySFDummy 

Iterate through Account Contacts

Hello,
My user wants an Icon on Contact page to go to Next Contact (">>") related to the account.
Here is my scenario.
Account has upto 15 contact. User need to make changes to the all 15 contacts. 
Open contact from related list make changes and save
Click on "some Icon" to get to next contact of the account ( how can I do this)
Save and click on "some Icon" to go to next contact

I can write code if you can give me suggestions on how to do this.
Appreciate any suggestions
Gaurav NirwalGaurav Nirwal
Use this query

SELECT Account.Id, Account.Name, (SELECT Id, Name, Clients_Connected__c FROM Organisation_Stats__r S WHERE S.Clients_Connected__c > 3) Stats FROM Account

And try this code
public PageReference InvokeAsmxServiceV2() {    

  List<Account> queryResults = [SELECT Account.Id, Account.Name, (SELECT Id, Name, Clients_Connected__c FROM Organisation_Stats__r S WHERE S.Clients_Connected__c > 3) Stats FROM Account];

  for (Account o : queryResults) {

    /* Code for account omitted */

    for (Organisation_Stat__c s : o.Stats) {

      /* code for dealing with child org stat object omitted */
    }
  }

  return null;
}

Please select as best answer