RonCK - Wednesday, January 20, 2010 2:42 PM:
I have an external html/javascript form that is able to update existing parts using the IOM. This form currently crashes if it is called on a new part that has not been saved yet. I thought at first this was because I was doing a query for the item_number which doesn't even get set until a part is saved initially. To get around that I changed the handle passed to the child form to be the part id. This also fails, and it appears that it is because the record really doesn't exist in the database until it is initially saved. Any suggestions how to get around this? I'd like to be able to enter a full set of data from my child forms on the initial save of a part.
Thanks,
RonCK
RobMcAveney - Wednesday, January 20, 2010 2:58 PM:
The item only exists in the client cache until it is saved, so you definitely won't find it in the database. If your external html is running inside the client (like on a tab or something) you should be able to update it before it's saved. If your html is completely outside the client (like a separate web page) then I don't think you'll be able to do it due to security restrictions between browser windows. Let me know where it's running and I'll try to point you in the right direction.
Rob
RonCK - Wednesday, January 20, 2010 3:26 PM:
Hey Rob,
Thanks for replying. We went to external windows to speed up load times for the client pages. I believe this would make our pages outside of the client even though the pages are loaded with methods called by the client page (button on form with field method calling window.open). I know that our pages have been able to edit objects on the Aras forms using opener.document.forms searches to locate the handle for a form entry. But as you said, currently our pages are doing a separate query, modifying the queried item and applying the changes. Would it be possible to pass the handle for the object being edited instead? Or is there some way to migrate our pages to be run as part of client?
Thanks,
RonCK
RobMcAveney - Wednesday, January 20, 2010 3:53 PM:
Subscribers are reporting that recent service packs have made form loading faster. Just something to consider... :-)
If you are launching the external page from the client, then you should be in the same IE process and should be able to get back to the client cache using opener. In fact, opener.document.thisItem should give you a pointer to an IOM object representing the item. From there it should be pretty easy to get everything you need. You should even be able to modify the unsaved item, though the changes won't be shown on the original form without some extra work.
Rob
RonCK - Wednesday, January 20, 2010 3:53 PM:
Rob,
I think I got it! Basically, I tried some test code:
if(opener.document.thisItem) alert("Found the handle");
Since this worked I tried opener.document.thisItem.setProperty("name","TestPartName2");
This also worked. So, I think I may have it licked and hopefully, this will be useful to others.
Best wishes,
RonCK
RonCK - Wednesday, January 20, 2010 4:03 PM:
I have another followup question. My test part created this way is not deletable with an error I've never seen before: "Index was outside the bonds of the array." Any idea what this could mean?
Thanks,
RonCK
RobMcAveney - Wednesday, January 20, 2010 4:13 PM:
Not sure exactly what's happening, but my guess is that there's something different between the way you're changing the item and the way the standard client would. Try making the same change in the standard form and comparing thisItem.dom.xml with what your code does.
Rob
RonCK - Wednesday, January 20, 2010 5:26 PM:
Rob,
Apparently, this error is not part of the form. I can edit a part whose form I haven't touched, change nothing, select save and close and still get a new version of the part. The new version can not be deleted and shows the same error as above. While I'm doing this development in a test platform database, I'd like to see if I can figure out what else I screwed up. Where would I add thisItem.dom.xml to best see what's going on? I assume I should make some new method and add it as a formEvent. Should it be onUnload or onBeforeUnload?
thanks for all your help!
RonCK
RobMcAveney - Wednesday, January 20, 2010 5:50 PM:
Not sure how much I can help on this without being hands-on. Nothing jumps out at me as an obvious solution. If I want to inspect the dom at any point, I normally just put a button on a form with an alert or alternatively turn on script debugging and debug using Visual Studio.
Rob