Saving of content as SaveAction.CheckIn skips Approval Process

Vote:
 

Hi Episerver Community, my first post here.

Im programatically saving Content Images (ImageData) with the code:

_contentRepository.Save(media, SaveAction.CheckIn);

This saves the Image content sucessfully to a folder where I have setup an Approval Process.

When I save I catch the CheckedInContent event in a InitializableModule and I send an email to a user to Approve this image (this all works fine)

//In   [InitializableModule]
events.CheckedInContent += OnEventCheckedInContent;

However when I go into the CMS, click on the image  to approve it I do not get the Approval Process. The status is Ready to Publish and the Publish? button displays Publish Changes when what I want is to go through the Approval Process for this checked in content.

If I call save with Content Images (ImageData) with Default SaveAction as below then I get the correct approval process. 

However I have to catch the SavedContent event which kicks of every time content is saved - and I only want 1 approval email sent out. Yes I know I could work around this but Im intersted in the process.

_contentRepository.Save(media, SaveAction.Default);

Why is the CheckedInContent save not allowing me to go throug the Approval Process. Is this a bug or a 'featue' of the process?

#202092
Mar 13, 2019 18:06
Vote:
 

It could be that something you're doing when saving that's causing the issue. You could listen to the approval events instead and send an email on Started. See the "Hooking up events" guide here: https://world.episerver.com/documentation/developer-guides/CMS/Content/content-approvals/working-with-content-approvals/ 

And the list of events: https://world.episerver.com/documentation/Class-library/?documentId=cms/11/5455BCCD 

#202118
Mar 14, 2019 14:57
Vote:
 

I would advise using the SaveAction.RequestApproval which should kick off the approval process for you: 

See "Starting an approval" here: https://world.episerver.com/documentation/developer-guides/CMS/Content/content-approvals/working-with-content-approvals/#Startingapproval 

By checking in the content you are essentially bypassing the states used in a normal approval flow as described in "Approval flow" here: https://world.episerver.com/documentation/developer-guides/CMS/Content/content-approvals/ 

#202128
Edited, Mar 14, 2019 16:54
Vote:
 

I did look at the SaveAction.RequestApproval and I do believe that is what I should be using. However I dismissed it tbecause its a pre-release feature with the comment:

This is a pre-release saveAction that is UNSTABLE and might not satisfy the compatibility requirements as denoted by its associated normal version.

Im very cautious about adding code to a production environment that might not be supported between versions as detailed by Episerver here:

https://world.episerver.com/documentation/Items/Installation-Instructions/beta-features/

I wonder what are other users experiences wiith these Beta features?

David Knipe your link to the checking in content was helpful thanks.

#202142
Mar 15, 2019 12:32
Vote:
 

Hey Brendan

Approval Sequences should have come out of beta a while back (Episerver CMS v11 I believe) so the error you are seeing may be bug in the documentation and/or you are running an older version of Episerver. 

Worth noting you can safely use beta versions of Episerver software, it still goes through a full QA process. The only major difference is that beta versions are not tied to semantic versioining as mentioned here: https://world.episerver.com/blogs/Fredrik-Tjarnberg/Dates/2014/9/Releasing-Beta-Features/ 

David

#202145
Mar 15, 2019 15:15
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.