You need to sign in to do that
Don't have an account?
betterbhushan
Error: Compile Error: unexpected token: 'trigger' at line 1 column 0 while creating trigger
I am trying to create trigger but getting..
Error: Compile Error: unexpected token: 'trigger' at line 1 column 0
the code:
trigger keywordAccountUpdate on KeywordAccountAssociation__c (after insert, after update){ set<id> = new set<id>(); for (KeywordAccountAssociation__c a : Trigger.new) accountIds.put(a.Account__c); map<id,Account> accountMap = new map<id,Account>([select id, DD_Segment__c from Account where id in :accountIds]); for (KeywordAccountAssociation__c kaa : Trigger.new){ if (AccountMap.containskey(kaa.Account__c)){ Account thisAccount = AccountMap.get(kaa.Account__c); String s = thisAccount.DD_Segment__c + ';new value'; // Always add value if ((thisAccount.DD_Segment__c).contains('second value') s += ';second value'; AccountsToUpdate.add(new Account(id=thisAccount.id, DD_Segment__c = s)); } } }
Did you create this via the trigger dropdown in the IDE or the triggers page on the UI? I'm wondering if you might have created an apex class and then tried to populate it with a trigger?