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

D1IM 7.1.2 templates are not working when creating an object via script

Hi

Since we have migrated our System from 6.1.3 to 7.1.2 we have the problem with some custom sync scripts, because they try to create a new object in the tables UNSAccountB and UNSGroupB. But the creation process fails due to not working template for the column DistinguishedName in both tables.

I have checked the behaviour in the Debugger and in the ObjectBrowser with the same properties. In the Visual Studio Debugger the DN was not build after alle required properties were set and although I have done an ExecuteTemplate. In the ObjectBrowser the template was executed sucessfully after I have entered the first properties  UID_UNSRootB, AccountName and CN (same properties that will be set by the script).

As workaround we also set the DN within the script, but that cannot be the answer!

So, I hope that someone of you can give me the answer how we can fix the problem that templates will also work by creating an object from a script.

Thanks a lot!

-
Regards
Sven

  • Hi Sven,

    it would be easier to answer your question if you would post your template code and the code snippet that create the UNSAccountB objects.

    In addition

    • Is your USNRootB marked to use a container structure?
    • Did you check the code on the OnSaving event of the UNSAccountB table if it conflicts with your template code?
  • Also check for filter conditions like FULLSYNC
  • Hi Markus

    Yes, we are using the container structure. It has been set as default by the M61 during the migration.

    And I think that is the problem, because in 6.1.3 the DN was not a mandatory field, but with the new "Container structure" feature the Customizer declares the DN automatically to a mandatory field. And we have nothing changed at the template, so we are still using the standard template delivered with 7.1.2 that still contains the condition for checking the Connection.Variables("FULLSYNC").

    Do you have an idea what can be the best solution for that Problem? I have changed the first condition of the Standard template, so that basically the template will not executed during a fullsync unless a new account will be created. What Do you think?

    If  Not CBool(Variables.Get("FULLSYNC")) OrElse ( CBool(Variables.Get("FULLSYNC")) AndAlso Not $[IsLoaded]:Bool$ ) Then
    
    	If  Not String.IsNullOrEmpty($UID_UNSRootB$) AndAlso _
    		Not String.IsNullOrEmpty($cn$) Then
    		' If targetsystem is configured to use containers
    		If $FK(UID_UNSRootB).UsesContainer:Bool$ Then
    			If string.IsNullOrEmpty($UID_UNSContainerB$) Then
    				Value = TSB_CreateDN( _
    					"CN", _
    					$cn$,$FK(UID_UNSRootB).DistinguishedName$)
    			Else
    				Value = TSB_CreateDN( _
    					"CN", _
    					$cn$,$FK(UID_UNSContainerB).DistinguishedName$)
    			End If
    		Else
    			' No containers are used, only calculate an initial value once
    			If Not $[IsLoaded]:Bool$ AndAlso string.IsNullOrWhiteSpace(Cstr(Value)) Then
    				Value = TSB_CreateDN("user",$cn$,$FK(UID_UNSRootB).DistinguishedName$)				
    			End If
    		End If
    	End If
    
    End If

    Is there also a possibility to reconfigure an existing UNSRootB to unset the option container structure?

    -
    Regards
    Sven

  • Hi Sven,

    if you do not need the containers in your UNSRootB you can change the flag using SQL but be aware the system might change the distinguished name and the canonical name when you change the objects after that change due to the templates or the OnSaving-Script.

    You should test this very carefully.

    You template change seems to work but here again, test this carefully. Especially if the created distinguished names and canonical names are up to your expectations.
  • Hi Markus

    On a first attempt I will test and use the modified standard template, I think that this will be the best way for the first time.

    If I have enough time for testing purposes I will check your first suggestion regarding the container structure flag.

    Regards
    Sven