Hi Techies,
I have one entity with multiselect optionset field and I want to check whether the options are already saved or not while saving new record.If already present then we need to throw the duplicate record warning.
for ex: I already saved one record with a,b,c options in multiselectoptionset. Now I try to save another record with a,b,d , the system should allow me to save the record. Because both options are not exact match.
If I use the below code its not working.If we use In condition it will not suitable for the below scenario.
Lets say If I try to save a,b options in multiselectoptionset It will check with existing record (a,b,c option record). The new value a,b already present in the existing record so it will return the record. But I need to check the exact options should match.
If I try to save a,b,c once again I want to throw the duplicate match error. But If I try a,b,d or a,b or a or b the system should allow to be consider as a non duplicate.
How can I retrieve the exact match options through queryexpression ? TIA.
Entity entity = (Entity)context.InputParameters["Target"]; if (entity.Attributes.Contains("abc_multiselectfieldname")) { OptionSetValueCollection collection = (OptionSetValueCollection)entity.Attributes["abc_multiselectfieldname"]; QueryExp.Criteria.AddCondition("abc_multiselectfieldname", ConditionOperator.IN, collection); }