• Meaghan
  • NEWBIE
  • 0 Points
  • Member since 2017
  • Salesforce Administrator
  • Ability Beyond

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
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;

}

}

Hi all - 
I am hoping you can help me modify a trigger - currently, it fires every time a record is updated, but we need to modify it to fire upon create only - thank you!! 
1trigger AssetTrigger on Asset (before insert, before update, before delete, after insert, after update, after delete) {
2        if(Trigger.isBefore) {
3            if(Trigger.isInsert && AssetTriggerHelper.firstRunBefore) {
4                AssetTriggerHelper.setAccountOnAsset(trigger.new);
5            }
6            if(Trigger.isUpdate) {
7                AssetTriggerHelper.setAccountOnAsset(trigger.new);
8            }
9            if(Trigger.isDelete) {
10                //do nothing for now
11            }
12            AssetTriggerHelper.firstRunBefore = false;
13        }
14        
15        if(Trigger.isAfter && AssetTriggerHelper.firstRunAfter) {
16            if(Trigger.isInsert) {
17                //do nothing for now
18            }
19            if(Trigger.isUpdate) {
20                //do nothing for now
21            }
22            if(Trigger.isDelete) {
23                //do nothing for now
24            }
25            AssetTriggerHelper.firstRunAfter = false;
26        }
27    }