Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Upsert using alternate key where one value can be null

$
0
0

Consider that you have an Alternate Key with some values and then start date and end date.
This end date can be null, if that date is yet not known.


How do I construct the entity object and the corresoponing KeyAttributeCollection to make it work? I just keep getting:
Condition for attribute '<entity name>.<prefix>_end': null is not a valid value for an attribute. Use 'Null' or 'NotNull' conditions instead.

if I ignore it
The specified key attributes are not a defined key for the <entityName> entity


if (end.HasValue)
{
    crmObject.<prefix>_end = end;
    keys.Add(new KeyValuePair<string, object>(<entityName>.Fields.<prefix>_end, crmObject.<prefix>_end));
}
else
{
    //ERROR IS HERER!!
    keys.Add(new KeyValuePair<string, object>(<entityName>.Fields.<prefix>_end, null));
}

So what line do I add in that else part and how do I Upsert using alternate key where one value can be null?


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images