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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Query prompt Ignore while a opening worker form in D365FO

(0) ShareShare
ReportReport
Posted on by 1,215

Hi all,

I have a in HCMWorker form taps in custom Enquiry form.

I need direct to fetch data based on worker.

Query should be for main inquiry for all workers but when we are selecting one worker it should be show data direct.

My custom enquiry code.

public void init()
{


super();
qr  = new Query(queryStr(HcmWorkerListPage_ActiveCurComp));
qrun = new QueryRun(qr);
if(MPParameters::find().ShowTBQuery)
{
    qrun.prompt();
}

xSysLastValue::getLast(this);



}

As i mentioned the code only work when i directly open to inquiry. and if i select HcmWorker form against then select that popup showing how to handle ?

Give me example.

Thanks 

I have the same question (0)
  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    The process is simple if the selected record will always be used when it comes from the form.

    Fill in the datasouce in the properties in the menuitem and in second form if caller.Record is full then don't run promt. When it comes from another object, the prompt will work because the record will be empty.

    If you want it to work two different ways from one form, things are a little more complicated.

    In first form send record only if record is selected and in second form if caller.Record is full then don't run promt

    You can do the same control by sending parameters or adding more than one button.

    After all, the important thing is, when the button is pressed in the first form, does the user want use the selected record or does he/she want to see the prompt.

    Since it is relatively difficult to send records from listpage, it is easiest to use two menuitems, fill in the datasouce in the properties in one of the menuitems and leave it blank in the other.

  • Riyas ahamed F Profile Picture
    1,215 on at

    Thanks for replay sir,

    1.8764.Pic1.PNG

    The "MPWorkerTrailbalance" form has in prompt

    Same i did it as u said datasource.

    2. Only according to click worker against  then select MPWorkerTrailbalance form don't show prompt otherwise it will show.

    The data source is not working still prompt opening.

    In your second step give me example for that.

  • Riyas ahamed F Profile Picture
    1,215 on at

    Sir i did it below its worked for me.

     public void init()
        {
            super();
            qr  = new Query(queryStr(HcmWorkerListPage_ActiveCurComp));
            qrun = new QueryRun(qr);
            if(MPParameters::find().ShowTBQuery)
            {
                if(element.args().caller())
                {
                   // qrun.prompt();
                }
                else
                {
                    qrun.prompt();
                }
            }
        
            xSysLastValue::getLast(this);

    But i don't like if as an empty. so the same procedure how will you handle ?

  • Verified answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    public void init()
    {
        super();
        qr  = new Query(queryStr(HcmWorkerListPage_ActiveCurComp));
        qrun = new QueryRun(qr);
        if(MPParameters::find().ShowTBQuery)
        {
            if(!element.args().caller())
            {
                qrun.prompt();
            }
        }
    
        xSysLastValue::getLast(this);
    }

    You can use as above but in this case promt will not work when called from any object. That's why I recommended you to use record.
    You can go one step further and see which table the record belongs to.

  • Riyas ahamed F Profile Picture
    1,215 on at

    Thanks sir, leant one things!

  • Riyas ahamed F Profile Picture
    1,215 on at

    Sir I have a small doubt.

    I'm not added rage for worker, based on the menu item.

    but I don't know how its working but worker filter  working fine for me.

    Then again I come thread I saw in your one point "The process is simple if the selected record will always be used when it comes from the form."

    Note : its not about prompt its how its filter based on enquiry o didn't do any ranges.

    Would be great if you could specify if I got replay i will learn one about your replay.

    Thanks for your attention.    

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    This relationship comes through tables or EDTs. (You probably know as dynalinl). You can find out more by researching Dynalink.

    In Ax 2012, if you right click/personalize on the relevant form and go to the Query tab, you can see the relationship.

    pastedimage1624550344390v1.png

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 671

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 621 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 589 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans