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

Trigger task before insert
Hi All, new to Salesforce Development
I'm trying to create an Apex Trigger in Task(Activity)/Event object.
1) Check a field in Account (Number Field A__c) if more than 100
2) Check a field in Account (Number Field B__c) if more than 50
Basically I have criteria above if not pass, prompt error message to users upon saving their Task/Event record.
I'm trying to create an Apex Trigger in Task(Activity)/Event object.
1) Check a field in Account (Number Field A__c) if more than 100
2) Check a field in Account (Number Field B__c) if more than 50
Basically I have criteria above if not pass, prompt error message to users upon saving their Task/Event record.
Thank you.
All Answers
https://developer.salesforce.com/forums/?id=906F00000008zcBIAQ this might help for the add error.
Thanks!
I have this code:
Apparently, even the criteria are met, I'm able to create the task.
Also I did try to pull the information using formula field in Task and upate the code with this, still unable to pass:
if (t.A__c >= 100 && t.B__c <= 50)
https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices
-Lokesh
In the Apex Trigger details, it shows: Status - Active.
Hi,
On Task and events we can not reference cross objects in validation rules:
Please find the link below for the article on Idea exchange:
https://success.salesforce.com/ideaView?id=08730000000JFgE
and for workaround, please use below article:
https://success.salesforce.com/answers?id=90630000000CorrAAC
Thanks
Deepak
dpkm20@gmail.com
I'm aware on the limitation using validation rule on this. My validation rule will only run upon saving the Task/Event record.
Seeking help to complete my Apex Code above, having hard time to make it run :(
Thank you.