Publish the BPT Intro app (oap).
Once it is done, open the module BlogManager
Create a new process and make sure the name starts with your initials (e.g. RVB_ArticlesMGM)
Create an Input Parameter as: ArticleSelectedID
Drag and drop the necessary components (as in the picture) and make the connections.
Double click the Check Initial Status activity to open the code
We need to check what is the initial status of the review since the editor can either approve, discard or assign reviewers.
If Approved or Discarded then the process ends.
This node will allow you to instantiate as many Review Article human activities as there are reviewers
Create the output parameter ReviewID. This will allow you to associate the Review Article activity with a specific ReviewID from the application.
This is the Human Action assigned to the reviewers
User: GetUser(GetReview(AssignReviewer.ReviewID).Review.ReviewerID).User.Id
Destination:
Reviewer\Post_Detail
ArticleSelectedID
Detail: GetArticle(ArticleSelectedID).Article.Title
Due Date: AddDays(GetReview(AssignReviewer.ReviewID).Review.CreatedOn,2)
Roles:
Reviewer
Right click on Review Article and add an On Ready event
Double click on the On Ready event
Create an aggregate on the entity Review_Activity to correlate the review id with the activity id
Review_Activities.ReviewID = AssignReviewer.ReviewID
This will allow the application to know the activity context of this review.
Init rec:
GetReviewActivityByReviewID.List.Current.Review_Activities.ReviewID
AssignReviewer.ReviewID
GetReviewActivityByReviewID.List.Current.Review_Activities.ReviewActivityID
ActivityId
Right click on Review Article and add an On Close event
Double click on the On Close event
Check to see if this activity can be closed, i.e. does the review status has an Is Final flag set to true.
Once we are ok to close this activity it may happen that this is the last review so we have an opportunity to close the Wait For.
Check to see if all reviews have been done.
If so you can close the Wait For.
For this you need to get the Wait For related activity id. This is being stored in the Article Activity entity under the Wait For Reviewers Activity ID attribute.
This is actually populated on the OnReady of the Wait For
Manually try to close the Wait For
Double click on the Create Review Tasks to open the code
Check to see who were the assigned reviewers
Launch the Assign Reviewer conditional start
ProcessID: ProcessId
ReviewID: GetReviewsByArticleSelectedId.List.Current.Review.Id
Select the WaitForReviewers
Timeout: AddDays(GetArticle_Selected(ArticleSelectedID).Article_Selected.CreatedOn,2)
Right click on Wait For Reviewers and add an On Ready event
Create an aggregate on the entity Article_Activities to correlate the article id with the wait for activity id
Article_Activities.ArticleSelectedID = ArticleSelectedID
This will allow the application to know the wait for activity context of this article.
GetArticleActivityByArticleSelectedID.List.Current.Article_Activities.ArticleSelectedID
GetArticleActivityByArticleSelectedID.List.Current.Article_Activities.WaitForReviewersActivityID
Right click on Wait For Reviewers and add an On Close event
Check to see if there are any open reviews using the Is Final flag on the review status.
If there are pending reviews then raise a custom user exception so you can trap it when you try to close this activity and it can not be closed yet.
Finally, change the status of the article to In Decision status.
Use empty string ("") on the comment.
Editor\Post_Detail
Due Date:
AddDays(CurrDateTime(),1)
Editor
Create output parameter:
ArticleStatusID
Comment
Right click on Editor Decision and add an On Ready event
Create an aggregate on the entity Article_Activities to correlate the article id with the editor decision activity id
This will allow the application to know the editor decision activity context of this article.
GetArticleActivityByArticleSelectedID.List.Current.Article_Activities.EditorDecisionActivityID
Right click on Editor Decision and add an On Close event
For this OnClose we are passing some output parameters, the Article Status ID and the Comment.
Check to see if the app got a Discarded and if so proceed to discard the article.
Do the same for the approve
Any other status prevents the activity form closing.
On the logic section, locate your process helpers section
On the Launch Process add your launch process action form the process
On the Act Close Review Article action add your Close Review Article Action from the activity on the process
On the Act Close Editor Decision add a close editor decision from the process activity
In the true change panel review all warnings and comments
Test and debug your application