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
Andrew Aldis 6Andrew Aldis 6 

Trigger to update entitlements

My company has a pretty straight forward entitlement process, we basically have 3 levels and I was able to create an enitlement process to cover all 3 levels based on custom fields on the case.  We really want to be able to take advatage of milestones so a simple workflow will not suffice.  I want to create a trigger to update the entitlement name field on the case when ever an entitlement is created but cannot seem to get it right.  Have written simple triggers like this before that have updated a field but this one keeps giving my the following error on line 4.  Comparison Arguments must be compatible types entitlement, string.  If anyone can help me I would appreciate it.  I would like to move more into development and have set a personal goal to get a working apex trigger into production by the end of April.  Beleive me there is plenty of need for this skill set at my job.

trigger DefaultEntitlementUpdate on Case (before insert) {
    for(Case c : trigger.new){
        if(c.Entitlement == Null){
            c.Entitlement == 'Standard Entitlement';
        }
    }
}
Best Answer chosen by Andrew Aldis 6
Pankaj_GanwaniPankaj_Ganwani
Hi,

Is the Entitlement custom field? If so, then please append __c at the end of c.Entitlement(c.Entitlement__c) and then do comparison and assignment.