0

I'm trying to write a trigger to populate information from a child record into the parent, and receiving the following error on line 13 unexpected token: 'Trigger'

trigger UpdateQuoteSOW on Statement_of_Work__c (after insert, after update) {

    Map<ID, SBQQ__Quote__c> parentQuote = new Map<ID, SBQQ__Quote__c>();
    List<Id> listIds = new List<Id>();

    for (Statement_of_Work__c childObj : Trigger.new) {
        listIds.add(childObj.Quote__c);
    }


    parentQuote = new Map<Id, SBQQ__Quote__c>([SELECT id, (SELECT ID, Background_Introduction__c FROM Statements_of_Work__r) FROM SBQQ__Quote__c WHERE ID IN :listIds]);

    for (Statement_of_Work__c SOW: Trigger:new){
        SBQQ__Quote__c myParentQuote = parentQuote.get(SOW.Quote__c);
        myParentQuote.Background_Introduction__c = SOW.Background_Introduction__c;
    }

    update parentQuote.values();
}

What I'm trying to do is copy rich Text information (Background_Introduction__c) into another rich text field (Background_Introduction__c) and keep all formatting and images as I can't do this with declarative functionality.

Any help would be much appreciated Thank you!

1
  • Trigger.new not trigger:new, typos happen =P – glls Aug 18 '17 at 20:03
4

I think the error message is pretty straightforward and even tells you the line number.

most likely a typo on your part.

for (Statement_of_Work__c SOW: Trigger:new)

should be Trigger.new

1
  • no worries, welcome to SFSE by the way ;) – glls Aug 18 '17 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.