trigger PopulateRegion on Shipment_Order__c (after insert, after update) {
for(Shipment_Order__c shipmentorder : Trigger.new) {
If(shipmentorder.Hub_Shipment_Formula__c == False ){
string region = Country_Region_List__c.getInstance(shipmentorder.Ship_From_Country__c).Region__c;
shipmentorder.Ship_From_Zone1__c = region;
}
Else {
string region3 = Country_Region_List__c.getInstance(shipmentorder.Ship_From_Country__c).Region__c;
string region2 = Country_Region_List__c.getInstance(shipmentorder.HUB_Country_Formula__c).Region__c;
shipmentorder.Ship_From_Zone1__c = region3;
shipmentorder.Hub_Ship_From_Zone__c= region2;
}
}
}
7 respuestas

Hi Masechaba Maseli 8,As i observed you have not creating custom setting record with the value of HUB_Country_Formula__c field. Try to add custom setting record and try.As Abdul Khatri mentioned, dont forget to have a null check.Let me know if you need more help.RegardsNaveen