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
mavsmavs 

Trigger on Custom Object

Hi guys.....I am new to salesfore.plz let me know the solution.....thanking in advance for your replies
 
Here you go with my prob
 
I have created custom object called AbcClient_c under Standard Account object.
I have  2checkbox fields on the custom object called RC1 and RC2, and a lookup field where i can select an Account.
 
My problem is that.....while creating new record or editing a record,   
If i select RC1 then RC2 should automatically be selected and i should update two fields on the Standard Account object with "XYZ" value.
 
Can any one plz suggest which method is good to do this like trigger,Outbound messages or...........
 
if possible plz give me some idea....or solution.......
 
Waiting for the reply..............
 
Waiting for the reply.....................
 
Waiting for the reply..........
ChristineVWChristineVW
You can use a default value / workflow field update / field dependency to solve your checkbox issue on the Custom Object. 

You can use a trigger to update the fields on the Account when the checkboxes are clicked on the CO.  Here's a quick and incomplete sample:

Code:
// Create a list of Accounts to update
List<Account> accountList = new List<Account>();

for (Custom_Object__c co : Trigger.new) {

// If the CO has a check in the checkbox...
if (!co.Checkbox_Field__c.equals(null))
//Define the Account to update by looking up the Account record that is linked to the Custom Object
Account a = new Account(Id = co.Account__c);
// ... set the associated Account fields as appropriate
a.Custom_Field__c = 'XYZ';
//etc.
//Update the Account record identified two steps earlier
AccountList.add ( a );

}

 



Message Edited by ChristineVW on 06-11-2008 09:52 AM