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

Custom Workflow - Get Int Value - Error when 0

$
0
0

Hi all

I have a custom workflow activity that takes an Account as input before creating or updating the respective Account in another system.  We have a new field on the Account called new_overduedays, which is a whole number.  

The integration piece works fine when overduedays is null or greater than or equal to 1 but when it is 0 I get the following error:

System.Runtime.Serialization.SerializationException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #18031406


None of the other tracing messages are shown.  


I'm currently getting this attribute value with the following:

if (entity.Attributes.Contains("new_overduedays"))
{
    c.OverdueDays = Convert.ToInt32(entity.Attributes["new_overduedays"]);

}

I have also tried the slightly more elegant:

c.OverDueDays = entity.GetAttributeValue<int>("new_overduedays");

Which also throws the same error.  

I have tried temporarily storing this in a var variable before assigning the value to the object property but even that failed.

As before, anything other than 0 works so I am at a bit of a loss as to why 0 is causing a problem.  If anybody has seen this before and has any advice I would be extremely grateful to hear it.

My thanks in advance for any assistance anybody is able to provide! 


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>