You need to sign in to do that
Don't have an account?
Tej
how to update a field in master object based on detail objects status.
i have a master detail realtionship between two objects,
is it posible to update a checkbox in master object if all the detail objects are in certain status???
Please help.
Yes, a cross object formula with a workflow assocaited to the results on the master.
PB
I do not believe that a cross object workflow will work in this case since you want to check ALL detail records. You may have to use a trigger.
Yea your right, I didnt think about the ALL statement,
PB
Account a = new Account(Name = 'Acme', Checkbox__c=true);
insert a;
// Inserting the record automatically assigns a
// value to its ID field
Contact c = new Contact(LastName = 'Weissman');
c.AccountId = a.Id;
// The new contact now points at the new account
insert c;
// A SOQL query accesses data for the inserted contact,
// including a populated c.account field
c = [SELECT Account.Name, Account.checkbox__c FROM Contact WHERE Id = :c.Id];
// Now fields in both records can be changed through the contact
c.Account.checkbox__c = false;
c.LastName = 'Roth';
// To update the database, the two types of records must be
// updated separately
update c;
// This only changes the contact's last name
update c.Account;
// This updates the account checkbox__c
Hope this Helps you. If I solved your issue, please mark it so.