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
NajoopNajoop 

Apex trigger to update case

 

Hi,

 

Still learning Apex and there seem to be a problem with this code below.

 

getting error 

 

Error: Compile Error: unexpected token: '{' at line 7 column 62 
 
 any help/direction is appreciated.

 

Thanks

 

 

 

trigger CaseCloseTrigger on Case (after update) {

Case[] cs = Trigger.new;

Set<ID> cseIds = new Set<ID>();

 

// Get suggested solution on case and update solutionstatus field for dashboard

 

cse = [select SolutionID from CaseSolution where CaseId = {!Case.id};

 

if (Cse != NULL){

cs.ClosedKBStatus__c = 'Closed with KB';

}

update cse;

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
WesNolte__cWesNolte__c

Hey

 

Just a small syntax problem:

 

cse = [select SolutionID from CaseSolution where CaseId = :Case.id]; 

 

Wes 

All Answers

WesNolte__cWesNolte__c

Hey

 

Just a small syntax problem:

 

cse = [select SolutionID from CaseSolution where CaseId = :Case.id]; 

 

Wes 

This was selected as the best answer
NajoopNajoop

Thanks Wes! it was it.

 

though, need to use DML here as we cannot use trigger.new context to update objects.

 

thanks again.

Julian Juez AlfaroJulian Juez Alfaro

What is "cse"?