Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

set focus in scrolling window POST script

(0) ShareShare
ReportReport
Posted on by 45

Hello,

I'm trying to set the focus on the distribution reference field in window 'CMTrx_Distributions' of form 'CM_Transaction_Entry' in the scrolling window POST script when the reference typed in is invalid.

This is my script declaration:

Result = Trigger_RegisterFocus(anonymous(window CMTrx_Distributions of form CM_Transaction_Entry), TRIGGER_FOCUS_POST, TRIGGER_BEFORE_ORIGINAL, script CMTrx_Distributions_Post);
if Result <> SY_NOERR then
    warning "Trigger 'CMTrx_Distributions_Post' registration failed.";
end if;

 

This is the script 'CMTrx_Distributions_Post' content:

local string strDistributionReference;

strDistributionReference = trim('Distribution Reference' of window CMTrx_Distributions of form CM_Transaction_Entry);

if empty('Account Number' of window CMTrx_Distributions of form CM_Transaction_Entry) then
    abort script;
end if;

if length(strDistributionReference) > 0 then
    clear table POP_PO;

    'PO Number' of table POP_PO = strDistributionReference;
    get table POP_PO;

    if err(table POP_PO) <> OKAY then
        if ask("Invalid reference. Do you want to continue?", "Yes", "No", "Cancel") = ASKBUTTON1 then
            run script 'Scrolling Window Expand Button' of window CM_Transaction_Entry of form CM_Transaction_Entry;
           
            focus 'Distribution Reference' of window CMTrx_Distributions of form CM_Transaction_Entry;
        end if;
    end if;
else
    if ask("Invalid reference. Do you want to continue?", "Yes", "No", "Cancel") = ASKBUTTON1 then
        run script 'Scrolling Window Expand Button' of window CM_Transaction_Entry of form CM_Transaction_Entry;

        focus 'Distribution Reference' of window CMTrx_Distributions of form CM_Transaction_Entry;
    end if;
end if;
 

 

 

 The script  'CMTrx_Distributions_Post' will verify if the reference is a valid PO number and if not the user must change the value. If this operation is repeated multiple times (PO number never exists) the new value typed in the distribution field is not available in the script, it looks like it always the initial value.

 

There's probably a synchronization issue with the scrolling window and the table buffer due to the 'focus field' I'm doing.

I was expecting the table buffer to be properly positioned in the POST script but this is not the case.

Does anyone has ever seen this situation?

 

Thank you.

Philippe

*This post is locked for comments

  • Re: Re: Re: set focus in scrolling window POST script

     Hello,

    I finally moved the trigger on the CHANGE script and used 'force change' in the PRE script.

    Thanks for your suggestion.

  • Re: Re: set focus in scrolling window POST script

     Hello Mariano,

    Thanks for your reply.

     

    In fact we need to notify the user if the field is empty or if the reference is invalid, this is why my trigger is on the POST and not the change. I was triggering on the CHANGE first but the message was not displayed for the default distribution line created when you set the amount of the transaction.

     

    I think this might be a limitation of Dexterity.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans