Created on 26 June 2020
icon_unfollowing
Login to follow
bpt-intro

BPT Intro

Stable version 1.0.1 (Compatible with OutSystems 11)
Uploaded on 26 June 2020 by 
bpt-intro

BPT Intro

Documentation
1.0.1

The App

Publish the BPT Intro app (oap).

Once it is done, open the module BlogManager

The Data Model




The Process

Create a new process and make sure the name starts with your initials (e.g. RVB_ArticlesMGM)

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.



Process Nodes Step-By-Step

Check Initial Status

Code

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.



Assign Reviewer

Node

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.


Review Article

Node


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




On Ready

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



On Close

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


Create Review Tasks

Code

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



Wait For Reviewers

Node

Select the WaitForReviewers


Timeout: AddDays(GetArticle_Selected(ArticleSelectedID).Article_Selected.CreatedOn,2)



On Ready

Right click on Wait For Reviewers and add an On Ready event


Double click on the 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

ArticleSelectedID


GetArticleActivityByArticleSelectedID.List.Current.Article_Activities.WaitForReviewersActivityID

ActivityId






On Close

Right click on Wait For Reviewers and add an On Close event


Double click on the 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 Decision

Node

Destination:

Editor\Post_Detail

ArticleSelectedID


Detail: GetArticle(ArticleSelectedID).Article.Title


Due Date: 

AddDays(CurrDateTime(),1)


Roles:

Editor


Create output parameter: 

ArticleStatusID


Create output parameter:

Comment


On Ready

Right click on Editor Decision and add an On Ready event


Double click on the On Ready event


Create an aggregate on the entity Article_Activities to correlate the article id with the editor decision activity id


Article_Activities.ArticleSelectedID = ArticleSelectedID


This will allow the application to know the editor decision activity context of this article.


GetArticleActivityByArticleSelectedID.List.Current.Article_Activities.ArticleSelectedID

ArticleSelectedID


GetArticleActivityByArticleSelectedID.List.Current.Article_Activities.EditorDecisionActivityID

ActivityId




On Close

Right click on Editor Decision and add an On Close event


Double click on the 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.




Application Changes


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


Support options
This asset is not supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from  who created this asset.
Dependencies
See all 2 dependencies