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
bheemudu neelibheemudu neeli 

How to pass the Auto Number field on MAX aggregate to fetch the latest Transaction

Hi All,
How to pass the Auto_Number field on MAX aggregate to fetch the latest Transaction, hence by passing ID we are not getting latest Transaction, so, I'm trying with MAX(auto_num) as name of transaction, while trying this getting error on AfterUpdate trigger Issues.
please help me on how to convert Auto_Num to ID.

here is the logic..................

AggregateResult[] aggtransold = [SELECT MAX(Id) newestTransactionOnBond
                                         FROM Transaction__c
                                         WHERE Bond_ID__c IN :bondids
                                         AND Issued__c = true
                                         GROUP BY Bond_ID__c];
        for (AggregateResult agg : aggtransold) {
            System.debug('BTH: CloneTransactionSchedules: OLD TRANSACTION ' + agg.get('newestTransactionOnBond'));

With Regards,