function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MeaghanMeaghan 

Unexpected Token Error on Apex Trigger

Hi All - 

I am hoping you can help. The trigger below is supposed to add a custom URL to our Case object after a Case record is created. I am receving an error that says "Unexepected Token: Update" for the last line: "update newlyInsertedItems;" 

The error is showing up twice: 

Unexpected Token Update: Update on Line 17
I also need any help that anyone could offer to create a test class for this - thank you all so much in advance!



trigger Case_Approved_List_URL on Case (after insert) {
    //
if  (trigger.isAfter  &&  trigger.isInsert) {

  List<Case>  newlyInsertedItems =  [SELECT  Id ,  Approved_List_Form_URL__c  FROM  Case  WHERE  Id  IN :trigger.new] ;

  List<string> ids = new List<string>();

for ( Case  e  : newlyInsertedItems) { 

  ids.add(e.id);

  }

 VisualAntidote.FastFormsUtilities.DoUpdateRecords ( 'Case' ,  'Approved_List_Form_URL__c' ,  '134562356426212345' ,  [//mycompany.secure.force.com] );

update newlyInsertedItems;

}

}
Abhishek BansalAbhishek Bansal
Hi Meaghan,

What is the data type for the last parameter that you are passing in the method above the update statement?
If this is of String type than it should be enclosed in inverted commas like other parameters and if this is a list than it should be added in a list and than passed to the method.
Please correct that.

Thanks,
Abhishek Bansal