You need to sign in to do that
Don't have an account?
Karthik Sundara Raj
What is the problem with this code?
Hi All,
I have written a Trigger which I have attached in below.It is working well when I give Direct Value as"'VIN__c='WAUZZZ8V3FA002049' ",But If I give dynamic Value as 'VIN__c=:setStrVINNumber" it is not working,Please have look the code in below:
Thanks&Regards,
Karthik
I have written a Trigger which I have attached in below.It is working well when I give Direct Value as"'VIN__c='WAUZZZ8V3FA002049' ",But If I give dynamic Value as 'VIN__c=:setStrVINNumber" it is not working,Please have look the code in below:
String modelyear1; String LMOI; // loop through all contacts to be updated String setStrVINNumber; if(trigger.isBefore){ if (trigger.isInsert || trigger.isUpdate){ system.debug('-------333333-----1'); for(Contact Objcont:Trigger.New){ setStrVINNumber = Objcont.Id; LMOI=Objcont.Latest_Model_of_Interest__c; } system.debug('ID..........'+ setStrVINNumber); /*//////////////////////////////////////////////*/ if(LMOI == null){ system.debug('ID.......222222222222...'+ setStrVINNumber); for(Contact_Vehicle_Ownership__c objCVO : [SELECT Id,VIN__c,Name,Model_Display_Name__c FROM Contact_Vehicle_Ownership__c where VIN__c='WAUZZZ8V3FA002049' AND Customer_Vehicle_Relationship_Status__c='Active']) { modelyear1=objCVO.Model_Display_Name__c; } } else { modelyear1=LMOI; // Objcont.Current_Model__c=Objcont.Latest_Model_of_Interest__c; } for(Contact Objcont:Trigger.New){ Objcont.Current_Model__c=modelyear1; }Please let me know if any queries.
Thanks&Regards,
Karthik
setStrVINNumber = Objcont.Id;
please pass VIN in above line then you can use VIN__c=:setStrVINNumber
Let us know if this will help you
Thanks
Amit Chaudhary