Hello All,
Greetings !!!
Kindly Find the attached code to Load Multiple instances of Same form in SAP Business One to Avoid "Form Already Exist Error".
#Region "Load Form"
'To Load Form in SAP Business One
Sub LoadForm(ByVal XMLFile As String, ByVal FormType As String, ByVal FormUID As String, Optional ByVal FileType As ResourceType = ResourceType.Content)
Try
Dim xmldoc As New Xml.XmlDocument
Dim Streaming As System.IO.Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Simple_Form." + XMLFile)
Dim StreamRead As New System.IO.StreamReader(Streaming, True)
xmldoc.LoadXml(StreamRead.ReadToEnd)
StreamRead.Close()
Dim r As New Random
r.Next(1000)
If Not xmldoc.SelectSingleNode("//form") Is Nothing Then
xmldoc.SelectSingleNode("//form").Attributes.GetNamedItem("uid").Value = xmldoc.SelectSingleNode("//form").Attributes.GetNamedItem("uid").Value & "_" & r.Next
GOD_Main.GOD_Application.LoadBatchActions(xmldoc.InnerXml)
End If
Catch ex As Exception
GOD_Main.GOD_Application.MessageBox(ex.Message)
End Try
End Sub
#End Region
Thanks and Regards,
Mahendrakumar