Created
December 15, 2015 20:33
-
-
Save cdeckert/311b10e49d2ddb11d5ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger onActivity on Event (before insert, before update) | |
{ | |
List<Antrag__c> antraege = new List<Antrag__c>(); | |
for(Event e : trigger.new) | |
{ | |
if(e.Abwesenheitsart__c == 'Krankheit' || e.Abwesenheitsart__c == 'Urlaub') | |
{ | |
if(e.WhatId == null) | |
{ | |
Antrag__c newAntrag = new Antrag__c(); | |
newAntrag.Name = 'Galina'; | |
//newAntrag.von__c = e.StartDateTime; | |
//newAntrag.bis__c = e.EndDateTime; | |
insert newAntrag; | |
e.WhatId = newAntrag.id; | |
} | |
else | |
{ | |
Antrag__c newAntrag = new Antrag__c(id = newAntrag.WhatId); | |
newAntrag.Name = 'Galina'; | |
//newAntrag.von__c = e.StartDateTime; | |
//newAntrag.bis__c = e.EndDateTime; | |
update newAntrag; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment