Trigger on Single Field

I was playing around with Apex Triggers and was wondering, suppose I had an object (for example Account), which contains a sub-object (such as the string BillingAddress).

Can I set a trigger on Object.subObject?

So Instead of creating a trigger on Account I want a trigger that fires off only when Account.BillingAddress is updated for example.

My idea is to just type in:

trigger TriggerName on Account.ShippingCountry (before insert) {  } 

But this fails to compile. How should I accomplish this objective?


You will create the trigger on the account and use the billingAddress as the criteria.

For Example

trigger example on Account(before update){

    for(Account a :{
        if(a.BillingAddress != trigger.oldMap.get({
             //do something


Category: apex Time: 2016-07-28 Views: 3

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.256 (s). 12 q(s)