Is it Possible to Programmatically Override Activity Story LastUpdate Date on Creation?

Background: Migrating approximately 64,000 posts using REST API to create threads/replies.

Issue: Date for posts entered appropriately. Activity Story Stream uses the REST Migration date instead of the post date/time, pushing other, non-migrated content down 64K spaces.

Activity Story has correct "Created" date but LastUpdate shows the migration time (which I suppose is technically correct) not the merged date.

Is there a method to override this?

  • While story types can set the LastUpdateDate, most do not. As an example, blog posts do (because they support scheduled publishing), but forum threads don't.

    What type of content are you migrating that you want to adjust?

  • What type of content are you migrating that you want to adjust?

    Forum Thread/Replies

  • I should also mention, that I'm not tied to LastUpdateDate as a fix method. My end goal is to have the migrated posts merge more like a zipper into existing posts as if they were always a part of the story stream. If there is a better method, I'll happily take it! Slight smile

  • Digging deeper, it appears that the post Add date seems correct but the Replies are not referencing the date set from REST but the time it was imported:

    • Actors [IList-of-ActivityStoryActor]
      • [0] [ActivityStoryActor]
        • ActorId: d17466a4-a9f5-4d1e-8754-22ea3dce9270 [Guid]
        • Date: 6/30/2011 3:21:40 PM [DateTime]
        • User [User]
        • UserId: 39585 [Int32]
        • Verb: "Add" [String]
      • [1] [ActivityStoryActor]
        • ActorId: c0fca003-db74-42dc-b632-4e347d873c16 [Guid]
        • Date: 9/22/2022 3:18:17 PM [DateTime] Actual Reply: 6/30/2011 3:54 PM
        • User [User]
        • UserId: 46753 [Int32]
        • Verb: "Reply" [String]
      • [2] [ActivityStoryActor]
        • ActorId: fa01082d-1f33-420d-b191-48a4acf5b995 [Guid]
        • Date: 9/22/2022 3:18:17 PM [DateTime] Actual Reply: 6/30/2011 5:01 PM
        • User [User]
        • UserId: 46886 [Int32]
        • Verb: "Reply" [String]
      • [3] [ActivityStoryActor]
        • ActorId: c750abdf-a875-4807-975f-4c71b1926a5b [Guid]
        • Date: 9/22/2022 3:18:17 PM [DateTime] Actual Reply: 6/30/2011 7:13 PM
        • User [User]
        • UserId: 39585 [Int32]
        • Verb: "Reply" [String]
      • Count: 4 [Int32]
    • Content [Content]
    • ContentId: 48311d09-63d8-4101-b8d8-017e2871fad0 [Nullable-of-Guid]
    • ContentTypeId: 46448885-d0e6-4133-bbfb-f0cd7b0fd6f7 [Nullable-of-Guid]
    • CreatedDate: 6/30/2011 3:21:40 PM [DateTime]
    • ExtendedAttributes [IList-of-IExtendedAttribute]
    • LastUpdate: 9/22/2022 3:18:17 PM [DateTime]

    I'm not sure if that information is helpful, but wanted to share in case it is easier to change/update.

  • Long term, this will require a bug fix to ensure that LastUpdatedDate is always set in activity stories (it defaults to "now" which is affecting the creation of stories for forum content created in the past):

    TE-17806: Update all activity stories to set LastUpdatedDate explicitly on create

    A shorter-term fix may be to manually update the story LastUpdatedDates in the database to match their CreatedDate values (assuming there is a way to detect which stories are related to migrated content -- perhaps by a date range for CreateDate, for example).

  • Thanks Ben!

    We're keeping track of content IDs for redirect purposes from the original site so I think it's possibly do able. Can you share the database tables to be looking at? (Via PM is fine if that's not something desired to be posted publicly)

  • The table is te_ActivityStream_Stories. The fields are going to pretty self-explanatory. You may also want to update the LastUpdatedDates on the actors--these are in te_ActivityStream_StoryActors.