You need to sign in to do that
Don't have an account?

Checking values of related list before changing status of contract
Hi All,
Can someone please shed some light on how to create a validation rule ( or alternative ) to check if values in a related list contain certain values before letting the contract status be changed to closed??
Eg, contract status cannot be changed to closed if values in the related list "parts to be supplied" still have values of "not supplied" next to them
Can someone please shed some light on how to create a validation rule ( or alternative ) to check if values in a related list contain certain values before letting the contract status be changed to closed??
Eg, contract status cannot be changed to closed if values in the related list "parts to be supplied" still have values of "not supplied" next to them
In validation rule you cant access the child object's field so you have to validate it into the trigger.
Like take your example :
You could create a rollup field of the parent record that does a count of the children with a filter criteria of "not supplied".
This will give you, at the parent record level, the number of child record that are set to "not supplied".
Your validation rule can check that the value of this rollup field is zero before progressing.
cheers,
Keith
Now the solution depends on what kind of a relationship the child entity (related list) has with the Contract object.
In case the current relationship is a Lookup then I strongly suggest you consider the option of converting it into a Master-Detail especially if you are not very hands-on with coding or do not have developers in your implementation/support team. The conversion would be pretty easy with the only exception of handling any child entity records which are not associated with a Contract - this too is not a very difficult data update exercise.
Again you will certainly need to weigh out how this change will impact if you plan to use this child entity in any future enhancements where it may be linked to another Parent.
Hope this helps you in making the decision a little easier.