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
renurenu 

Update problem

Hello friends
 
I have a very urgent requirement. Plz help me with an idea....
 
Under a standard Account object i have a custom object called ABC.
 
I need to loop through all the custom objects(ABC) including the one i created now(if i am inserting a new record) and check
weather the field on custom object(ABC) called Provider is true.
 
if it is true then i need to update Status field on Account object with a value "XYZ".
 
My idea is, to execute a trigger on the save button of the custom object(ABC).
 
Plz friends suggest me a solution (how to check provider value in all custom objects) as this is a very immediate requirement............... Thank you
 
renurenu

Hello did any one know the solution.... I would appriciate all the suggestions. plz reply with a solution.....Thanks

I tried the following way.

trigger xyz on ABC__C(after update) {
if(trigger.isupdate)
{
List<Account> acctList = new List<Account>();
 for( ABC__C o: Trigger.new)
 {
ABC__C[] a=[select Id,Provider__c from ABC__C where Accounting_id__c=:o.Accounting_id__c ];

for(ABC__C b:a)

{
if(b.Provider__c==true)
{
      Account ac = [select Id from Account where Id= o.Accounting_id__c];
      ac.Status__c='XYZ';
acctList.add(ac);
     
    }

update acctList ;
}}
}
}





Message Edited by renu on 06-17-2008 04:31 PM

Message Edited by renu on 06-17-2008 05:38 PM