Skip to main content
Peter Cowen (selenity) 님이 #Customer Service에 질문했습니다
I am trying to build a trigger so when a case comes in and it has a account attached it populates the entitlement field.

 

So far I have

 

trigger defaultEntitlement on Case (Before Insert, Before Update) {

 

List <Entitlement> entls = [Select

 

e.StartDate, e.Id, e.EndDate, e.AccountId, e.AssetId

 

                                     From Entitlement e

 

                                     Where

 

e.AccountId in : acctIds and e.EndDate >=Today and e.StartDate <= Today];

 

        if(entls.isEmpty()==false){

 

            for(Case c : Trigger.New) {

 

                if(c.EntitlementId == null && c.AccountId != null){

 

                    for(Entitlement e:entls){

 

                        if(e.AccountId== c.AccountId){

 

                            c.EntitlementId = e.Id;

 

                            if(c.AssetId==null && e.AssetId!=null)

 

                            c.AssetId=e.AssetId;

 

                            break;

 

}

 

I get Compile Error: Variable does not exist: acctIds. 2 questions really 1. will the above trigger do that 2. how do I fix the Variable does not exist error and is there any more I need to add.

 

 
답변 1개
0/9000