I have a complex question here, and I am not sure if I could explain this clearly enough.
(Version:NAV 2013 R2)
My customer want to achive this:
When the user open the Sales Order, click a [Select Item] button, I need to open a external website(Let's Call it "PHP") to let user to select Items in that website. and of course the same Item Master data is also exist in NAV too, but customer insist want to do that because they thought the way to select Item is a little tricky not just like select a Item in NAV Item List. We may just do not discuss whether the requirement is correct or not. Let us discuss how I could achive this.
My consideration:
I need to let the "PHP" know the exsiting sales line items, so "PHP" page could show the exist Items and let user to add delete or modify Items in "PHP" page, after that, click submit in "PHP", I should update my Sales Line with the selection and update the page.
My Concern:
I need to know if user closed the "PHP" page or if they clicked submit and "PHP" server also want to give me a result(like "OK" or "NG"), so use HYPERLINK in NAV is not going to work, because once system open the "PHP" page with IE(default browser), I will totally lost control of that page.
My solution:
Create a DLL with C#, when user click [Select Item] , call DLL to open a .NET Form with a webbrower, in that webbrower, send a URL to "PHP" server(Like "
http://www.php.net/SelectItem.php?SO=000001"), when "PHP" server get this request, fetch the sales line info from NAV via Web service and show that in
http://www.php.net/SelectItem.php, which is also in my webbrower.When user click submit in "PHP" page, "PHP" server update my sales line via web service and send a response to my webbrower, and then I update the webpage.
This is a big challenge for me, could anyone tell me if the solution is achievable? And if it is not, could you tell the reason why it is not, so I can use that to negotiate with my customer?
By the way, actually, I have already achived this:
When user click "Select Item" in Sales Order, I use HYPERLINK to open the page of "PHP", "PHP" server fetch the sales line info from NAV via Web service and show that in
http://www.php.net/SelectItem.php, after user finished the Item selection and click "Submit" button, "PHP" server update my sales line via web service.
Question is, after that, user need to click another button [Get Item Selection] to refresh the page,not refresh the page automatically.
Answers
Welcome from Mibuso. I think your problem is not related with navision. I try to give best solution for you.
I think this is not make sense for me. I saw a lot of web site develop with php and we can select item.(eg. online shopping). The only different is using MySQL or SQL database and using web service. Difficult to maintenance if you use your own dll file. Eg you need to install your dll file to all client who use your web site and how do you handle if they plan to use it from their home laptop or desktop.
so use GG for best solution. You need to write sample web for item browser and get the selected item from calling parent php page without using the web service.
I don't know about the php but I used the jquery/ajax for refresh page or event when i develop the asp.net. I believe your issue can be solve by jquery. Here is ans on stackoverflow link : http://stackoverflow.com/questions/4670970/use-jquery-ajax-to-refresh-php-data-on-same-page
Hope this help to you.
Regards,
Yukon
From your reply, I think I need to add some explaination.
1.Yes, make DLL is a painful thing, but it still be acceptable, because I only need to install it in several terminal server who run window client. And if the whole solution is not acceptable, I am glad to giveup.
2.There is one more thing I need to make clear is [Select Item] means:usually, we add sales line by select type=Item, and select Item No. ,but this time, cutomer want to select mutli Items from PHP web page(their existing web site for Sales and Purchase), and then I get the user selection and insert to NAV Sales Line.
And of course, user could add/modify/delete the sales line directly from NAV too, so next time when the user want to select Item in PHP page for that order again, the PHP server must know what existing sales line of that order are.
3.I am not responsible for the PHP, I only need to tell them how to access to NAV by Web service. So the PHP part is not what I am concerned.
4.What do you mean by "GG"? Sorry I am not familiar about it.
5.The most import thing is "Could I open a web page of external website(In NAV, or in .NET) and know if it is closed/submited/even get the response from external website's". By use HYPERLINK, I can open a web page, but can not control it. By use HttpWebRequest,HttpWebResponse in .NET, I can get the response from web server, but there is no webpage opened.
Most ideal thing for me is open a web page(external website) from NAV, website get data from NAV and show them in that page, user do some operation in that page, click "submit", website update NAV data via webservice and tell me "it is done", then I refresh NAV page.
Could someone tell me is it possible or not, "It is not achievable" is also a good answer for me too.
Sorry I did not make myself clear enough.
I mean I need user to refresh NAV page manually after external PHP server updated NAV sales line via web service. That is why I need a tech. to sense if user close the PHP page or submitted it in NAV.And it seems impossible in NAV, so I consider about C#.
I awear that DLL will bring me extra task during implementation, but I have to deal with it now .Good thing is I only need to install DLL in several terminal server.
Another thing is I am not responsible for PHP, what I concern is only how I could open a external web page and sense if it is closed or submitted so I can update my NAV page automatically, also,when the external web page is open,I could lock my NAV page to prevent inconsistence.
Now i understanding after you explain me again. Nav page cannot be know external web site page is opening or closed. But i think you can use timer function on Nav Page. Here is discuss timer topic.
1. http://mibuso.com/forum/viewtopic.php?f=32&t=53528&hilit=timer
Blog :
1. Gunnar's Blog http://www.dynamics.is/?p=1036
Hope this help to you
Regards,
Yukon
It's good to know I can use timer addin in page.Cause I thought
Timer is not available in page, never considered addin.
I will try it later.
Buy the way, our application consultant came up a good simple
idea,Close the NAV sales order page when user open the PHP page,
And when user click submit in PHP page, open the NAV sales order
Page again (which will show the newest data)because We know the exact
address of that sales order.
Except when user closed IE by accident that I can do nothing about it.
Our customer accepted and satisfied with our new solution(close and reopen the nav page).
Very sorry that I saw your message now.
Actually I solved this issue by some other way, what I did is:
When I need to send data to PHP website, I save the data into a buffer table(publish as web service) and use function "HYPERLINK" to call PHP URL, when PHP got that URL(will key value in url), PHP analyse it and get data from buffer table via web service, after PHP processed, PHP will raise NAV client's URL and open particular card or list page in NAV.
When PHP need to send data to NAV, it will first save data to NAV's buffer table via web service, and then call function in NAV to process it.
When error happens in NAV, the error message will be captured by PHP and show in PHP page.
Did I make myself clear? Will this help you?