Skip to main content
kali charan 提问于 #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 个回答
  1. 2016年9月12日 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.