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

Create UNSAccountB with VB script - Input string was not in a correct format

We're creating UNSAccountB record using script:

Dim UNSAccountB As IEntity = Nothing
Dim UNSRootB As IEntity = TSB_UNSRootB_Get(Ident_UNSRoot)
Dim TSBAccountDef As IEntity = TSB_TSBAccountDef_Get(Ident_TSBAccountDef)
Dim TSBBehavior As IEntity = TSB_TSBBehavior_Get(Ident_TSBBehavior)

...

Try
	If Session.Source.TryGet( Query.From("Person") _
		    					   .Where(f.Comparison("UID_Person", UID_Person, ValType.String, CompareOperator.Equal, FormatterOptions.NonUnicodeLiterals)) _
			    				   .SelectNonLobs, Person ) Then

        UNSAccountB = Session.Source.CreateNew("UNSAccountB")
        UNSAccountB.PutValue("FirstName", Person.GetValue("FirstName").String)
        UNSAccountB.PutValue("LastName", Person.GetValue("LastName").String)
        ...
        UNSAccountB.PutValue("UID_UNSRootB", UNSRootB.GetValue("UID_UNSRootB").String)
		
        Using uow As IUnitOfWork = Session.StartUnitOfWork()
	        uow.Put(UNSAccountB)
	        uow.Commit()
        End Using

In most castes it's working as expected but in one case it fails with error message: Input string was not in a correct format. After debug I came to conclusion that UID_UNSRootB of specified Target System is a problem. The problematic UID has a value

57b46151-97c4-4bc3-9f77-4eea3a4dcb03

Target System is defined as follows:

Target system: VRS
Target system type: Unified Web Service
Canonical name: VRS
Distinguished name: system=VRS
Display name: Versis
Account definition: Konto Versis

Weird thing is that on PROD environment there is the same behaviour where UID_UNSRootB is equal:

8ccc6a2f-d3be-4159-b4ab-3f43a967e63c

The problem is only with this one Target System

IDM ver: 7.1.1

  • Can you provide the complete error message?

  • Exception has been thrown by the target of an invocation.
    	at Designer.ScriptEditor.ScriptTestEditor.ExecuteScript(ScriptItem sItem)
    	at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    	at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
    	at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
    Input string was not in a correct format.
    	at DynScripts.scripts.TSB_UNSAccountB_Insert(String UID_Person, String AccountName, String Ident_UNSRoot, String Ident_TSBAccountDef, String Ident_TSBBehavior, Boolean FullSync)
    	at System.String.Format(IFormatProvider provider, String format, Object[] args)
    	at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)

  • Is your script called TSB_UNSAccountB_Insert? If so, try to debug this in the SystemDebugger to detect if a template throws the error.

  • If I put UID of Versis Target System:

    UNSAccountB.PutValue("UID_UNSRootB", String.Format("{0}", "57b46151-97c4-4bc3-9f77-4eea3a4dcb03"))

    it will always fail. With UID's of others Target System it's working perfectly. I have no idea what's wrong.

  • Again, use the System Debugger to debug this. Setting the UID triggers the templates and one of them throws the error.

  • I'm firing TSB_UNSAccountB_Insert with FULLSYNC=True. I was having process for system=VRS on Event=INSERT but I forgot to include FULLSYNC variable in Generatiing Condition.