Notifications
Announcements
No record found.
Hi,
how can I check if the value of InArgument<Decimal> in a CodeActivity is empty ?Thanks.
*This post is locked for comments
Hi Donny,
I don't think there's a way to check if an InArgument is null, especially for primitive types like decimals. The argument will have a value, but if it's not set by the user it would be the default value for the type - 0.0M for decimal.
Hope this helps! I'd appreciate if you'd mark this as a Verified answer.
Thanks,
Aiden
Decimal is a value type. It can never be null.
If you need to have a nullable type decimal, you can use decimal? Then you can do myDecimal.HasValue to check whether it has value or not
Hi Chitra,
I don't think a nullable decimal is allowed as an input attribute, per msdn.microsoft.com/.../gg327984.aspx
thats Right CRM does not support nullable types in input/output argument. Thanks
for correcting it.
There is a property 'Expression' for InArgument that can be used to evaluate if the value of an InArgument has been set. This only works for non-nullable datatypes.
https://msdn.microsoft.com/en-us/library/dd485341(v=vs.110).aspx
[Input("Value")] InArgument<Decimal> decimalValue { get; set; } protected override void Execute(CodeActivityContext executionContext) { Decimal value = 0; if (decimalValue.Expression != null) { value = decimalValue.Get<Decimal>(executionContext); } }
That's awesome Nuno, thanks.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2