Hello, Im trying to update person account in oracle custom table using Update operation (script based) - but it end with error "Object reference not set to an instance of an object"
Script
StringBuilder sql = new StringBuilder(); var Username_p = data.SystemObject.GetValue("USERNAME"); var firstname_p = data.SystemObject.GetValue("FIRSTNAME"); var middlename_p = data.SystemObject.GetValue("MIDDLENAME"); var lastname_p = data.SystemObject.GetValue("LASTNAME"); var departmentid_p = data.SystemObject.GetValue("DEPARTMENTID"); var job_p = data.SystemObject.GetValue("JOB"); job_p = job_p.ToString().Replace("'","''"); var logindisabled_p = data.SystemObject.GetValue("LOGINDISABLED"); var aacsesstypeid_p = data.SystemObject.GetValue("AACSESSTYPEID"); var monopolylogin_p = data.SystemObject.GetValue("MONOPOLYLOGIN"); var canapprove_p = data.SystemObject.GetValue("CANAPPROVE"); var validcomputers_p = data.SystemObject.GetValue("VALIDCOMPUTERS"); var validlogins_p = data.SystemObject.GetValue("VALIDLOGINS"); var bookbydeptonly_p = data.SystemObject.GetValue("BOOKBYDEPTONLY"); var tminitstring_p = data.SystemObject.GetValue("TMINISTRING"); var deletedocsmode_p = data.SystemObject.GetValue("DELETEDOCSMODE"); var modifydocsmode_p = data.SystemObject.GetValue("MODIFYDOCSMODE"); var SignatureDocsMode_p = data.SystemObject.GetValue("SIGNATUREDOCSMODE"); var cancreateunsigneddocs_p = data.SystemObject.GetValue("CANCREATEUNSIGNEDDOCS"); var toboid_p = data.SystemObject.GetValue("TOBOID"); var docavaildepartment_p = data.SystemObject.GetValue("DOCAVAILDEPARTMENT"); var transactaccesstypeid_p = data.SystemObject.GetValue("TRANSACTACCESSTYPEID"); var phone_p = data.SystemObject.GetValue("PHONE"); var email_p = data.SystemObject.GetValue("EMAIL"); var unbookdocsmode_p = data.SystemObject.GetValue("UNBOOKDOCSMODE"); var docavailgroups_p = data.SystemObject.GetValue("DOCAVAILGROUPS"); var isuseuserkey_p = data.SystemObject.GetValue("ISUSEUSERKEY"); var siteid_p = data.SystemObject.GetValue("SITEID"); var hierarchylevel_p = data.SystemObject.GetValue("HIERARCHYLEVEL"); var securitylevel_p = data.SystemObject.GetValue("SECURITYLEVEL"); var note_p = data.SystemObject.GetValue("NOTE"); var UserDealGroupID_p = data.SystemObject.GetValue("USERDEALGROUPID"); var CHECKMSGINTERVAL_p = 10; var LANGUAGEID_p = "NULL"; var MAINTOBOID_p = data.SystemObject.GetValue("MAINTOBOID"); var USERROLEID_p = "NULL"; var mobilephone_p = data.SystemObject.GetValue("MOBILEPHONE"); var ldapusername_p = data.SystemObject.GetValue("LDAPUSERNAME"); var personnumber_p = data.SystemObject.GetValue("PERSONNUMBER"); var auth2level_p = data.SystemObject.GetValue("AUTH2LEVEL"); var maindepartmentid_p = data.SystemObject.GetValue("MAINDEPARTMENTID"); var LoginFromOneCompOnly_p = data.SystemObject.GetValue("LOGINFROMONECOMPONLY"); var maindocavaildepartment_p = data.SystemObject.GetValue("MAINDOCAVAILDEPARTMENT"); string key_column = "ID"; using (System.Data.Common.DbCommand cmdReader = connection.CreateCommand()) { cmdReader.CommandType = System.Data.CommandType.Text; cmdReader.CommandText = String.Format("SELECT * FROM CREATOR.USERS WHERE USERNAME = '{0}' AND SITEID = '300003'", Username_p); // Retrieve the data. using (System.Data.Common.DbDataReader reader = cmdReader.ExecuteReader()) { while (reader.Read()) { // Construct the SQL statement for updating the user sql.AppendFormat(String.Format("BEGIN CREATOR.PKG_USER.users_update('{0}', '{1}', '{2}', '{3}', {4}, '{5}', {6}, {7}, {8}, {9}, '{10}', '{11}', {12}, '{13}', {14}, {15}, {16}, {17}, {18}, '{19}', {20}, '{21}', '{22}', {23}, '{24}', {25}, {26}, {27}, {28}, '{29}', {30}, {31}, {32}, {33}, {34}, '{35}', '{36}', '{37}', {38}, {39}, {40}, '{41}'); END;", Username_p, firstname_p, middlename_p, lastname_p, departmentid_p, job_p, logindisabled_p, aacsesstypeid_p, monopolylogin_p, canapprove_p, validcomputers_p, validlogins_p, bookbydeptonly_p, tminitstring_p, deletedocsmode_p, modifydocsmode_p, SignatureDocsMode_p, cancreateunsigneddocs_p, toboid_p, docavaildepartment_p, transactaccesstypeid_p, phone_p, email_p, unbookdocsmode_p, docavailgroups_p, isuseuserkey_p, siteid_p, hierarchylevel_p, securitylevel_p, note_p, UserDealGroupID_p, CHECKMSGINTERVAL_p, LANGUAGEID_p, MAINTOBOID_p, USERROLEID_p, mobilephone_p, ldapusername_p, personnumber_p, auth2level_p, maindepartmentid_p, LoginFromOneCompOnly_p, maindocavaildepartment_p)); } } } // Update user connection.ExecuteSqlNonQuery(sql.ToString()); // Return changed key values or empty ScriptBasedDMLStrategyResult object key = connection.ExecuteSqlScalar(string.Format("SELECT ID FROM CREATOR.USERS WHERE SITEID='300003' AND USERNAME = '{0}'", Username_p)); return new ScriptBasedDMLStrategyResult(key_column, Convert.ToString(key));
Error
2022-01-20 13:42:08 +02:00 - \FGV-T-SV-JSOI01 - VI.Projector.JobComponent.ProjectorComponent - cabcd9e4-9d2f-4db0-82e4-8fe83bc2773c: Errors occurred [2134003] Error executing synchronization. [1777018] Error executing synchronization project (EOIS_TEST)'s workflow (Provisioning). [1777124] Error executing projection step (User) of projection configuration (Provisioning (a6436b92-a71c-4e1b-ad43-e3ea8770329b)). [1777219] Error executing synchronization step (User)! [1777004] Method (Update object (Update)) could not be executed successfully. [2415018] Error executing script for the data operation. [System.Reflection.TargetInvocationException] Exception has been thrown by the target of an invocation. [System.NullReferenceException] Object reference not set to an instance of an object. at StdioProcessor.StdioProcessor._Execute(Job job) at VI.Projector.JobComponent.ProjectorComponent.Activate(String task) at VI.Projector.JobComponent.ProjectorComponent._FullProjection() ---- Start of Inner Exception ---- at VI.Projector.JobComponent.ProjectorComponent._FullProjection() at VI.Projector.Database.ProjectorExecutor.Project(ISession session, IProjectionConfiguration configuration, ProjectionOption options, ISystemObject adHocObject, CancellationToken cancellationToken) at VI.Projector.Projection.Extensions.Execute(IProjectorEngine engine, IProjectionConfiguration configuration, ProjectionOption options, ISystemObject adHocObject, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) ---- Start of Inner Exception ---- at VI.Projector.Projection.ProjectorEngine.<ExecuteAsync>d__3.MoveNext() ---- Start of Inner Exception ---- at VI.Projector.Projection.ProjectorEngine.<ExecuteAsync>d__3.MoveNext() ---- Start of Inner Exception ---- at VI.Projector.Projection.ProjectorEngine.<ExecuteAsync>d__3.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() --- End of stack trace from previous location where exception was thrown --- at VI.Projector.Projection.ProjectionStrategy.<ExecuteStepAsync>d__3.MoveNext() ---- Start of Inner Exception ---- at VI.Projector.Projection.ProjectionStrategy.<ExecuteStepAsync>d__3.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() --- End of stack trace from previous location where exception was thrown --- at VI.Projector.Projection.ProjectionStrategyBase.<OnExecuteStepAsync>d__6.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() --- End of stack trace from previous location where exception was thrown --- at VI.Projector.Projection.ProjectionStrategyBase.<_ProcessIntersectionSetAsync>d__21.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() --- End of stack trace from previous location where exception was thrown --- at VI.Projector.Projection.ProjectionStrategyBase.<_ProcessMappingOfSystemObjectPairsAsync>d__25.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.Execute() at System.Threading.Tasks.Task`1.InnerInvoke() at VI.Projector.Projection.ProjectionStrategyBase.<>c__DisplayClass25_0.<_ProcessMappingOfSystemObjectPairsAsync>b__13() at VI.Projector.Projection.ProjectionStrategyBase._ExecuteMethods(IProjectionStep step, SystemObjectMatchingSet matchingSet, ISystemConnection connection, ISchemaMethodAssignment[] methodAssignments, IList`1 systemObjectPairs, SystemMappingSide side, ProjectionDirection projectionDirection, Boolean forceReloadObject, Boolean ignoreQuotas) at VI.Projector.Projection.ProjectionStrategyBase._ExecuteMethodNative(ISystemConnection connection, SystemObjectMatchingSet matchingSet, ISchemaMethod method, IEnumerable`1 objectsWithAncestryToExecute, Boolean reloadObjects, Boolean isImport) at VI.Projector.Connection.SystemConnection.ExecuteMethod(ISchemaMethod method, IEnumerable`1 systemObjects, ExecuteMethodOptions option) ---- Start of Inner Exception ---- at VI.Projector.Connection.SystemConnection.ExecuteMethod(ISchemaMethod method, IEnumerable`1 systemObjects, ExecuteMethodOptions option) at VI.Projector.Journal.JournalConnector.OnExecuteMethod(ExecuteMethodRequest request) at VI.Projector.Connection.Connectors.DistributionConnector.ExecuteMethod(ExecuteMethodRequest request) at VI.Projector.Connection.SystemConnector.ExecuteMethod(ExecuteMethodRequest request) at VI.Projector.Connection.SystemConnector.CommitObject(CommitObjectRequest request) at VI.Projector.Database.Native.NativeDatabaseConnector.OnCommitObject(CommitObjectRequest request) at VI.Projector.Database.Native.Systems.DatabaseSystemAdapter.UpdateData(IReadOnlyList`1 data, DMLOption option) at VI.Projector.Database.Native.Description.ScriptBasedDMLStrategy.OnProcess(IDatabaseSystemAdapter systemAdapter, IEnumerable`1 data, DMLOption option) ---- Start of Inner Exception ---- at VI.Projector.Database.Native.Description.ScriptBasedDMLStrategy.OnProcess(IDatabaseSystemAdapter systemAdapter, IEnumerable`1 data, DMLOption option) 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) ---- Start of Inner Exception ---- at VI.Projector.Scripting.ProjectorScripts.ProcessScriptBasedDMLStrategy26020ea6_c671_4625_82d4_6d7c5876890b(IDatabaseConnection connection, ScriptBasedDMLStrategyData data, ScriptBasedDMLStrategyArgs args)
In mappings UID_UNSAccountB <-- ID with Force mapping against direction of synchronization checkbox
Also trying return function without ID in scritp (return new ScriptBasedDMLStrategyResult()) - have the same error
Pattern based cannot use (need some data modification - in script)
Synchronization from oracle to OIM working correctrly.
OIM 8 1 4
Any idea?
Regards.