You need to sign in to do that
Don't have an account?
NANCY1
update master field based on all detail records?
Hi,
I have a master field that need to get updated based on all detail records.
In the detail records i have the status field, if for all the detail records value of the Status field is "Closed" then the master field value should also be closed.. (i.e. the value of the master field will be "closed" only if all detail records are "closed")
how can i achieve that...
You will need to use a trigger on the detail object whenever it is updated or inserted. Get the master record, then get all details for that master and update if necessary. Be careful to make sure your trigger is bulkified.
--Sarah
Follow these steps to achieve this with configuration but only if you have a Master-Detail relationship in your objects else you have to write a trigger only:
1. Create a Rollup field on Master object which COUNTS records macthing your given criteria i.e. where Status = Closed
2. Create a workflow on Master object that executes evrytime a records is created or edited and matches criteria i.e. Rollup field > 0
3. Create a field update that updates your field on Master object to Closed.
I'm not sure that you can fire a workflow off a Rollup Summary Field value changing.
I'd change step 2 to read
Create a Workflow on the Detail object that executes every time a records is created or edited and matches criteria i.e. Master.Rollup field > 0
Cross Object Workflows can fire off the Detail and Update Master.
Ritesh,
I tried those steps and those are working , you can fire a workflow on a Rolup summary field. Having a workflow on master works.