đĸData input via Forms, using Roles to partition user activities
For a demo example of following steps, here is the policy timestamp: 1675164605.096601003
Objective
Construct a policy in which one group of users can individually fill in and submit documents for approval and view their own documentsâ status, and another group of users can view and take approve/reject actions on any of these user documents.
Approach
Assign âUserâ and âApproverâ roles to users to partition them into groups where one can fill in forms and send resulting documents to approvals, and the other group would âapprove/rejectâ these documents.
Create schema and necessary policy elements to enable âform-filling in and submissionâ and âapprovalâ workflows.
Preparation
Create 3 containers which will be responsible for choosing a role, submission and approval documents correspondingly.
Assign these containers to appropriate Permissions: âno_roleâ, âUserâ, or âApproverâ, and add the first containers into the RoleSelectionBlock.
See detailed information about the Roles in Example 1.
Main section
Creating the document
1. Create a schema for Policy data input
1.1 Go to âSchemasâ tab and create a new schema
1.2 To make sure there is some demo/test data content in this schema create 3 fields:
Organization name of type âStringâ
Start Date of type âDateâ
End Date of type âDateâ
Amount of type âNumber to represent the amount of CO2 emissions for the time period (between the âStart Dateâ and âEnd Dateâ)
2. To perform data input into the Policy the ârequestVcDocumentBlockâ will be used
2.1 Since the scope of this example includes input of multiple documents the Policy requires logic similar to what is known as âloopâ or âiterationâ.
For this âinterfaceStepBlockâ is required with âCyclicâ option enabled. This will allow to return to the initial state after the document was saved.
2.2 Add ârequestVcDocumentBlockâ into the âcyclic_containerâ
2.3 Then select the previously created Schema
2.4 Select âNew UUIDâ to configure automatic generation of unique IDs for each document
2.5 By default ârequestVcDocumentBlockâ is displayed as a Form covering the entire page. To prevent this choose âDIALOGâ value for the field âTypeâ.
3. Save documents in the Database.
3.1 Add âsendToGuardianBlockâ into the container âcyclic_containerâ immediately after âcreate_new_documentâ
3.2 Select data type and where to store the document
3.3 Create appropriate attributes to capture/store document status
Add âStatusâ attribute and set the initial âNewâ value for new documents
Displaying the documents
To display documents âinterfaceDocumentsSourceBlockâ is used
1.1 Add âinterfaceDocumentsSourceBlockâ into the âuser_rolesâ container
1.2 Specify the needed columns, their titles and where the values will be taken for display
1.3 To retrieve the data from the database âdocumentsSourceAddonâ block is used
1.3.1 Add âdocumentsSourceAddonâ to the âuser_gridâ
1.3.2 Select where to retrieve the documents from
1.3.3 Select the schema upon which the selected documents should be based on
1.3.4 Select âOwned by Userâ checkbox which would filter in only the documents that are created by this user (this will disable the ability to view other documents)
Approving the documents
To display documents âinterfaceDocumentsSourceBlockâ is used
1.1 As in the previous section we added âinterfaceDocumentsSourceBlockâ and configured displayed columns
1.2 Add additional column which would contain the âApproveâ button
1.3 Since the Approve button should be displayed only for new documents use two âdocumentSourceAddonâ block
Configure both âdocumentSourceAddonâ blocks similarly to how it was in the previous sections, except here do not select the âOwned by Userâ checkbox to allow the Approvers to see all documents (created by all users)
1.4 Separate the documents by status by means of creating the corresponding filters
To enable actions (in this example âApproveâ and âRejectâ) the âbuttonBlockâ block is used.
2.1 Best practice is to wrap the âbuttonBlockâ block in a container
Switch off the âDefault Activeâ option to avoid specifying the button as an independent element and hide it
2.2 Create 2 buttons for âApproveâ and âRejectâ correspondingly.
2.3 âbuttonBlockâ is responsible only for the actions, in order to save the refreshed status of the documents.
Create 2 âsendToGuardianBlockâ blocks with the corresponding values for the âStatusâ.
2.4 By default blocks are always directly connected to the next block (just below it). To decouple the blocks select âEventsâ tab and switch off the default events for both blocks.
2.5 Connect events from the âbuttonBlockâ with the corresponding âsendToGuardianBlockâ by selecting the Events tab and create 2 new events.
Return to the grid settings and add the created buttons into the previously prepared column
3.1 Set âTypeâ to âBLOCKâ
3.2 Set âBind Blockâ to the block which we can place into the column
3.3 In order to display the buttons for only new documents set the corresponding value for the âBind Group'
Result
1. Choose a role
2. Create new document
3. Approve
Last updated