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 GP (Archived)

within the macro conditional

(0) ShareShare
ReportReport
Posted on by 150

I created a macro within GP, just let me know if you can put any command that serves as a conditional, making the action of a message displayed or not do the action if it is not, I hope can help me. thank you

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mahmoud Saadi Profile Picture
    32,738 on at
    RE: within the macro conditional

    Hello,

    Of course you can, not through the usual Mail Merge functionality with a word document, but through Excel by making use of the various function to end up with a dynamics macro generator rather than a static code. 

    Imagine you want to create one macro to import a set of receivable transactions which could be an invoice, credit memo, debit memo. You may have multi-currency,  different cases which sometimes may pop up a window or warning message and other times won't. With Excel, all of the above can be considered in a Dynamic method to create a smart code generator.

    That was the basic essence of the series I started recently; Macro Generator Essentials Series. The series started with the Analytical Accounting Journals on the General Ledger level. Further templates are to be provided to cover the various standard modules (POP, SOP, RM, PM, IV ..etc)

    If you need further assistance, please let us know

    Your feedback is highly appreciated,

  • Ingeniero alcantara Profile Picture
    150 on at
    RE: within the macro conditional

    thank you very much

    what I want is something like an if or else within the macro GP thus be able to carry out the action to give clikc if it emerges that window or continue with another action if not leave this window.

  • Mahmoud Saadi Profile Picture
    32,738 on at
    RE: within the macro conditional

    that's exactly what I am talking about, let me give you a very simple example to clarify the idea. Suppose you want to create a macro to inactivate accounts, it is taken into consideration that accounts with a current balance will pop up a warning message stating that "the account has a current balance, do you want to proceed", you will have to press "Yes" and proceed. Otherwise, if the account has a zero balance, no window will pop up at all.

    In this essence, the macro should anticipate when to include the code of the new warning window, while other times it should not. See how this can be built in Excel

    As you can see, the data has the fact whether the account has a current balance or not, sometimes it is a "Yes", and other times is "No"

    Excel gives you the capabilities to include a function within your code to either run handle the window or not.  So the condition is:

    IF Current Balance =  "Yes"
    THEN 
    " 
    # This account has a current balance.  Are you sure you want to inactivate it?   
    NewActiveWin dictionary 'default'  form DiaLog window DiaLog 
      ClickHit field OK 
    NewActiveWin dictionary 'default'  form 'GL_Account_Maintenance' window 'GL_Account_Maintenance'  
    "
    ELSE 
    " "
    



    After all when you copy the data from the column, the code will be generated properly according to the functions and conditions you have included in your Excel

    Again, that's the core essence of the Macro Generator Essentials Series, to provide a dynamic way of generating macro in order to handle the various cases in your data, several templates have been built and will be published online for the community soon. Imagine building a validation layer to clean your data before being imported into Dynamics GP, it would be definitely a good approach to consider with a huge amount of data.


    Your feedback is highly appreciated,

  • Ingeniero alcantara Profile Picture
    150 on at
    RE: within the macro conditional

    The code I'm getting a GP is as follows:

    # DEXVERSION=11.00.0349.000 2 2

    CheckActiveWin dictionary 'Manufacturing'  form 'WO_Edit' window 'WO_Edit'

     CommandExec form BuiLtin command cmdEditPaste

     TypeTo field '(L) Temp Manufacturing Number' , 'OP0000064677'

     MoveTo field '(L) Temp Control Number'

    IF (L) Temp Control Number = "100"

    THEN

    "

    # Esta secuencia ha sido marcada como Hecha. A menos que sea para reflejar los datos actuales desde el piso de la planta, esta secuencia no se debe cambiar.

    NewActiveWin dictionary 'Manufacturing'  form DiaLog window DiaLog

     ClickHit field OK

    NewActiveWin dictionary 'Manufacturing'  form 'WO_Edit' window 'WO_Edit'

    "

    ELSE

     TypeTo field '(L) Temp Control Number' , '700'

     MoveTo field rtseqdes

     MoveTo field 'Labor Code'

     TypeTo field 'Labor Code' , 'HRS IMPROD'

     MoveTo field LaborTime

     MoveTo field 'Labor Code2'

     TypeTo field 'Labor Code2' , 'HRS IMPROD'

     MoveTo field 'Number of Employees'

     MoveTo field MachineTime

     MoveTo field 'IC_Save_T'

     ClickHit field 'IC_Save_T'

    # El tiempo de ciclo programado para esta secuencia es cero. ¿Desea guardar esta configuración?

    NewActiveWin dictionary 'Manufacturing'  form DiaLog window DiaLog

     ClickHit field OK

    NewActiveWin dictionary 'Manufacturing'  form 'WO_Edit' window 'WO_Edit'

     MoveTo field 'IC_Clear_T'

     ClickHit field 'IC_Clear_T'

    Thus the shaded part is what I want this to be caught within me out or not.

  • Ingeniero alcantara Profile Picture
    150 on at
    RE: within the macro conditional
    Anyone can help me, I need to create a macro within GP, where I want to put a condition in which if goes perform the action corresponding window but if I do not get the window to continue with what follows the popup . I hope someone can help.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans