web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Form Part - Callbacks

(1) ShareShare
ReportReport
Posted on by 11,310

Hi All.

I am creating a form part that can be used by various forms with different datasources. My form part does not contain a datasource, but needs to update static fields when a new record on the main form is selected. 

What callbacks or other features can I use to accomplish this? Reverse engineering other form parts reveals that most use a datasource link, but this is not possible in my case.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,693 Most Valuable Professional on at
    RE: Form Part - Callbacks

    You won't get any notification if you don't have any dynamic link between those two forms. You would have to add a piece of code to each form to notify the form part.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    300,721 Super User 2025 Season 2 on at
    RE: Form Part - Callbacks

    Hi Jonathan,

    There is an example for updating the part using x++ statements on the form SysSecRoleAssignOM. Perhaps this will help you.

  • Verified answer
    Jonathan  Halland Profile Picture
    11,310 on at
    RE: Form Part - Callbacks

    Hi Andre. That is exactly what I was looking for thanks. Just for completeness here is the full solution

    1. Create your form and form part

    2. Add your form part to your main form.

    3. Add an object reference in your main form's class declaration e.g. "Object part"

    4. Create a method on your main form e.g. "registerForChange(Object _part); with the following code:

    public boolean registerForChange(Object _part)
    {
        part = _part;
        
        return true;
    }

    5. On your form parts init method. Call this method.

    Object caller;
    
    caller = args.caller();
    if (caller)
    {
        caller.registerForChange(this)
    }

    6. On your form part create an doRefresh method. E.G.
    public void doRefresh(Common _record)
    {
        //Do custom form code.
    }
    7. Finally on the main form, whenever you want you main form to be updated call part.doRefresh(myRecord); This would normally be in the active method on the main form's main datasource.

    Update: I wrote a slightly more extensive post on my findings: http://www.exploreax.com/blog/blog/2014/12/01/form-parts-creating-form-method-callbacks/


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
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans