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
Chris Jones 18Chris Jones 18 

Ensuring Contract Owner Can't Send Email To Contact Until Contract Fully Approved

Hi,

I am very much a newbie, so apologies if this is an extremely basic question.  I've put it in Apex Code Development because I suspect that the answer lies there but please feel free to move it if required.

We have set up a Contract process to manage our marketing expenditures and, following final approval, the contract owner should send an email, using a pre-determined template, to their contact to confirm the particulars of the contract.  Unfortunately, the contract owner COULD send the confirmation at any time (but we have told them not to do so).  Once final approval has been achieved, the contract status is set to "Terms Sheet Needed".

How do I:

(a) Ensure that it is impossible the email template ("MDF International Contract") until the status is set to "Terms Sheet Needed"
(b) Set the status automatically to "Fully Executed" once the email template has been successfully sent.

All help gratefully accepted!
 
Saikishore Reddy AengareddySaikishore Reddy Aengareddy
Assuming you are using standard send email functionality. If yes, create a new custom "Send Email" button and remove the standard send email button from the layout. Perform JS validation in the custom button code and once validated mimic the functionality of send email(URL hack of standard send email). For every send email there would be an activity created for the related record so write a trigger and update the status.