You need to sign in to do that
Don't have an account?

Trigger, Where to to check the multi select Picklist contains.
I have trigger where i need to check a Multi select picklist value if it contains Value Temporary then the value has to update by entering into If() Condition as shown below.
trigger Update_Candidate_TempLocation on Contact (before insert,before update)
{
for(Contact c:trigger.new)
{
if(c.Candidate_Position_Type_IDs_New__c=='temporary' && c.RecordTypeid=='012D0000000hW06')
{
c.Candidate_Temp_Location_New__c=c.MailingState ;
}
}
}
This is my code. How to look into it, if multi select picklist contains Temporary!!!
There is a String method named contains() that you can use like this:
if( c.Candidate_Position_Type_IDs_New__c.contains( 'Temporary' ) ) {
// add logic here
}
Here's a link to the String Methods - http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_string.htm
Hope that helps!
~ Clint
All Answers
There is a String method named contains() that you can use like this:
if( c.Candidate_Position_Type_IDs_New__c.contains( 'Temporary' ) ) {
// add logic here
}
Here's a link to the String Methods - http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_string.htm
Hope that helps!
~ Clint
Thanks for the reply.
I had no idea on contains in trigger.
Got it, its working now.
Thanks Clint.