Skip to Content
0
Former Member
Jan 11, 2004 at 09:31 AM

Why can't I load system form as xml file (with LoadBatchAction method)?

157 Views

As promissed in the webex session here is the answer to this question:

The partner had complained that after saving a system form as xml file he is not able to load it to

SAP Business One application using the method: LoadBatchAction.

In order to be able to load a system form from an xml file, first you have to update the unique ID (@uid) node value (in the xml string).

For example please look at the code below:

I've saved order form as an xml file (with GetAsXml method) and call the file "OrderXML.xml".

In order to load this form I use the following code:

Dim Strxml As String

Set oXMLDoc = New MSXML2.DOMDocument

oXMLDoc.Load ("C:KnowledgeBaseMikCOM UILoadXMLFrmWithMtxOrderXML.xml")

'In the following line I update the Unique ID node in the xml file

oXMLDoc.selectSingleNode("Application/forms/action/form/@uid").nodeValue = "MyOrderFrm"

m_App.LoadBatchActions oXMLDoc.xml

'Notice that you refer to the same unique id you've updated the xml with

Set Frm = m_App.Forms.Item("MyOrderFrm")

one more tip:

If you want to be able to have more than one instance of a form at the same time -each one of the instances must have a different Unique ID. You have to manage it by yourself.