Skip to main content
Hi all,

I have a Account Lookup field on contact object. Whenever, the Lookup field value is changed to new value, a new case record has to be created with 'isTrue' checkbox checked.   

I want to know how tov write code to compare lookup field values before and after saving

Thanks in advance:)
1 answer
  1. Feb 22, 2018, 1:54 PM

    trigger ContactTrigger on Contact(after update) {

    for (Contact cont: trigger.new) {

    if (trigger.oldMap.get(cont.Id).AccountId != cont.AccountId && cont.AccountId != null) {

    //create new case here

    ​}

    }

    }

     
0/9000