For a demo example of following steps, here is the policy timestamp: 1675164605.096601003
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.
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.
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.
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.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.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
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)
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'