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

Q1IM: Fullsync Flag not Recognized in Process Head Generating Condition

Hello all,

I'm currently working on debugging a synchronization script for a connected system. At one point during the script, role assignments in the connected system are reconciled with our representations of the role assignments (stored in the UNSAccountBInUNSGroupBTotal table); the goal here is to recondile any access to roles added outside the IDM system. When the sync process isn't running, any insert into this table will fire a process called "AJG_JDE_AddRoleAssignment", which will in turn trigger a web service call to the connected system to add the role assignment to the user. Obviously, during the sync, we don't want the web service call to fire since it will attempt to add access already reflected in the target system, so our solution was to set the "FULLSYNC" flag in the sync script as follows (NOTE: We are placing role assignments added through the sync into the "UNSAccountBInUNSGroupB" table rather than in the total table for auditing purposes, but the insert there ultimately triggers an insert into the total table):

'Set FULLSYNC flag to True to avoid process generation during save

Connection.Variables("Fullsync") = "true"

Connection.BeginTransaction()

Try

Dim newRoleAssignment As ISingleDbObject = Connection.CreateSingle("UNSAccountBInUNSGroupB")

newRoleAssignment("UID_UNSGroupB").NewValue = workingIDMRole.GetValue("UID_UNSGroupB").String

 newRoleAssignment("UID_UNSAccountB").NewValue = IDMUser.GetValue("UID_UNSAccountB").String

 newRoleAssignment.Save()

 Connection.CommitTransaction()

 Connection.Variables.Remove("Fullsync")

          

Catch ex As Exception

If Connection.TransactionOpen Then

Connection.RollbackTransaction()

End If

AJG_Connected_JDE_Sync_WriteLog(StartTime,MsgSeverity.Warning, String.Format("The assignment of the {0} {1} could not be committed to the database - Instance: {2}, UserID: {3}", roleType, workingJDERole.RoleName, localInstanceName, JDEUser.UserID))

Connection.Variables.Remove("Fullsync")

End Try


The process head for "AJG_JDE_AddRoleAssignment" (Table: UNSAccountBInUNSGroupBTotal; Event: INSERT_SYNC) contains the following generating condition:

Value =

Not CBool(Connection.Variables("FULLSYNC")) _

AndAlso $FK(XProxyContext).NamespaceManagedBy$ = "Generic" _

AndAlso Not $FK(XProxyContext).IsNoWrite:Bool$ _

AndAlso $XProxyContext$.StartsWith("JDE_") _

AndAlso Not String.Equals($FK(UID_UNSGroupB).AJG_CustomAttribute03$, "D", StringComparison.InvariantCultureIgnoreCase)

The problem here is that the process is generating each time, regardless of the generating condition, triggering an unwanted web service call. What are we doing wrong?

Parents
  • The lifetime and visibility of a connection variables is limited to a specific connection. When you have two different processes, even two different process steps, they will have seperate connections and therefore can not see the connection variables from each other.

    This is by design. The global variables are connection global, not system global.

  • I encountered exactly the same problem.

    I'm trying to insert a record into UNSAccountBInUNSGroupB table without triggering event. 

    My test code is very simple

    Connection.Variables.Put("FULLSYNC", True)
    Variables.Put("CSVImport", True)
    Dim link As ISingleDbObject = Connection.CreateSingle("UNSAccountBInUNSGroupB")
    VID_PutValueSafe(link, "UID_UNSGroupB", "3618854d-50f7-46c3-8e2d-9564e75631f8")
    VID_PutValueSafe(link, "UID_UNSAccountB", "8eb7a3f7-21c0-41c9-ad85-2d7d2c0e89e2")
    link.Save()
    'Connection.Variables.Remove("FULLSYNC")

    but event is still triggered . 

    I realize that I can extend UNSAccountBInUNSGroupB table, add some column that I will fill in my code and analyze later, but I hope that there is a better solution

    Also I looked into [TSB_TIUNSAccountBInUNSGroupB] trigger and I don't see that it analyzes FullSync variable (e.g. in [SAP_TISAPUserInSAPRole] trigger there is a code that seems to analyze it)

Reply
  • I encountered exactly the same problem.

    I'm trying to insert a record into UNSAccountBInUNSGroupB table without triggering event. 

    My test code is very simple

    Connection.Variables.Put("FULLSYNC", True)
    Variables.Put("CSVImport", True)
    Dim link As ISingleDbObject = Connection.CreateSingle("UNSAccountBInUNSGroupB")
    VID_PutValueSafe(link, "UID_UNSGroupB", "3618854d-50f7-46c3-8e2d-9564e75631f8")
    VID_PutValueSafe(link, "UID_UNSAccountB", "8eb7a3f7-21c0-41c9-ad85-2d7d2c0e89e2")
    link.Save()
    'Connection.Variables.Remove("FULLSYNC")

    but event is still triggered . 

    I realize that I can extend UNSAccountBInUNSGroupB table, add some column that I will fill in my code and analyze later, but I hope that there is a better solution

    Also I looked into [TSB_TIUNSAccountBInUNSGroupB] trigger and I don't see that it analyzes FullSync variable (e.g. in [SAP_TISAPUserInSAPRole] trigger there is a code that seems to analyze it)

Children
  • The FullSync variable did never suppress the event generation in general. You can use the variable in the gen.condition of your processes to suppress the process from being generated.

    And you are looking in the wrong place honestly. The whole process generation is part of the object layer and not part of the triggers.

  • Sorry, 

    I used the wrong words. I'm fine with event generation, but I don't want the corresponding process to run.

    I did not customize the process, so the default VI_UnsAccountInGroup_Generic_Add is used (I can see it Job Queue)

    It has 

    Value = Not CBool(Connection.Variables("FULLSYNC")) _
    AndAlso $FK(UID_UNSAccountB).FK(UID_UNSRootB).NamespaceManagedBy$ = "Generic" _
    AndAlso Not $FK(UID_UNSAccountB).FK(UID_UNSRootB).IsNoWrite:Bool$

    generating condition

    So the process should not start when FULLSYNC=True, but it starts.

    After setting 

    Connection.Variables.Put("FULLSYNC", True)

    in my code I perform check

    If CBool(Connection.Variables("FULLSYNC")) Then
    ...

    (copy-pasted from generating condition) 

    so I can be sure that variable is actually set (no typos in variable name or value)

  • Sounds strange to me. What version are you using?