I have a requirement to be able to create a PO using certain values from a work order, and then navigate to that newly created PO. The user will perform some actions, and then return to the WO. I was able to script most of this, with the exception of getting both halves of the navigation to work. I can either navigate to the PO app list page, with a successful return link, or I can navigate to the specific PO, but the return link is missing. Can anyone compare the two script snippets and let me know of a way to get both the "navigate to the specific PO" and the "return to work order" link to work?
Snippet 1 - Navigate to the PO list page, with successful return link.
wcs = service.webclientsession();
wce = wcs.getOriginalEvent();
appl = wcs.getCurrentApp();
e = WebClientEvent("gotoapp", None, "PO", wce.getSessionContext());
se = WebClientEvent("execevent", wce.getSessionContext().getCurrentAppId(), e, wce.getSessionContext());
appl.put("returninputR/O", "true");
Utility.sendEvent(se);
Code Snippet 2 - Navigate to the Specific PO, but no working return link
wcs = service.webclientsession()
wce = wcs.getOriginalEvent()
appl = wcs.getCurrentApp()
appstr = str(appl)
se = WebClientEvent("changeapp", appstr, "PO", None, None, None, newPOID, wcs)
appl.put("returninputR/O", "True")
Utility.sendEvent(se)
Thank you in advance for any suggestions.
Does anyone know if the 2nd arg (targetID) in the webClientEvent is just the name of the current app, or something else? The string version of the output to wcs.getCurrentApp() (appl above) works, as does "WOTRACK", but neither seems to have any effect on the result.