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)

Fields created using extension, not accessible in overlayer

(0) ShareShare
ReportReport
Posted on by

Hi,

I am facing an scenario, that I am unsure how to go about.

I have created a new extension package referencing the "Application suite" and was able to create extension of a table and add a field to it.

I have to modify another class related to this customization, but since I was not able to use the extension approach(The code to be customized requires a change in method signature), have used the overlayering approach.

The issue now is that I am not able to access the table field created in extension from the class(that is overlayered). I understand this is because I haven't referenced the extension package. However when I try to reference the extension package, the package is not found in list. Can someone help me please to understand how I need to move forward with this scenario.

Thanks in advance

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,194 Super User 2025 Season 2 on at

    Hi Bala,

    To be able to suggest the best approach, you have to provide the full details about the requirement. In many situations it is possible to prevent customizing classes. The way you have created an extension and a customization is not working together. You cannot reference two models from one customization model.

  • Community Member Profile Picture
    on at

    Thanks Andre.

    Please find the details on tables and classes

    Package - Package1; Model - Model1; Type: Extension package

    Table: HcmEmployment

    New field added: TestFlag

    Package - Package2; Model - Model2; Type: Overlayering; Created In package: Application suite

    Class: HcmWorkerTransition

    Method: createHcmWorker

    Changes:

    1. Need to modify the signature of this method, going to add an optional parameter for the value of the field TestFlag (This change is required as a new field is added in "Hire new worker" and this field value needs to passed on to the class during worker record creation. The standard has the code in clicked method of Hire new worker form, that again I would be overlayering to pass an additional parameter to the class method)

    2. Within the class method  going to use the field TestFlag to assign the value to the table field. The code fails here with a field not found error.

    Note: I have looked into the events of the clicked button in the form(For just updating the new field after record is created in an extension), however I am not sure on getting the status of creation/recid &value from the new field in form from the sender button object.

    Thanks in advance.

  • Mea_ Profile Picture
    60,284 on at

    Hi bala1985,

    To overcome such kind of issues you can use delegates, so instead of passing new field directly create a delegate in overlaying model that will return value to pass, then subscribe to the delegate in extension model to return new field. Another option is to create third model, so if model A refers to B, B cannot refer to A, but in case you have 3 models: A, B and C you can do a "loop", A -> B -> C -> A, looks strange but it works.

  • Basheer17 Profile Picture
    2,720 on at

    You have created a new extension model in a new package and it has a reference of Application Suite package. Then you have created a table extension added a field. And you also wanted to customize a class and use the newly created field in your class. Since you can't modify existing methods using extensions you chose to go for overlayering by creating new model in Application Suite package.

    Since Application suite has been already referenced in your extension package, reverse is not possible as cyclic reference is not allowed.

    1. You can use delegates as Ievgen suggested.

    2. This is not suggested but saves some efforts. Since you chose to overlayer your class you can overlayer the table as well to add new fields.

  • Suggested answer
    Community Member Profile Picture
    on at

    Thanks all for the replies.

    I explored the option of using the delegates. I couldn't find an way to link the base and extension forms using delegates. I have tried with classes, it works well however I could not find a way to link the forms(Base and extended) using delegates.

    I ended up with this approach. Can someone please suggest if there is an better approach to solve this problem.

    1. Create EDT in the extension and customize the table/form in the extension.

    2. Overlayer the base form and find the extension formcontrols in runtime and use the value in overlayered classes(With an condition if extension fields are not found, the forms/classes works as in standard)

    3. Add delegates to overlayered class and use them in extension to initialize the new field values.

    The only issue is that I need to declare variables in overlayered forms without  EDT's as they are in the extension model. Haven't found a workaround for this so far.

  • Mea_ Profile Picture
    60,284 on at

    Hi bala1985,

    Could you please explain your problem with delegates on a form? It's not clear what do you mean under "link base and extension" form.

  • Community Member Profile Picture
    on at

    Thanks for the reply.

    I am trying to add a new field to HcmWorkerNewWorker form. This filed value needs to be passed on to the class "HcmWorkerTransition" and eventually committed to HcmEmployment table.

    I have created the HcmEmployment table fields/HcmWorkerNewWorker form customization in the Extension model.

    Now in the clicked method of the form HcmWorkerNewWorker, I need to access the newly created field(in extension) value. This value would be passed on as a parameter to the class HcmWorkerTransition.

    I am overlayering the class HcmWorkerTransition(As there is a signature change in method)

    and

    overlayering HcmWorkerNewWorker as the number of arguments need to be modified when calling the class HcmWorkerTransition from clicked method.

    Hope it is clear now.

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    Hi bala1985,

    Thanks for explanation. So in one of my last posts I proposed:

    1) Using overlaying create new delegate on a form that accepts cursor and returns new field's value, not EDT if it is a new EDT but generic type. There is already a delegate "OKClicked" on a form, so you can use it as example.

    2) Subscribe to delegate in extension model to return new field.

    3) Use returned value in overlayed Clicked method to pass it to a overlayed  method on HcmWorkerTransition

  • Miguel Zuniga Profile Picture
    272 on at

    Hi ievgen Miroshnikov and bala1985.

    I have the same problem where I am doing overlay in a model that has Application Suite package and need a custom field I added into a model which it does not have any package it is just used for extension.

    Model1: Application Suite package

    Model2: No package, just references

    I have a SalesLine.Extension in my model2, and I need my custom field there that I will use in my model1.

    In my model1 I am overlaying a button (TransferToConfirmedButton) in form SalesAvailableDlvDates where I used its method clicked. When it is clicked I need to pass a string value to my custom field in my extenison table that is found in model2. 

    Is this the right approach? which is marked as verified answer? If so, can you help me where to start?

    Here are my questions:

    1) Using overlaying create new delegate on a form that accepts cursor and returns new field's value, not EDT if it is a new EDT but generic type. There is already a delegate "OKClicked" on a form, so you can use it as example.

    What is the correct code for this delagate? that returns a new field's value?

    What I've searched is this

    delegate void reasonField_delegate(SalesLine _salesLine, EventHandlerResult _res){} 

    Is the instructions in the link is what I am supposed to do? and what do you mean by "not EDT if it is a new EDT but generic type"? What EDT are you referring to? Should I create an EDT in my overlay?

    2) Subscribe to delegate in extension model to return new field.

    Does this mean that I'll subscribe to my delagate in model1 from my extension in model2? If so, where?

    3) Use returned value in overlayed Clicked method to pass it to a overlayed  method on HcmWorkerTransition

    In here, are you referring to passing values form different methods in my overlay? 

    would appreciate the help, it's my first time encountering 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.

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