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
nmnbawanmnbawa 

Restrict activity creation?

I have a picklist on account object called "Status"and one of the values is "Duplicate"

I want to prevent the users from creating any tasks/events against an account when the status is duplicate.


Any ideas how to achieve it.


I cannot create a validation rule on the Activity object as it does not allow to reference custom account fields.

hitesh90hitesh90

Hi,

 

You have to write trigger on Task and Event both object on before insert and put trigger.addError whenever Account.status = "Duplicate".

 

Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thanks,
Hitesh Patel
SFDC Certified Developer & Administrator