Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / How to insert enum val...
Finance forum

How to insert enum values in table when importing value from excel using x++ in d365

(0) ShareShare
ReportReport
Posted on by 936

Hi all,

i have a field in excel which contains some value, i am importing that excel into my form(table) using x++. but those values aren't inserting into the field which is an enum field in the table. ! i tried like below but it is not inserting into the table when imported.

table.field = range.get_Item(i, 1).value);

reference link which i follwed for importing from excell

https://dynamicsaxgyan.wordpress.com/2017/04/04/read-from-excel-using-x-code-ax7-d365-for-operations/

any suggestions pls. 

thanks in advance

  • Shaik146 Profile Picture
    936 on at
    RE: How to insert enum values in table when importing value from excel using x++ in d365

    Dear Sukrut,

    A slight modiication in the syntax for D365, worked for me.

    NOYES myEnum;

    sk_excel.Enum  = str2Enum(myenum, cells.get_Item(i,107).value);

  • Verified answer
    Sukrut Parab Profile Picture
    71,682 Moderator on at
    RE: How to insert enum values in table when importing value from excel using x++ in d365

    Enum fields need to be handled differently when you import though the code , for example

    sk_excel.Enum               =       str2enum(NoYes,cells.item(row,9).value().bstr());

    However , question still remains is , do you need to do that at all, when out of the box features are available which does everything for you ? Some of them are already suggested to you by Andre.

  • André Arnaud de Calavon Profile Picture
    293,043 Super User 2025 Season 1 on at
    RE: How to insert enum values in table when importing value from excel using x++ in d365

    Hi Test Bot,

    Why are you using custom x++ for importing Excel data if you can use Data management features, Microsoft Flow or LogicApps to import Excel files?

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.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,043 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,864 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans