Announcements
I am setting 'statecode' field of entity 'quote' of CRM using script component in ssis as:
if(!Row.activated_IsNull)
{
quote.Attributes["statecode"] = Row.activated;
}
else
{
quote.Attributes["statecode"] = null;
}
But I am getting following error when I run the it:
What can be the reason for this. Please help!!
Thanks in advance.
I wrote "is like an optionset", I know that statecode has a specific type to itself but doesn't change the fact that there is a numeric value behind. I don't know how to set it inside the SSIS script you are writing, check how can you set an optionset field inside the ssis script, setting statecode will be nearly the same
In my case the datatype of statecode is 'Status' and not optionset. How do I assign that in SSIS script
statecode is like an optionset, you need to set it as an optionset (so with a numeric value behind), not as a string, and "Draft" is definitely not a valid state. Check the statecode from the metadata (usually Active is 0 and Inactive is 1) and see how you should set it inside the SSIS script you are writing.
I wrote following code but still throws same error:
if(Row.activated == 1)
{
quote.Attributes["statecode"] = "Active";
}
else if (Row.activated == 0)
{
quote.Attributes["statecode"] = "Draft";
}
statecode is for most entities just Active and Inactive, so if the record is not Active (as you are setting in the if condition) then is Inactive
Doe that mean I have to hard code it?
the reason is the error message you are receiving, you can't set that field to null, you need to put one of the valid values
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156