Forum Discussion
MarcusH
Contributor III
There was an application on MarketPlace called Admin Solution Tools (AST) that has a script that deletes DM sequences. I can't find it on MarketPlace now though. That clears up DM steps and sequences using SQL statements. This is the function:
Private Function DropSolutionDM(ByVal si As SessionInfo) As String
Try
'Delete business rules associated with this app
Dim message As String = String.Empty
If BRApi.Security.Authorization.IsUserInAdminGroup(si) Then
Dim dmUniqueID As String = String.Empty
'Get UniqueID from DataMgmtGroup
Dim sql As String = "Select UniqueID From [DataMgmtSequence] Where Name Like '%(AST)'"
'Execute Query on App DB
Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
Dim dt As DataTable = BRApi.Database.ExecuteSql(dbConnApp, sql, True)
If (dt.Rows.Count > 0) Then 'Check If the DataTable returns a valid record
dmUniqueID = dt.Rows(0)(0).ToString
Else
dmUniqueID = Guid.Empty.ToString
End If
'Delete DataMgmtSeqStepMember
sql = $"Delete From [DataMgmtSeqStepMember] WHERE [SequenceID] = '{dmUniqueID}'"
BRApi.Database.ExecuteSql(dbConnApp, sql, True)
'Delete DataMgmtGroup
sql = $"Delete From [DataMgmtGroup] WHERE Name like '%(AST)'"
BRApi.Database.ExecuteSql(dbConnApp, sql, True)
'Delete DataMgmtSequence
sql = $"Delete From [DataMgmtSequence] WHERE Name like '%(AST)'"
BRApi.Database.ExecuteSql(dbConnApp, sql, True)
'Delete DataMgmtStep
sql = $"Delete From [DataMgmtStep] WHERE Name like '%_AST'"
BRApi.Database.ExecuteSql(dbConnApp, sql, True)
End Using
Else
message = "Security Error: Adminstration Rights Required to Execute Uninstall"
End If
Return message
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, "Unhandled Exception in DropSolutionDM() function.", ex.Message, ex.InnerException))
End Try
End Function
Gabriel_08
9 months agoNew Contributor
Thank you so much! Will let you know if the code worked.
Related Content
- 7 months ago
- 11 months ago
- 4 months ago