Skip to main content
replaced http://salesforce.stackexchange.com/ with https://salesforce.stackexchange.com/
Source Link

You should use Trigger.newMap instead of List as explained by RalphRalph in the answer.

In addition, to check the condition if the industry is changed or not there is an another Trigger context variable Trigger.oldMap where you can get previous value of field and this provide ability to compare the changes in record after update.

Ex:

for(Account acc : Trigger.newMap)
{
     Id oldvalue = Trigger.oldMap.get(acc.Id).Industry_Field__c;
     Id newValue = acc.Industry_Field__c;
     
     // check if industry field changed or not
     if(oldvalue != newValue )
     {
        // Proceed
     }
}

You should use Trigger.newMap instead of List as explained by Ralph in the answer.

In addition, to check the condition if the industry is changed or not there is an another Trigger context variable Trigger.oldMap where you can get previous value of field and this provide ability to compare the changes in record after update.

Ex:

for(Account acc : Trigger.newMap)
{
     Id oldvalue = Trigger.oldMap.get(acc.Id).Industry_Field__c;
     Id newValue = acc.Industry_Field__c;
     
     // check if industry field changed or not
     if(oldvalue != newValue )
     {
        // Proceed
     }
}

You should use Trigger.newMap instead of List as explained by Ralph in the answer.

In addition, to check the condition if the industry is changed or not there is an another Trigger context variable Trigger.oldMap where you can get previous value of field and this provide ability to compare the changes in record after update.

Ex:

for(Account acc : Trigger.newMap)
{
     Id oldvalue = Trigger.oldMap.get(acc.Id).Industry_Field__c;
     Id newValue = acc.Industry_Field__c;
     
     // check if industry field changed or not
     if(oldvalue != newValue )
     {
        // Proceed
     }
}
edited body
Source Link
Mike Chale
  • 13.4k
  • 7
  • 48
  • 90

You should use Trigger.newMap instead of List as explained by Ralph in the answer.

In addition, to check the condition if the industry is changed or not there is an another Trigger context variable Trigger.oldMap where you can get previous value of field and this provide ability to compare the changes in record after update.

Ex:

for(Account acc : Trigger.newMap)
{
     Id oldvalue = Trigger.newMapoldMap.get(acc.Id).Industry_Field__c;
     Id newValue = acc.Industry_Field__c;
     
     // check if industry field changed or not
     if(oldvalue != newValue )
     {
        // Proceed
     }
}

You should use Trigger.newMap instead of List as explained by Ralph in the answer.

In addition, to check the condition if the industry is changed or not there is an another Trigger context variable Trigger.oldMap where you can get previous value of field and this provide ability to compare the changes in record after update.

Ex:

for(Account acc : Trigger.newMap)
{
     Id oldvalue = Trigger.newMap.get(acc.Id).Industry_Field__c;
     Id newValue = acc.Industry_Field__c;
     
     // check if industry field changed or not
     if(oldvalue != newValue )
     {
        // Proceed
     }
}

You should use Trigger.newMap instead of List as explained by Ralph in the answer.

In addition, to check the condition if the industry is changed or not there is an another Trigger context variable Trigger.oldMap where you can get previous value of field and this provide ability to compare the changes in record after update.

Ex:

for(Account acc : Trigger.newMap)
{
     Id oldvalue = Trigger.oldMap.get(acc.Id).Industry_Field__c;
     Id newValue = acc.Industry_Field__c;
     
     // check if industry field changed or not
     if(oldvalue != newValue )
     {
        // Proceed
     }
}
Source Link
Ashwani
  • 22.7k
  • 4
  • 41
  • 73

You should use Trigger.newMap instead of List as explained by Ralph in the answer.

In addition, to check the condition if the industry is changed or not there is an another Trigger context variable Trigger.oldMap where you can get previous value of field and this provide ability to compare the changes in record after update.

Ex:

for(Account acc : Trigger.newMap)
{
     Id oldvalue = Trigger.newMap.get(acc.Id).Industry_Field__c;
     Id newValue = acc.Industry_Field__c;
     
     // check if industry field changed or not
     if(oldvalue != newValue )
     {
        // Proceed
     }
}