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

OnDiscarded table script

I'm trying to update affiliations when a person is added/removed from PersonInOrg.  The update is working correctly using a process with an Insert event.  However, the delete event does not work - I believe it is firing the delete event, but it seems to update affiliations using the data before the deletion occurs.  So now I'm trying to use an OnDiscarded table script in the PersonInOrg table, but it doesn't seem to be working either.  I'm wondering if the user info is already gone by the time the OnDiscarded script runs?   

Below is the script I'm using.  Any suggestions?


Dim affiliation As String = ""
Dim scopedAffiliation As String = ""
Dim f As ISqlFormatter = Session.SqlFormatter
Dim eLDAPAccountEnt As IEntity

affiliation = VI_Build_Affiliations( $UID_Person$, "CCC_scopedAffiliation", "0")
scopedAffiliation = VI_Build_Affiliations( $UID_Person$, "CCC_scopedAffiliation", "1")

If Not String.IsNullOrEmpty($UID_Person$) Then
Dim qPerson = Query.From ("LDAPAccount") _
.Where(f.AndRelation(f.UidComparison("UID_Person", $UID_Person$), _
"UID_TSBAccountDef In (SELECT UID_TSBAccountDef FROM LDAPAccount INNER JOIN TSBAccountDef ON LDAPAccount.UID_TSBAccountDef = TSBAccountDef.UID_TSBAccountDef WHERE TSBAccountDef.Ident_TSBAccountDef = N'Enterprise Directory Account')")) _
.Select ("UID_LDAPAccount", "CCC_affiliation", "CCC_scopedAffiliation")

eLDAPAccountEnt = Session.Source.GetCollection(qPerson).FirstOrDefault

If Not eLDAPAccountEnt Is Nothing Then
If Not affiliation = eLDAPAccountEnt.GetValue("CCC_affiliation").String Then eLDAPAccountEnt.PutValue("CCC_affiliation", affiliation)
If Not scopedAffiliation = eLDAPAccountEnt.GetValue("CCC_scopedAffiliation").String Then eLDAPAccountEnt.PutValue("CCC_scopedAffiliation", scopedAffiliation)
eLDAPAccountEnt.Save(Session)
End If
End If

Parents
  • This is the error I get through the Job queue:

    ErrorMessages = (2018-01-22 15:03:36.557) Error saving 15580147-2ee5-47df-a3c1-bf3ac01f430d - b8ad0a75-ed8f-4a43-94d2-12e6e748118b: [810306] Error during execution of 'OnSaved' in logic module 'VI.DB.Entities.EntityScriptLogic'.
    [810186] Error executing script for event OnSaved.
    [810222] Error executing script 'PersonInOrg_OnSaved'.
    [System.NotSupportedException] Specified method is not supported.

    Please let me know if there a better source for debugging errors!
Reply
  • This is the error I get through the Job queue:

    ErrorMessages = (2018-01-22 15:03:36.557) Error saving 15580147-2ee5-47df-a3c1-bf3ac01f430d - b8ad0a75-ed8f-4a43-94d2-12e6e748118b: [810306] Error during execution of 'OnSaved' in logic module 'VI.DB.Entities.EntityScriptLogic'.
    [810186] Error executing script for event OnSaved.
    [810222] Error executing script 'PersonInOrg_OnSaved'.
    [System.NotSupportedException] Specified method is not supported.

    Please let me know if there a better source for debugging errors!
Children
No Data