Skip to main content
kali charan fragte in #Apex
Hi everyone,

    I have written the trigger .In that i have a list of contacts and in that i have number field amount.I have multiple amounts and ia want to find the least amount value and it a check box should be populated on tha account aobject.please suggest me in this scenario.

Thanks.

 
1 Antwort
  1. 12. Sept. 2016, 05:53
    Hi Charan,

    Use order by in SOQL query.

    select id,name,(select Id,name,Amount__C from contacts Order by Amount__c ASC) from Account

    The first element in the list have least amount value.

    Thanks.