You need to sign in to do that
Don't have an account?
Alfredo Ornelas
Trigger is showing an error after update
This is my FIRST trigger.
I want to create an "Event" after "Time Off Request" is Approved.
After approving, the following error message is showing...
Here is my trigger:
trigger TRTimeOffAfterUpdate on Time_Off_Request__c (after update) {
for (Time_Off_Request__c toEvent : Trigger.new) {
if(toEvent.Status__c=='Approved'){
// Event event = new Event
Event ev= new Event
(
OwnerId = toEvent.CreatedById,
StartDateTime = toEvent.First_Day_Off__c,
EndDateTime = toEvent.End_Time_Off__c,
Subject = toEvent.Type__c,
Description = toEvent.Comments__c,
ShowAs = 'Out of Office'
);
insert ev ;
}
}
}
Any idea what is wrong?
Thanks
I want to create an "Event" after "Time Off Request" is Approved.
After approving, the following error message is showing...
Here is my trigger:
trigger TRTimeOffAfterUpdate on Time_Off_Request__c (after update) {
for (Time_Off_Request__c toEvent : Trigger.new) {
if(toEvent.Status__c=='Approved'){
// Event event = new Event
Event ev= new Event
(
OwnerId = toEvent.CreatedById,
StartDateTime = toEvent.First_Day_Off__c,
EndDateTime = toEvent.End_Time_Off__c,
Subject = toEvent.Type__c,
Description = toEvent.Comments__c,
ShowAs = 'Out of Office'
);
insert ev ;
}
}
}
Any idea what is wrong?
Thanks
Greetings to you!
This error occurs when the picklist field mentioned in the error message meets the following conditions:
Please refer to below knowledge article for more information:
https://help.salesforce.com/articleView?id=000320321&type=1&mode=1 (https://help.salesforce.com/articleView?id=000320321&type=1&mode=1)
Please refer to the below links which might help you further with the above issue.
https://salesforce.stackexchange.com/questions/150504/picklist-value-not-recognized-in-the-test
https://salesforce.stackexchange.com/questions/229088/restricted-picklist-issue-even-providing-correct-value
https://success.salesforce.com/answers?id=9063A000000lCxhQAE
I hope it helps you.
Kindly 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. It will help to keep this community clean.
Thanks and Regards,
Khan Anas