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)

Business connector. How to add new fields in the C# code

(0) ShareShare
ReportReport
Posted on by

I created new fields in the salesline. This setup uses Business connector to communicate with the website to get the details about a particular order. I am stuck at the point where I am not able to enhance the C# code in visual studio to push in these new fields so that DAX can accept the values for these fields through the website. Any idea about what could the code possibly be? 

I have a small block that I might think will work. But these fields (price, quantity) were already there. I don't know if I should just add the other fields as a continuation or make changes elsewhere in the code before coming down here. 

orderHeader.OrderDetailList.Clear()
For Each item As Business.ThirdPartyOrders.lineItemType In agrOrder.lineItems
orderHeader.OrderDetailList.Add(orderHeader, item.sku, item.quantity, item.price)
Next

orderHeader.Save()

And if this is the only place where the code needs to be changed. Because there needs to be some changes made in the schema as well as far as I know. 

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    What exactly is the problem? Do you expect your new fields to become properties of item, but they're not there?

    Your code snippet refer to variables and properties without showing their types. The Business Connector namespace contain classes such as AxaptaRecord, which doesn't seem to be what you're using there. Aren't they proxy classes for Enterprise Portal? Or your custom classes?

  • Community Member Profile Picture
    on at

    Yes the new fields I created should be become part of the item. When an order is placed on the website, the respective values for these fields should be populated in DAX. This is actually a custom class RecievedOrders created by my predecessor. It inherits Sytem.Web.UI.Page.  

    Partial Public Class receiveOrders

       Inherits System.Web.UI.Page

       Protected Sub Page_Load(ByVal sender As Object, _

                               ByVal e As System.EventArgs) Handles Me.Load

    Within this, there is a try catch to upload the values.

    Then there is a function SaveAgrOrdersto3Pol

    Private Function saveAgrOrdersTo3Pol(ByVal agrOrders As AGResource.Business.ThirdPartyOrders.orders) As  _

                                                                   AGResource.Business.ThirdPartyOrders.orders

           Dim failedOrderCnt As Integer

           Dim orderHeader As AGResource.Business.ThirdPartyOrders.OrderHeader

           Dim failedAgrOrders As New AGResource.Business.ThirdPartyOrders.orders

           For Each agrOrder As AGResource.Business.ThirdPartyOrders.order In agrOrders.order

               Try

                   orderHeader = AGResource.Business.ThirdPartyOrders.OrderHeader.NewOrderHeader

                   orderHeader.ChargeNumber = agrOrder.creditCard.Number

                   orderHeader.ChargeExpirationDate = agrOrder.creditCard.expiration

    and so on. I am not understanding where to add my new fields in this code.

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    What's AGResource.Business.ThirdPartyOrders.OrderHeader, for example? Is this a custom class developed by your predecessor, or what?

  • Community Member Profile Picture
    on at

    That is what I am not able to deduce from the code. There is no documentation as to tell me what it is, what it is doing, where and how it is getting the data from. Hence I am not able to pin point the area of the code, where my new fields should go.

    a gist is,

    Dim agrOrders As New AGResource.Business.ThirdPartyOrders.orders

    saves the order in the database,

    agrOrders = saveAgrOrdersTo3Pol(agrOrders)

    the order header is declared as,

    Dim orderHeader As AGResource.Business.ThirdPartyOrders.OrderHeader

    Another important thing is, he mentioned in the comments at the start of the code that,

    ''' <summary>

    ''' Captures 3rd Party Orders in the XML format of type defined in

    ''' AGResource.Business.ThirdPartyOrders.order.  Orders are sent directly

    ''' to the database.

    '''   Maybe removed when converted to DAX.

    Does this ring a bell? He says its not even going into DAX and is directly sent into the database.

  • Iulian Cordobin Profile Picture
    8,201 on at

    I still do not understand where you want to write your custom code, but in the place you want to write this are you referencing the BC.Net assembly or some other custom assembly (like the AG* mentioned below). If the later, you should have the code for it from whoever wrote it, I would say, because it really does sound like a wrapper for the business connector.

  • Community Member Profile Picture
    on at

    Oh okay. The standard looks like a usual BC.Net code. I wish to use that to write my code to add the new fields. But don't know how. And if it is indeed a wrapper to the business connector, how do I go about adding these fields and where?

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Look at in which assembly is the class defined. If it's in your project or a referenced project, you can see its code (you can simply press F12 on the class in editor to get there). If it's referenced as DLL, check it's properties, such as the author.

  • Iulian Cordobin Profile Picture
    8,201 on at

    Analyzing the way the code is structured from your copy/pastes looks like, if you do not have the source code for the AG* libraries project, it's unlikely you will be able to make the changes you need.

  • Community Member Profile Picture
    on at

    When I try to debug the code, it says the referenced assembly was not found. This is the exact error. It continues to say even more assemblies are not found.

    The referenced assembly "C:\Users\THIRDPARTYORDERS\Source\ThirdPartyOrders\bin\Debug\AGResource.Business.ThirdPartyOrders.dll" was not found. If this assembly is produced by another one of your projects, please make sure to build that project before building this one.

  • Iulian Cordobin Profile Picture
    8,201 on at

    I do not think we can help you on this, maybe you should ask someone in your company what is the library / where to find the source code (that will help you make the changes).

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