Has anyone experienced inconsistencies with dates applied using the OnFieldChangeSetDate write plugin?

I am using the OnFieldChangeSetDate write plugin to set dates when topics are moved to various states. The write plugin behaves as expected when the topic is first moved to the configured state. However, when any metadata is subsequently changed, the previously set date reverts to today's date at 12:00 a.m. Even if I change the topic type (or some other random bit of metadata) rather than the workflow status, the OnFieldChangeSetDate plugin fires.

Here is an example of one of my configurations:

<plugin name="SETREVIEWENDDATE" handler="OnFieldChangeSetDate" ishcondition="ISHType in ('ISHModule', 'ISHLibrary') and ISHLevel='lng' and CurrentAction='SetMetadata'">
<description>Set the review end date when objects are transitioned to Edited Draft status.</description>
<workingset>
<ishfields>
<ishfield name="FSTATUS" level="lng" />
<ishfield name="FREVIEWENDDATE" level="lng" />
</ishfields>
</workingset>
<initialize>
<parameters>
<parameter name="ConditionMetadataField">FSTATUS</parameter>
<parameter name="ConditionMetadataFieldLevel">lng</parameter>
<parameter name="ConditionMetadataFieldValueType">element</parameter>
<parameter name="ConditionMetadataFieldToValue">VSTATUSEDITEDDRAFT</parameter>
<parameter name="SetMetadataField">FREVIEWENDDATE</parameter>
<parameter name="SetMetadataFieldLevel">lng</parameter>
<parameter name="SetMetadataFieldOverwriteExisting">Yes</parameter>
</parameters>
</initialize>
</plugin>

  • Hi Mark,

    Your sample looks almost identical to the documented sample on https://docs.sdl.com/LiveContent/content/en-US/SDL%20Tridion%20Docs-v2.1.1/GUID-C8407155-6A53-4C2C-AD53-9F9C06350058 which usually is the tested one. 

    Especially the "or some other random bit of metadata" of your explanation makes me wonder if you have other plugins configured around FREVIEWENDDATE.

    You potentially analyze more by also configuring the "ConditionMetadataFieldFromValue" so that you explicitly test the status transition.

    Don't know how much you can share here in public... if this needs to go over support, then please share your full plugin configuration, the matching logging of an execution and the plugin code.

    Thanks,

    Dave

  • Thanks, Dave. My client submitted a support case. My apologies. I probably should have gone that route first for this issue. I'll report back here any relevant info when it is resolved. May still be helpful for folks going forward to have the information here.

  • Circling back around to this issue...working with support, I was finally able to determine the root cause of the problem. It had nothing to do with the actual plugin configuration or the plugin itself. Instead, it was a misconfiguration in MetadataConfig.xml.  There was an ishfrmfield with ishfielddatatype set to "typedate". If the user opened the properties in Publication Manager, the dialog showed only the date, but not the date time. If the user then changed any metadata or just clicked "Okay" without changing any metadata, pug mgr would write back just the data without the time -- effectively removing the existing date time. (The server would substitute 12:00 a.m. for the now non-existent time.) SOLUTION: Change the ishfielddatatype to "typedatetime" instead of "typedate".