This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DPRObjectOperation objects are not created when creating sync Projects from custom templates

Hi people,

this is a known issue which is described in this link. Basically DPRObjectOperations are not created when creating synchronisation projects from custom templates, which means AdHoc Provisioning Processes do not work unless the provisioning process operation objects are created.

If you are experiencing this issue right now, I wrote a script which will automatically create the necessary DPRObjectOperation objects for a given Namespace (currently ADS, EX0 and SAP). I thought I'd give back to the community, I hope you can make good use of the script. Feedback on this subject greatly appreciated.

Cheers,

Ryu

Public Sub CCC_Set_AllDPRObjectOperationsForTargetSystem(ByVal dprShellDisplayName As String,
                                                         ByVal targetSystem As String,
                                                         Optional ByVal provisioningName As String = "Provisioning",
                                                         Optional ByVal eventTypes As String = "Insert,Update,Delete",
                                                         Optional ByVal deleteDuplicates As Boolean = False)

    '==========Note to User==========
    ' Use script to create DPRObject Operation types for a namespace and Synchronisation Project e.g. ADS, SAP or EX0 
    ' Open a new connection in designer to check that the DPRObjectOperation Objects have been created

    ' ===For Example CCC_Set_AllDPRObjectOperationsForTargetSystem("SAP Connector(ABC - 404)", "SAP", Nothing, Nothing, Nothing)
    ' In the above example, the "Provisioning" workflow in the synchronisation project "SAP Connector(ABC - 404)" will be used for "Insert", "Update" and "Delete" operations

    ' ===For Example CCC_Set_AllDPRObjectOperationsForTargetSystem("Active Directory Connector (XYZ)", "ADS", Nothing, "Insert,Update", Nothing)
    ' In the above example, the "Provisioning" workflow in the synchronisation project "Active Directory Connector (XYZ)" will be used for "Insert" and "Update" operations

    ' ===For Example CCC_Set_AllDPRObjectOperationsForTargetSystem("Active Directory Connector (XYZ)", "ADS", "Delete", "Delete", True)
    ' In the above example, the "Delete" workflow in the synchronisation project "Active Directory Connector (XYZ)" will be used for "Delete" operations.
    ' Furthermore duplicate entries of entries to be created found in the table DPRObjectOperation will be removed before creating the new entry.
    '================================

    Dim f As ISqlFormatter = Session.SqlFormatter
    Dim whereClause As String = String.Empty

    ' Get UID_DPRShell (Sync Projects)
    Dim uidDPRShell As String = String.Empty
    whereClause = f.Comparison("DisplayName", dprShellDisplayName, ValType.String, CompareOperator.Equal, FormatterOptions.IgnoreCase)

    If Not Session.Source.TryGetSingleValue("DPRShell", "UID_DPRShell", whereClause, uidDPRShell) Then
        Throw New Exception("Could not retrieve a valid UID_DPRShell (Sync Project) from DPRShell by using the condition: DisplayName = " & whereClause)
    End If

    ' Get DPRSystemConnection (Connections) using DPRShell
    Dim uidDPRSystemConnection As String = String.Empty
    whereClause = f.AndRelation(
				  f.UidComparison("UID_DPRShell", uidDPRShell), 
				  f.Comparison("Name","ConnectedSystemConnection", ValType.String))

    If Not Session.Source.TryGetSingleValue("DPRSystemConnection", "UID_DPRSystemConnection", whereClause, uidDPRSystemConnection) _
    Then
        Throw New Exception("Could not retrieve a valid UID_DPRSystemConnection (Connections) from DPRSystemConnection by using the condition: UID_DPRShell =" & whereClause)
    End If

    ' Get DPRProjectionConfig (Workflows) using DPRShell
    Dim uidDPRProjectionConfig As String = String.Empty
    whereClause = f.AndRelation(
                        f.UidComparison("UID_DPRShell", uidDPRShell),
                        f.Comparison("Name", provisioningName, ValType.String, CompareOperator.Equal, FormatterOptions.IgnoreCase)
                        )

    If Not Session.Source.TryGetSingleValue("DPRProjectionConfig", "UID_DPRProjectionConfig", whereClause, uidDPRProjectionConfig) Then
        Throw New Exception("Could not retrieve a valid UID_DPRProjectionConfig (Workflow) from DPRProjectionConfig by using the condition: " & whereClause)
    End If

    ' Create a list of relevant DialogTables for Namespace
    Dim uidDialogTable As String() = Nothing
    Select Case UCase(targetSystem)
        Case "ADS"
            uidDialogTable = {"ADS-T-ADSAccount",
                              "ADS-T-ADSContact",
                              "ADS-T-ADSContainer",
                              "ADS-T-ADSDomain",
                              "ADS-T-ADSGroup",
                              "ADS-T-ADSMachine",
                              "ADS-T-ADSPolicy",
                              "ADS-T-ADSPrinter"}
        Case "EX0"
            uidDialogTable = {"EX0-T-EX0DL",
                              "EX0-T-EX0MailBox",
                              "EX0-T-EX0MailContact",
                              "EX0-T-EX0MailUser"}
        Case "SAP"
            uidDialogTable = {"SAP-T-SAPComFax",
                              "SAP-T-SAPComPhone",
                              "SAP-T-SAPComSMTP",
                              "SAP-T-SAPUser",
                              "SAP-T-SAPUserExtId",
                              "SAP-T-SAPUserHasLicence",
                              "SAP-T-SAPUserHasParameter",
                              "SAP-T-SAPUserInSAPGrp",
                              "SAP-T-SAPUserInSAPMandant",
                              "SAP-T-SAPUserInSAPProfile",
                              "SAP-T-SAPUserInSAPRole"}
        Case Else
            Throw New Exception(String.Format("Cannot create DPRObjectOperation objects for Target System""{0}"" . " &
                "Please add target system definition to the script ""CCC_Set_AllDPRObjectOperationsForTargetSystem""", targetSystem))
    End Select

    ' Create Operation Types
    Dim operationTypes As String() = eventTypes.Split({","}, StringSplitOptions.RemoveEmptyEntries)
    For Each operation In operationTypes
        For Each table In uidDialogTable
            ' Create object to be committed
            Dim dprobjectOperation As IEntity = Session.Source.CreateNew("DPRObjectOperation")
            dprobjectOperation.PutValue("UID_DialogTable", table)
            dprobjectOperation.PutValue("UID_DPRProjectionConfig", uidDPRProjectionConfig)
            dprobjectOperation.PutValue("UID_DPRSystemConnection", uidDPRSystemConnection)
            dprobjectOperation.PutValue("Name", operation)
            dprobjectOperation.PutValue("DisplayName", operation)
            dprobjectOperation.PutValue("Description", "Default operation generated by CCC_Set_AllDPRObjectOperationsForTargetSystem")

            ' Check for duplicate
            Dim duplicateExists As Boolean = False
            Dim duplicate As IEntity = Nothing
            Dim qDuplicate = Query.From("DPRObjectOperation").Where(f.AndRelation(
                                                                    f.UidComparison("UID_DialogTable", table),
                                                                    f.UidComparison("UID_DPRProjectionConfig", uidDPRProjectionConfig),
                                                                    f.UidComparison("UID_DPRSystemConnection", uidDPRSystemConnection),
                                                                    f.Comparison("Name", operation, ValType.String,
                                                                                 CompareOperator.Equal, FormatterOptions.IgnoreCase))) _
                                                             .SelectAll
            If Session.Source.TryGet(qDuplicate, EntityLoadType.Interactive, duplicate) Then
                duplicateExists = True
                If deleteDuplicates Then
                    Using uow As IUnitOfWork = Session.StartUnitOfWork
						duplicate.MarkForDeletion()
                        uow.Put(duplicate)
                        uow.Commit
                    End Using
                    duplicateExists = False
                End If
            End If

            ' Create DPRObjectOperation Object
            If Not duplicateExists Then
                Using uow As IUnitOfWork = Session.StartUnitOfWork
                    uow.Put(dprobjectOperation)
                    uow.Commit
                End Using
            End If
        Next
    Next

End Sub

Parents Reply Children
No Data