function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Annette Grant 13Annette Grant 13 

Hi, I have 12 questions and the responses are from a picklist. The picklist choices are (1,2,Achieved,not achieved). The response 1 and 2 can only be selected once. If selected more than once an error needs to be generated.

Nishant Prajapati 10Nishant Prajapati 10

You can create a wrapper class in you class, which contains following properties:
public class WrapperClass{
      public string question {get;set;}
      public string answer {get;set;}

the method in which you're inserting records, iterate over the List<WrapperClass> and check if 'answer' property of instance from List<WrapperClass> is '1' or '2'.