+ Start a Discussion
prati@salesforceprati@salesforce 

Test data for multiselect picklist field in a test class

Hi,
   I have several muliselect picklist fields in my custom object and I have written a trigger which counts and adds all the selected picklist values from all the fieds and add them up together and update a field. Now i am trying to write  a test class for the same trigger but i am not sure how to create test data for those multiselect picklist fields? Can I use the existing picklist values on the object but I think , if in future the piclist options change, that might affect my test class.
    Please guide me in this. I can post my trigger if required.
 Thank you
BJ SAGABJ SAGA
Hi Prati,

I think you can make use of SCHEMA. For reference check this link,

https://developer.salesforce.com/blogs/developer-relations/2008/12/using-the-metadata-api-to-retrieve-picklist-values.html

Let me know if this works for you.

Thanks & Regards

SAGA BJ