web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • Verified answer
    Oksana Kovaliova Profile Picture
    3,597 on at

    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

  • Community Member Profile Picture
    on at

    Thank you so much Oksana!!

    Very important information for retail development.

    Best regards,

    Jorge García

  • Ansar Basha Profile Picture
    1,584 on at

    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

  • Ansar Basha Profile Picture
    1,584 on at

    Hi All,

    Can anyone provide some info.

  • Community Member Profile Picture
    on at

    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,584 on at

    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

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans