custom task failing via App server connection from Manager Tool

Hi Team,

Custom task associated with person record is failing while running the task using app layer connection from Manager but working via DB connection.

This custom task will generate a new central account for person record.

Please suggest how to fix this issue.

Error Message : Error running script 'CCC_RegenerateAccountName_CCC_737974D62A165B4DBEAB7F27DCDB1DCD'.
at VI.DialogEngine.DialogEngine.ExecuteTask(Task task)
at VI.FormBase.Tasks.Task.Execute()
at VI.DB.Implementation.DialogMethod.Run(ISingleDbObject baseObject)
at VI.Base.SyncActions.Do(Func`1 action)
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.DB.Entities.EntityClassificationByScripts.<RunMethodAsync>d__6.MoveNext()
at VI.DB.Scripting.ScriptRunner.Run(String key)
An error occurred in the task 'Regenerate Account Name'.
at VI.DB.Scripting.ScriptRunner.Run(String key)
at DynScripts.DlgMth_ddaQOOqdXN6AaNiHckhly20SYPC6frBr.CCC_RegenerateAccountName_CCC_737974D62A165B4DBEAB7F27DCDB1DCD()
Object reference not set to an instance of an object.
at DynScripts.DlgMth_ddaQOOqdXN6AaNiHckhly20SYPC6frBr.CCC_RegenerateAccountName_CCC_737974D62A165B4DBEAB7F27DCDB1DCD()
at DynScripts.Scripts_ddaQOOqdXN6AaNiHckhly20SYPC6frBr.CCC_BuildCentralAccount(String uid_person, String Lastname, String Firstname)
at VI.DB.CachedDataReader.Read()

Parents
  • Which version are you using?

    Are you using any additional referenced DLL in your script that might not present on the Application server?

    Does the script CCC_BuildCentralAccount work when you test it in the ObjectBrowser using an Application Server connection?

    Do you use any direct SQL requests in the script?


  •   Version used in V9.0LTS and no DLL's referenced in script as it is straight forward VB script.

    We are using Idatareader in script

    Dim existing As New List(Of String)
    Dim dummy As New Object()
    Dim dummyPerson As ISingleDbObject
    dummyPerson = Connection.CreateSingle("Person")
    Dim pattern As String = "%"
    Dim myObjectKey As New DbObjectKey("Person", uid_person)
    Dim accountName As String
    Dim objectKeyString As String
    Dim objectKey As DbObjectKey

    Using rd As IDataReader = CType(dummyPerson.Custom.CallMethod("SearchCentralAccount", pattern), IDataReader)

    While rd.Read()

    accountName = rd.GetString(rd.GetOrdinal("AccountName"))
    objectKeyString = rd.GetString(rd.GetOrdinal("ObjectKeyPerson"))

    If Not String.IsNullOrEmpty(objectKeyString) Then
    objectKey = New DbObjectKey(objectKeyString)

    'only addresses which not belong to the actual employee will be considered
    If myObjectKey.Equals(objectKey) Then
    Continue While
    End If
    End If

    existing.Add(accountName)
    End While
    End Using

    I tested the script connecting to objectbrowser via App layer connection and script thrown the same error:

    [810222] Error running script 'CCC_BuildCentralAccount'.
    at VI.ObjectBrowser.Parts.ScriptDebuggerControl.mnuRun_Activate(Object sender, EventArgs e)
    at VI.DB.Scripting.ScriptRunner.Eval(String key, Object[] parameters)
    Object reference not set to an instance of an object.
    at DynScripts.Scripts_ddaQOOqdXN6AaNiHckhly20SYPC6frBr.CCC_BuildCentralAccount(String uid_person, String Lastname, String Firstname)
    at VI.DB.CachedDataReader.Read()

    Can we be able to fix this error in app layer connection?

  • Okay. The thing is that the OOTB script your script is derived from is running in a template, hence on the Application Server itself, therefore the data reader is working. 

    If you call the script directly (Object Browser, Dialog Method) it is run on your local client which makes the data reader unavailable.

    What is the use-case for your method, what are you trying to achieve?

  •    we didn't apply overwrite option on centralaccount column in person record as we didn't want centralaccount change for all the users whenver first or last name change happens. Whenever customer want to change centralaccount for specific user this task will be executed from manager tool but now customer requested us to make this task work via App layer connection as well.Can we make this work via app later connection?

  • Option a), change the template and add a check for a custom connection varable "UPDATE_CENTRALACCOUNT" for example and only overwrite the centralaccount if this varaible is set (and set the Overwrite option in the template again) Then change your method to first set the connection variable and the re-executing the template on the Centralaccount column. After that remove the connection variable and save the entity.

    Option b) generate an event and let your script run on a jobserver with direct sql connection.

  •     Thanks for suggesting the fixes. Option B perfectly worked in my case.This case can be marked as closed.

Reply Children
No Data