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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Auto refreshing the form in X++

(0) ShareShare
ReportReport
Posted on by 113

Hi Experts,

My requirement is to auto refresh a form every 1 min. I have a custom form and I created a new button - Refresh .I have written a code on Button click  for this but getting error.


    [Control("Button")]
    class Refresh
    {
        /// 
        ///
        /// 
        /// 
        public void clicked()
        {
            int msInterval;
            super();
            this.visible(false);
            Refresh.visible(true);

            this.cancelTimeOut(timeOut);

            msInterval = 1 * 60 * 1000; // Refresh every minute

            StockPredictions_CAP_ds.research(true);
            StockPredictions_CAP_ds.findRecord(StockPredictions_CAP_ds.getFirst());

            Object task = this.setTimeOut(identifierstr(this), methodStr(Refresh, clicked), msInterval, false);
    
            Refresh.visible(true);
            
        }
    }

I have the same question (0)
  • Mohit Rampal Profile Picture
    12,565 Moderator on at
    RE: Auto refreshing the form in X++

    Hi Harish, you didn't mentioned what's the error and on which line are you getting it.

  • HARISH MEHRA Profile Picture
    113 on at
    RE: Auto refreshing the form in X++

    Hi Rampal,

    Error - ClassDoesNotContainMethod: Control 'Refresh' does not contain a definition for method 'setTimeOut' and no extension method 'setTimeOut' accepting a first argument of type 'Refresh' is found on any extension class.

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    RE: Auto refreshing the form in X++

    Try this.

    community.dynamics.com/.../ax-7-using-timer-to-perform-a-periodic-task

  • HARISH MEHRA Profile Picture
    113 on at
    RE: Auto refreshing the form in X++

    Hi Bharani,

    Getting error on this also.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at
    RE: Auto refreshing the form in X++

     Please check this article and see if it works for you.

    arbistech.com/.../

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    RE: Auto refreshing the form in X++

    First let's make the code error free. I don't understand why you have opened and closed the brackets at line 31 and 34.

    Also you are directly calling like TimeControl.method() but can you show me where did you defined the class object.

    If all the error goes then do a build and check.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans