1

I have two custom objects with master detail relationship.

My requirement is that the parent should be submitted for approval only after all its child records are submitted for approval.

For this, client has asked me to show the "Submit for approval" button in the Approval History related list only the above condition is satisfied.

I think the solution can be achieved through VF page by removing the "Submit for approval" button from the Approval History related list and showing it using the condition.

But my question is:- Is it possible to remove the "Submit for Approval" button from the Approval History related list?

Also, I should not hide the Approval history section(as a way to prevent the users from submitting for approval when criteria is not met) because users should be able to see the approval history.

3

You can't customise the buttons on the approval related list like you can for the others.

Aside from Visualforce, you might want to take a look at this post from Jason Venable (aka TehNrd) regarding showing/hiding buttons through javascript:

http://www.tehnrd.com/show-and-hide-buttons-on-page-layouts/

You could then have a roll up summary field on your master record that shows the number of child records that have not been submitted for approval, and your javascript can interrogate that value and hide the button accordingly.

There is an element of fragility about this, as you'd be relying on accessing fields/buttons by names that could conceivably change under you.

Another way to approach it may be to have the approval process entry criteria take into account the rollup summary field of child records not submitted for approval. While that wouldn't stop the button being displayed, it would stop the record entering the approval process.

  • Thanks for your reply. I am aware about the roll up summary field and approval process entry criteria. Now my requirement is to hide the button. I will try the solution you have given – Priyanka Oct 11 '12 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.