Try our conversational search powered by Generative AI!

Decimal metafield using MetaFieldBuilder



I'm trying to add a metafield to the cls_organization table, by using the MetaFieldBuilder. Now, creating most of the fields works fine, however, I am not able to create a decimal with a specific precision and scale. When I use the CreateDecimal method, a float is created, which is not what I want.

If I add en entry in the [mcmd_MetaFieldType], with name "Decimal" and MCDataType 18, and use the CreateMetaField method instead where I specify "Decimal" as the typeName and pass an AttributeCollection with specific Precision and Scale, it works fine.

What I am wondering is, is this a safe way to achieve the decimal column in the database?

Best regards

Apr 09, 2019 8:22

Hi Jessica,

From your description, I found that it's incorrect in CreateDecimal() method from MetaFieldBuilder class that creates the float instead of decimal. I'll create a bug for this.

About the CreateMetaField() method, I think there is no risk when using it to replace for CreateDecimal() method, but note to add precision and scale attributes for AttributeCollection.

Best regards,


Apr 09, 2019 12:36

Hi Giang

Yeah, I did look into the code for CreateDecimal and it looked a bit strange. The question is, if we add "Decimal" by ourselves in the [mcmd_MetaFieldType], could there be a conflict with a future bug fix/update from Epi Commerce?


Best regards


Apr 10, 2019 7:54

Hi Jessica,

The bug has created.

I'm not sure if there's a conflict from the fix/update with your implementation, it's depend on how we're going to fix. But I think it's may be no.

I'll update some information about the bug when we're resolve it.

Best regards


Apr 10, 2019 8:30

Has this bug been filed? If so what's its bug number? And has it been fix in a release?


Sep 26, 2019 19:29
Quan Mai - Sep 27, 2019 9:53
The bug fix was released in Commerce 13.2.
Matt V - Sep 27, 2019 15:15
Thanks Quan
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.