Notifications
Announcements
No record found.
str2Enum(enumType,enumvalue)
can you please elaborate more on what is your requirement?
Hi Muthu,
Thanks for your response.
Actually I have a requirement for Bulk Update for which I am using SysDataObject.
And I am selecting tables dynamically via DictTable.
Here the problem comes with fields whose base types are enum.
I have tried the global conversion str2Enum(), but the problem here is I cannot pass the enum type dynamically as it could be any thing such as (Gender,HcmPersonGender,PurchStatus etc.,)
Please suggest if there any way where we can use str2Enum() and could pass the enum type dynamically...
Ok, please check the below link and hope this would help
ahmad-assaf.blogspot.com/.../how-to-loop-through-enum-in-dynamics-ax.html
What do you have an the input? How do you know what value you should put into which field?
var uo = new SysDaUpdateObject(commonBuffer); uo.settingClause().add(maskedvalConfig.DataFieldName, new SysDaValueExpression(maskedvalConfig.DataFieldMaskedValue));
Hi Martin,
We have handled that as per the code pasted.
Currently for fields based of enums no data is getting stored and that's where we require help ?
We wanted to pass the value in SysDaValueExpression()
Thanks Muthu let me check and get back to you.
What value do you have in your maskedvalConfig.DataFieldMaskedValue variable?
If the field is based of an Enum.
Lets say if its based of "HcmPersonGender" then we are passing value either "Male" or "Female".
As you see we are passing the values as string thought the field is based of an enum and that's where we tried to use str2Enum() but we hanged with enum type as we cannot pass it dynamically..
It will have a string value.
I mean if a field is based of an enum lets say "HcmPersonGender" then the maskedValConfig.DataFieldMaskedValue would have "Male","Female" as string. And this is where we are having problem that no value is being saved in such case.
And hence we tried the conversion str2Enum() but unfortunately we could not as was unable to pass the enum type dynamically
could you please provide some suggestion here?
The value in maskedValConfig.DataFieldMaskedValue is a string.
I mean if the field is based of an enum then since we can't pass it as the same type we are passing it as a string value.
Because our custom table field is a string field.
hence we tried to use the global conversion str2Enum,however we could not as we cannot pass the enum type dynamically..
Please suggest if there is any possibility to achieve this.
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.
Martin Dráb 451 Most Valuable Professional
André Arnaud de Cal... 428 Super User 2025 Season 2
BillurSamdancioglu 239 Most Valuable Professional