You need to sign in to do that
Don't have an account?
Querying for multipicklist values
Hi,
I'm trying to write a triger that for certain cases would send a notification to a specirfic contact. The case has a "component" field, which is a picklist. On the other side, we have a number of contacts and every contacts is assigned to one or more components on a multipicklist.
What we want to do is to send an email when a case is closed based on the component of the case, to the contact that has that component selected in the contact's multipicklist.
We try to query this way:
List<Contact> recipients = [SELECT c.id, c.firstname FROM Contact c WHERE c.RecordTypeId = :contactTypeId.id AND c.eXpertsRelatedComponent__c.Includes (Case Component)];
What should be the syntax to such scenario?
Any help will be greately appreciated!
Thanks
Tzuvy
Hi,
Some changes in SOQL query which are given below
List<Contact> recipients = [SELECT c.id, c.firstname FROM Contact c WHERE c.RecordTypeId = :contactTypeId.id AND c.eXpertsRelatedComponent__c Includes (:strskil)];
Note- Assume Case component is the string parameter.
You can create the string parameter by referencing the below code
public String[] skilVal = new String[]{}; //skilVal contains picklist value
string strskil;
for(Integer i=0; i<skilVal.size(); i++)
{
if (i == 0)
{
strskil = skilVal[i];
}
else
{
strskil = strskil + ';' + skilVal[i];
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
Hi,
Some changes in SOQL query which are given below
List<Contact> recipients = [SELECT c.id, c.firstname FROM Contact c WHERE c.RecordTypeId = :contactTypeId.id AND c.eXpertsRelatedComponent__c Includes (:strskil)];
Note- Assume Case component is the string parameter.
You can create the string parameter by referencing the below code
public String[] skilVal = new String[]{}; //skilVal contains picklist value
string strskil;
for(Integer i=0; i<skilVal.size(); i++)
{
if (i == 0)
{
strskil = skilVal[i];
}
else
{
strskil = strskil + ';' + skilVal[i];
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.