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
Dafina BojaDafina Boja 

Lock the contact if the order is approved

I have Orders and Contacts, and is it possible when an order is approved to lock the contact until the event is over.
Abdul KhatriAbdul Khatri
Hi Dafina,

Please elaborate what you mean lock the contact until event is over.
Dafina BojaDafina Boja
Hi Abdul , 

When an order is approved i need automatically the Contact to put in do not contact for example for 5 days or 8 days
AbhishekAbhishek (Salesforce Developers) 

The below blog have a working example for your scenario try it,

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Dafina BojaDafina Boja
Hi there, 

That didnt helped me , cause i have different objects , Contacts and Orders.

When an order is approved , i want to lock the contact for example for 3 or 4 days or 1 week.

Abdul KhatriAbdul Khatri
Hi Dafina,

Considering you are using Out of Box Order SObject, where you may be using Status field for Approval.

When you say you want to lock the contact record for 3 to 4 days or 1 week, my presumption is from some date on the Order  Sobject or it is until the event is over. How the event and approval duration are related, can you explain please.

Keeping the perspective you are using Out of Box Order SObject, you may be using either BilltoContact or ShiptoContact Id.

Please take a look at the below Approval Class that will help you to lock the Contact either single record or multiple (Bulkify).

Once you provide some details and if you need further assistance with the code please let us know Thanks.
Abdul KhatriAbdul Khatri
Hi Dafina, 

Was that helpful?