Options

Calling a page via an automation variable.

navgirl1981navgirl1981 Member Posts: 12
edited 2013-04-03 in NAV Three Tier
I have some code that calls a page pased off some setup in a table.
This worked fine in 2009Sp1, however I have an issue with R2.
When running this in R2 my nav crashes.
Any idea of what could be causing this.
Code is below.

Thanks


CREATE(wSHShell,FALSE,TRUE);
wSHShell.Run('Microsoft.Dynamics.Nav.Client.exe dynamicsnav:////runpage?page='+FORMAT(SPage)+
'&bookmark='+Bookmark+'&mode=edit',dint,modal_);

where
wsHShell is an automation variable
'Windows Script Host Object Model'.WshShell

Comments

  • Options
    navgirl1981navgirl1981 Member Posts: 12
    On a different note I was able to get that far


    HyperlinkTxt :='"C:\Program Files (x86)\Microsoft Dynamics NAV\60\RoleTailored Client R2\Microsoft.Dynamics.Nav.Client.exe"';
    wSHShell.Run(HyperlinkTxt,dint, modal_);

    The above works fine.
    Now I need to open page 30 so I added the following code

    HyperlinkTxt+=':////runpage?page='+30;

    Now it crashes. Any ideas ??

    Thanks
  • Options
    ara3nara3n Member Posts: 9,256
    try this

    wSHShell.Run('DynamicsNAV:////runpage?page=50131');
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    navgirl1981navgirl1981 Member Posts: 12
    Thanks for your reply.
    Here is my issue.
    I am running this via NAV.
    I have a custom page that returns a lot of values along with a page ID and a bookmark value.
    In 2009 SP1 I was able to run this page and run the following code


    wSHShell.Run('Microsoft.Dynamics.Nav.Client.exe dynamicsnav:////runpage?page='+FORMAT(SPage)+
    '&bookmark='+Bookmark+'&mode=edit',dint,modal_);

    This would open up the corresponding page withe the correct record showing.
    When I run this via NAV, it tries to obviously open up another session and nav crashes. Do you have any other suggestions on how to accomplish this so I can open the correct page and nav not to crash ??
    This is NAV 2009 R2..

    Thanks
  • Options
    ara3nara3n Member Posts: 9,256
    my guess the url or bookmark you are adding has changed. I suggest to manually create the URL from a nav page and compare it to the one you are creating in code.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    navgirl1981navgirl1981 Member Posts: 12
    That could be the case but even when I run the code without the Bookmark but just the page my NAV still crashes.
  • Options
    ara3nara3n Member Posts: 9,256
    I think you are running my code wrong.


    SHShell.Run('dynamicsnav:////runpage?page='+FORMAT(SPage)+
    '&bookmark='+Bookmark+'&mode=edit',dint,modal_);
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    navgirl1981navgirl1981 Member Posts: 12
    I copied and pasted tje same exact statement as you had typed it and my nav crashed.

    Maybe I need to explain my issue here.
    I have a page in NAV that has logic to do a massive search.
    I have some supporting tables where they user can define the tables and fields they want to search on.
    So in this page they enter a value they want to search for and based of the info they enter I give them a list of all the possible matches.
    For example if they type 'test' and want to look at all customers, items with that name and External document number on the sales order with that value I display all of my results in subpage.
    I am saving the bookmark, the table ID and page number to run .
    When they find the record on the subpage and they want to go to that record whether the customer card, item card or Sales header card, I call the code above to take them to that record.
    SO I am calling the above code via a page to open another page. This used to work great in NAV2009 SP1, however crashing on R2.
    There is smth different and I have spent a lot of time trying to figure out and can not get anywhere...
    Does the above make sense ??
    As always I really appreciate your input and thank you for all the help so far..
    It seems to me that maybe it is not possible to open another isntance of NAV RTC from a page ? Could that be the issue ? When I call the function with just the page number with no bookmark it still crashes. When I run the code in the command line if I have NAV open it crashes , however If NAV is closed it calls the page.
    Thanks
Sign In or Register to comment.