Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Issues with adding InventDim datasource to a form extension

Posted on by 690

Hi

I have to add the field InventDimId to the serial number table (InventSerial) and also add the InventDim table as a datasource to the InventSerial form using extensions. I have found a blog post (ievgensaxblog.wordpress.com/.../ax-7-extending-forms-using-form-parts) about using a form part to connect from the InventSerial datasource to the data in the new form so that I can avoid the super() call on the create method of the InventDim datasource.

The issue I am having is that when I press the edit button to edit InventSerial record none of the InventDim fields become editable. Is this possible ? Does anyone know of an existing form extension where this has been done?

00680.Capture.PNG

Thanks,
Joe

*This post is locked for comments

  • JoeBrewer Profile Picture
    JoeBrewer 690 on at
    RE: Issues with adding InventDim datasource to a form extension

    Thanks so much for taking the time to help Ievgen. I really appreciate it

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Issues with adding InventDim datasource to a form extension

    Hi Joe Brewer,

    To make form part editable please use next code:

    Declare variable for parent form:

    FormRun hostForm;

    Override init of the form part

    public void init()
    {
        hostForm = element.args().caller();
    
        super();
    
        if (hostForm)
        {
            hostForm.onTask += EventHandler(this.updateFormViewMode);
        }
    }


    implement updateFormViewMode method

     private void updateFormViewMode(FormRun _hostForm, int _taskId)
     {
        if (_taskId == #taskEditRecord || _taskId == #taskDoneEditRecord)
        {
            this.task(_taskId);
        }
     }


    I took this code from LogisticsPostalAddressGrid, it has other interesting functionality, so it's worth to look at it.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,253 Super User 2024 Season 2 on at
    RE: Issues with adding InventDim datasource to a form extension

    Hi Joe,

    I haven't looked at the option to extend forms using form parts myself. Probably the author can assist on this? Ievgen is also a volunteer on this forum.

  • JoeBrewer Profile Picture
    JoeBrewer 690 on at
    RE: Issues with adding InventDim datasource to a form extension

    Hi André

    The issue is that if I add the InventDim table as a datasource to a form extension I cannot stop the create method - the super() call is normally commented out in the create method. In a form extension it doesnt seem possible to do this. The original blog post at the top hinted at a way that this could be done.

    Joe

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,253 Super User 2024 Season 2 on at
    RE: Issues with adding InventDim datasource to a form extension

    Hi Joe,

    It is not possible at all to maintain the fields in this table directly. When this table is used on forms, like sales order lines, then the table is specially handled. This because it is not allowed to change the values on existing records. If you do so, also posted transactions will be "updated" with the changes.

    Other forms are trying to find an existing inventDim record based on entry or creates a new one when needed. So you would have to do it in the same way as other forms.

  • JoeBrewer Profile Picture
    JoeBrewer 690 on at
    RE: Issues with adding InventDim datasource to a form extension

    Hi André

    Here are the properties that I have changed for the InventDim datasource:

    Allow create: No

    Allow delete: No

    Insert at end: No

    Insert if empty: No

    Allow check: No

    Table: InventDim

    On the InventSerial extension I have added a form part and given it the menu item name of my new form. I have then added a link that linked the new InventDimId field on the InventSerial table to the InventDimId field on the InventDim record.

    Thanks,

    Joe

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,253 Super User 2024 Season 2 on at
    RE: Issues with adding InventDim datasource to a form extension

    Hi Joe,

    Can you start with providing some more information? What properties are used on the form datasource?

    I also wonder what would be reason to have the InventDim linked to the Serial numbers. Usually the serial number is used at a certain InventDim record as part of a transaction. The same serial number can be used on multiple InventDim records depending on e.g. inventory movements. What record are you actually showing then?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans