Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Retail POS: How to modify the SaveCustomer to save a new customer field in AX and store DB

(1) ShareShare
ReportReport
Posted on by

Hi,

I would like to save the value of the new customer field in AX and the store DB. In New Customer form, i added my new field "INNRetail"

new_5F00_customer.PNG

In frmNewCustomer.Designer.cs, i added the code for binding the field:

this.textBoxINNRetail.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bindingSource, "INNRetail", true));

And in CustomerViewModel.cs, i added the class for extend the Customer.

6646.CustomerViewModel.png

Now, only i need to modify the SaveCustomer method for to save the INNRetail value. But, how i should to modify the method? Any example?

Thanks in advance,

Jorge García

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Retail POS: How to modify the SaveCustomer to save a new customer field in AX and store DB

    As addition to customizing RTS stated here: [View:https://technet.microsoft.com/en-us/library/dn126098.aspx:750:50]

    When i get the result in the response i got it something like [null, true, "Success!"]. So just bare in mind that, you can get a typical AX "1" based array as result.

    I found this in version AX2012 R3 CU10.

  • Ansar Basha Profile Picture
    1,580 on at
    RE: Retail POS: How to modify the SaveCustomer to save a new customer field in AX and store DB

    Hi Suresh,

    Thanks for your suggestion, as my question is related to this thread, its better to use the same instead of new.

  • Community Member Profile Picture
    on at
    RE: Retail POS: How to modify the SaveCustomer to save a new customer field in AX and store DB

    Hi Ansar Basha,

       If you open new tread only someone try to give you the solution. It would be easy for you to get fast replies!

    Thanks

    Suresh

  • Ansar Basha Profile Picture
    1,580 on at
    RE: Retail POS: How to modify the SaveCustomer to save a new customer field in AX and store DB

    Hi All,

    Can anyone provide some info.

  • Ansar Basha Profile Picture
    1,580 on at
    RE: Retail POS: How to modify the SaveCustomer to save a new customer field in AX and store DB

    Hi Oksana/Jorge,

    I'm required to add new fields such as mobile no, City.., in Loyalty Card.

    Above fields are entered at the time of creating the loyalty card, but optional

    I have added a method loyaltyupdate in RetailTransactionServiceEx class

    as per technet.microsoft.com/.../dn126098.aspx

    I called the update method from the commerce runtime.

    I'm stuckup at next step to saveloyalty, i couldn't find any such as "Savecustomer"method to call my method.

    Could you pls. guide me.

    loyalty-card-new-design.PNG

    Thanks,

    Ansar Basha.S

  • Community Member Profile Picture
    on at
    RE: Retail POS: How to modify the SaveCustomer to save a new customer field in AX and store DB

    Thank you so much Oksana!!

    Very important information for retail development.

    Best regards,

    Jorge García

  • Verified answer
    Oksana Kovaliova Profile Picture
    3,597 on at
    RE: Retail POS: How to modify the SaveCustomer to save a new customer field in AX and store DB

    Hi Jorge,

    The procedure of save includes 2 steps:

    A) Save new field value in AX;
    B) Save new field value in store database.

    The place of your code in SaveCustomer method depends on how important your new field is:

    1. If according to business rules you cannot save customer without this field, you need to save this field in AX at first (maybe with some temporary reference to customer) and after call standard 'save' method to create customer;
    2. If customer can have new field empty (not critical), you can add your code to the end of 'SaveCustomer' method as shown on picture below.

    2016_2D00_06_2D00_14_5F00_21_2D00_53_2D00_03.png

    How to customize RTS is described here (to save field value in AX): technet.microsoft.com/.../dn126098.aspx
    blogs.msdn.microsoft.com/.../ax-for-retail-2012-customizing-the-transaction-service

    To save field in store database, you should execute SQL command. For example:

    var dbUtil = new DBUtil(ApplicationSettings.Database.LocalConnection);
    SqlUpdate sqlUpdate = new SqlUpdate("[ax].[CUSTTABLE]");
    sqlUpdate.Set("INNRETAIL", "YOUR VALUE"); 
    sqlUpdate.Where("ACCOUNTNUM", custAccountId); 
    sqlUpdate.Where("DATAAREAID", ApplicationSettings.Database.DATAAREAID); 
    
    this.dbUtil.Execute(sqlUpdate);

    Regards,

    Oksana

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,927 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans