FlowState
FlowState is the part that shows the status of the flow.
- FlowState 0 - the flow is pending.
- FlowState 1 - the flow is in process and is positive based on the end user's decision.
- FlowState 2 - negative based on the end user's decision.
- FlowState 4 - it indicates that after the notification sent for approval is sent to more than one person connected with "or", when one of them approves or rejects, action is taken in the system on behalf of the others.
FlowProses
FlowProcess is the code of the relevant processes. The explanations of the codes are as follows;
- a1 = Start
- a2 = End
- a4 = Formula
- a7 = Create Document
- a13 = Find User
- a17 = Send Email
- a22 = SubFlow
- a23 = Send Approval
- a26 = DbQuery
An example of a query that can be reported in the list for the Approval Status and flow report is as follows.
SELECT tableDetail.UserTableID,
tableDetail.DocNo,
tableDetail.CreateUser,
tableDetail.CreateDate,
tableDetail.Defination,
CASE WHEN MAX(FlowState)=1 THEN ‘Approved’
WHEN MAX(FlowState)=2 THEN ‘Rejected’
ELSE ‘Pending’ END AS FlowStatusFROM TABLO_ADI AS tableDetail WITH (NOLOCK)
LEFT JOIN XPODA_WORK_FLOWS on FlowDocumentID = UserTableID AND FlowProjectID = ProjectID
WHERE FlowProses = 'a23' AND FlowState in (0,1,2) and FlowUserID!=’$PActiveUser$’
If there are situations where more than one person goes for approval, a group by statement can be added to the status field to prevent the select result from copying records. In the example above, records that have passed the approval of the Active user are filtered in the query instead. If FlowUserID is removed and group by is added, the approval status of all users will be visible.
/*group by*/
GROUP BY tableDetail.UserTableID,
tableDetail.DocNo,
tableDetail.CreateUser,
tableDetail.CreateDate,
tableDetail.Defination
For multiple approval processes, flow status information for a specific approval can be displayed, such as FlowItemText ='Administrator Approval'.
- When you write a query to pull the FlowDocumentID and FlowProjectID records to check whether the flow has started or not, the records that come as a result of the query show that the flow exists and has started. An example query is as follows;
SELECT CASE WHEN exists(
SELECT * FROM XPODA_WORK_FLOWS
WHERE FlowDocumentID = TABLO_ADI.UserTableID and FlowProjectID= TABLO_ADI.ProjectID)
THEN 0 ELSE 1 END
Note: The flow should always be checked with the ProjectID and UserTableID fields. Since 1 flow can be added for each project, it is necessary to use these 2 fields together in join queries or validations to distinguish the flow of each form.