7

I've a question on what the expected behavior would be this scenario:

Scenario: Content updated in WFBundle and then updated outside of WFBundle.

No minimum approval status set on STAGE Minimum approval status is set on LIVE

Component is created – v1.0

Component added to a WFBundle and WFBundle is activated

Component is edited through workflow bundle – creating v1.1

  • Publish to stage : v1.1
  • Publish to live : v1.0 (as expected as doesn’t meet approval status)

Workflow bundle is complete

  • Publish to stage : v2.0
  • Publish to live : v2.0 (as expected as it now meets approval status)

Component is edited (outside of active workflow bundle)

  • Publish to stage : v3.0
  • Publish to live : v3.0 (not expected as this has previously been through WF and the approval status is updated to Undefined when component is saved – I would have through this would set to the lowest in the workflow (i.e. one above Unapproved))

UPDATE My assumption comes from several blog postings and the documentation that indicate the minimum approval status is adhered to irrespective of the item being in workflow or not.

Also, regarding the update of the approval status to undefined - I've seen there is a hotfix 88203 that may be related to this - but it's stated this is part of the HR1 Roll-up which should have been applied.

UPDATE 2 We have the noted version of the DLL per the response from Chris (below) and quoted in the documentation - however, that version of the DLL didn't have this hook in it. We've checked the version in the GAC and this does have the hook! We're checking the upgrade steps to see if this is an error on our part or something wrong in the upgrade - if you've any info on this, please share here?

  • Check your Publication Target's minimal approval status. If it's set to none (the default) then Tridion will always publish a major version – Nuno Linhares Dec 17 '15 at 2:02
  • Already in place Nuno. Question update to indicate so. – Dylan .. Mark Saunders Dec 17 '15 at 2:55
6

The property SaveEventArgs.ApprovalStatusResetOverrideis introduced indeed as part of HR1, however you'll need to grab the dll from the GAC as the one in the /bin/client folder is not updated by the HR1 installer. The details in the documentation describe the reasons.

So if you have HR1 installed you are going to notice that if you go to your TRIDION_HOME\bin\client folder, the Tridion.ContentManager.dll still has version 7.1.0.1290.

TRIDION_HOME\bin\clien\Tridion.ContentManager.dll

However if you go to the GAC and check the dll this is what you find is the latest dll with the SaveEventArgs.ApprovalStatusResetOverrideproperty available because the dll as described in the docs is version 7.1.0.1327:

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Tridion.ContentManager\v4.0_7.1.0.1290__360aac4d3354074b

So the latter is the one needed in order to implement the event system to overwrite the "Undefined" status to "Unapproved".

Here is a code example on how to accomplish that for items which have been in workflow at some point:

  1. Create your TcmExtension class:
[TcmExtension("My Workflow Event System")]
public class EventSystem : TcmExtension
  1. Register your event:
EventSystem.Subscribe<VersionedItem, SaveEventArgs>(OnResetDefaultApprovalStatus, EventPhases.Initiated);
  1. Implement the event:
private void OnResetDefaultApprovalStatus(VersionedItem subject, SaveEventArgs e, EventPhases phase)
{
    IWorkflowItem item = null;
    if (subject is Component)
    {
        item = subject as Component;
    }
    else if (subject is Page)
    {
        item = subject as Page;
    }
    if (item != null)
    {
        if (item.ApprovalStatus != null && !item.ApprovalStatus.Title.Equals("undefined", StringComparison.InvariantCultureIgnoreCase))
        {               
            e.ApprovalStatusResetOverride = ApprovalStatusType.Unapproved;

        }
    }
}
2

Components saved outside of workflow are set to approval status 'undefined', as you say.

Undefined is considered as NULL in Approval Status terms, and does not restrict publishing at all.

You must have an approval status that is above 'undefined', but below "live" to restrict the publishing to the live target.

You'll need to set the approval status back, via events system, to control publishing outside of Workflow

If a changed item was previously in Workflow (e.g. has Approval Status), but it is not in Workflow anymore and doesn't have associated Bundle Workflow Process, its Approval Status will be changed to Undefined by default.

This default can be changed back to Unapproved through an Event System extension: the SaveEventArgs.ApprovalStatusResetOverride property was introduced for this purpose.

  • Thanks Chris - I'd not tracked down this specific quote which captures it quote well! We'll checkout this extension (which should be accessible as we have HR1) - and will mark as the answer once we've confirmed. – Dylan .. Mark Saunders Dec 17 '15 at 12:53
  • Actually Chris - regards "through an Event System extension: the SaveEventArgs.ApprovalStatusResetOverride property was introduced for this purpose." appears not to be the case (or at least not implemented correctly when HR1 is installed). I'm checking across another environment and will update this question with new findings (have you actually used this hook?) – Dylan .. Mark Saunders Dec 18 '15 at 15:55
  • The documentation lies :) – Chris Morgan Dec 18 '15 at 16:58
  • 2
    The property "SaveEventArgs.ApprovalStatusResetOverride" is introduced indeed as part of HR1, however you'll need to grab the dll from the GAC as the one in the /bin/client folder is not updated by the HR1 installer. – Jaime Santos Alcón Dec 20 '15 at 13:53
  • 1
    Jaime - if you promote your comment to an answer (include versions etc.) - you getta the points. – Dylan .. Mark Saunders Dec 21 '15 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.