Sending ACTION::LookupOK from Page Action during RUNMODAL

robthemobbrobthemobb Posts: 12Member
edited 2018-07-16 in NAV Three Tier
Hi there!

My scenario is as follows: In PAG42 (Sales Order) in the field for customer name, I open PAG5052 (contact list) via RUNMODAL, select a contact and if the contact has a relation with a customer, I use this customer within the sales order. So far, so good. Everything works fine.
I created a new page action which should do something with this contact before passing it back to the sales order. I wonder how to tell NAV to close the contact list (which runs modal) and use the selected rec while pressing this new button. (Something like PAGE.SETACTION(LookupOK) or so )

Help is highly appreciated.

Rob

PS.: I did a workaround with an Automation (Windows Script Host Object Model'.WshShell) and "SendKeys(ENTER)" OnAction of this PageAction, but I am not satisfied with this solution.

Best Answer

Answers

  • RockWithNAVRockWithNAV Posts: 691Member
    Am sorry I didn't completely understand what you really want but RUNMODAL will always open and once you press OK then only next set of code is executed, too overcome this you need to use RUN instead of RUNMODAL.
  • robthemobbrobthemobb Posts: 12Member
    Sorry, for not being specific! I have page A from which I ran page B with RUNMODAL. In page B, I just select something from a list, press OK and the selection is returned to page A and page B closes. That works fine. Now, I added a button on page B, which should do something after I select something from the list in page B. After finishing something, the button should also behave as if I pressed OK. My intention here is to save a few clicks for the user.
  • RockWithNAVRockWithNAV Posts: 691Member
    Now, I added a button on page B, which should do something after I select something from the list in page B.

    So Whats the challenge here??

    From Page A you have a drop down which opens Page B, Now if you choose say 5 records then all key values are updated in a TextBox of Page A with comma separator and I assume its working fine. NOw while you open Page B you gave an action button and when u choose the same 5 records and push that Button in Page B it will do some sort of manipulation right and its too an easy Job. Now here once you push that Action Button in Page B You want like manipulation should happen for 5 records along with selecting these records as comma separator in Page A and eventually Page B should get closed. Is that something you really want facing challenge the very last step? Or Still I am Wrong??

    See If this is the case then Selecting the records and updating it in Page A will do your Job of Action button manipulation that you need and its easy but vice versa will be something not that straight. First you correct me if we both are on the same Page!
  • robthemobbrobthemobb Posts: 12Member
    Now, I added a button on page B, which should do something after I select something from the list in page B.

    So Whats the challenge here??

    There is no challenge at all. Also its not what happens with the records I like to use in page B and the action behind the button.

    Normally the user hits OK, clicks the X of the window or presses ESC or Enter and one of various return values are returned to page A.
    My question: Is there a way to close page B also with this button I added in page B and returning LookuoOK? For now, I did a workaround with an Automation Variable which mimics pressing Enter, which returns LookupOK. And the code works fine. But isn't there a more elegant way to do it?

    Action Button in page B:
    MyAction - OnAction()
    // Do some stuff, the button is inteded to do
    CREATE(WshShell,FALSE,TRUE);
    WshShell.SendKeys('{ENTER}')
    

  • robthemobbrobthemobb Posts: 12Member
    That's what I thought but didn't hope! Thank you for your thoughts anyway!
Sign In or Register to comment.