"Continuation" of FULLSYNC variable between process chains called from script

Hello, could someone help me, please, to correct handling of chained operations?

Let's say I have such processes:

  UNSAccountB - insert - CCC_sync_account - This process should start on initial synchronization with TS via sync. editor

  UNSAccountBInUNSGroupB - assign - CCC_assign_group - This process should start on assigning new groups to user (via manager, itshop etc.), it makes some calls to TS API via odbc connection

CCC_sync_account has it's generating condition like " * And CBool(Connection.Variables("FULLSYNC"))",

CCC_assign_group has it's generating condition like " * And Not CBool(Connection.Variables("FULLSYNC"))", meaning i don't want to run this process during initial synchronization.

Now I want to sync account group membership on initial synchronization.

So my CCC_sync_account process has step with script, that goes in For loop and inserts new UNSAccountBInUNSGroupB entities according to information from TS (obtained again with API calls)

Inserts are made with .PutValue(), UnitOfWork.Commit.

At that moment I do not want to run CCC_assign_group script (that will try to provision duplicate info to TS system), that's why I set Not CBool(Connection.Variables("FULLSYNC")) generating condition on that process.

The problem is that it seems that FULLSYNC = False at the moment when CCC_assign_group is been called, so the process starts to run despite it's not supposed to do.

That's why i've thought about "continuation" of FULLSYNC.

 

The only possible solution I see is to add some custom column to UNSAccInUNSGroup like "IsSynchoronizing", set it to True during initial synchronization and check in CCC_assign_group for that flag. Then set it to False at the end of synchronization. But i hope that there is a builtin way to solve such problems.

Thank you.

Parents
  • You can set the connection variable FULLSYNC on your own in the script, for example at the beginning. All operations originated from inside this script, including the process generation will see the variable and act accordingly. 

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

    For more information check the SDK script sample <OneIM Delivery>\Modules\QBM\dvd\AddOn\SDK\ScriptSamples\02 Database connection\04 Connection variables.vb

  • Thank you for the answer.

    I've tried to do the thing you've described, and made some logging.

    In CCC_sync_account's vb script #1 i've inserted 

    FULLSYNC is nothing
    Session.Variables.Put("FULLSYNC", True)
    FULLSYNC = True

    Later in script there is code:

    Dim aig As IEntity = Session.Source.CreateNew("UNSAccountBInUNSGroupB")
    aig.PutValue("UNSAccountB",xxx)
    aig.PutValue("UNSGroupB",yyy)
    ...
    uow.Put(aig)
    uow.Commit()

    That leads to start of CCC_assign_group proccess with script #2, binded to UNSAccountBInUNSGroupB ASSIGN event; with Not CBool(Session.Variables("FULLSYNC")) check in generating condition.

    So check on Fullsync doesn't work..

    Also, when i try to log the value of the variable at the beginnig of the script #2, it shows that Session.Variables("FULLSYNC") is Nothing

  • You can try to set the flag XOrigin=1 in addition to avoiding this. But be aware that you cannot test the script with a normal user as they are not allowed to set this flag. But it should work if the script is executed on a job server.

Reply Children
No Data