Old Value from SingleDbObjectSnapshot

When using the following, the OLD and NEW Values are the same in the XML even though they have changed:

This is what I have on the Pre-script for generating and the event is UPDATE

Dim dbPerson As ISingleDbObject = Connection.CreateSingle("Person", $UID_Person$)

Dim personXML As String = New SingleDbObjectSnapshot(dbPerson).ToXmlString(True)


values("personXML") = personXML

I am trying to get the old value out in a script that is generated when there is an UPDATE on Person, but it's not working.  Can someone please suggest what I am doing wrong?

Parents
  • You are loading a Person object from the database with the Connection.CreateSingle("Person",$UID_Person$) statement.

    Drop this statement and use this statement instead (assuming your process is running on the Person.Update event).


    Dim personXML As String = New SingleDbObjectSnapshot(Base).ToXmlString(True)
    
    values("personXML") = personXML



  • Sorry - one more question....

    I'm passing the XML to my script and I can access the values for the columns... but I can't find the syntax to get the old value.....

    Dim dbsnap As SingleDbObjectSnapshot = SingleDbObjectSnapshot.FromXml(PersonXml)

    Dim LastName As String = dbsnap.GetValue("LastName").String

    How do I get the "old" value?

    <Column Name="LastName">
    <NewValue Type="String">Love</NewValue>
    <OldValue Type="String">Love1</OldValue>

Reply
  • Sorry - one more question....

    I'm passing the XML to my script and I can access the values for the columns... but I can't find the syntax to get the old value.....

    Dim dbsnap As SingleDbObjectSnapshot = SingleDbObjectSnapshot.FromXml(PersonXml)

    Dim LastName As String = dbsnap.GetValue("LastName").String

    How do I get the "old" value?

    <Column Name="LastName">
    <NewValue Type="String">Love</NewValue>
    <OldValue Type="String">Love1</OldValue>

Children