# MRV Document Operations

For a demo example of following steps, here is the policy timestamp: **1675164736.675731674**

### **Task Summary**

There are two roles: ‘**User*****’*** and ***‘*****Approver*****’***. *User* can create projects and send project definition documents to the selected *Approvers*. After the approval, *User* can add MRV reports to the project. On the basis of this documents the policy will be minting tokens into the account configured in the project.

### **Preparation**

1. Create 2 roles ‘**User*****’*** and ‘**Approver*****’*** and the corresponding containers

(See example 1 for the more detailed description of how to work with roles)

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FfMFOMmQbCY3DAkBrUlnT%2Fimage.png?alt=media&#x26;token=6ad43bce-fcd0-4b9d-8d16-8b351852b799" alt=""><figcaption></figcaption></figure>

2. Create all needed document schemas:

2.1 Schema for ‘**User*****’*** containing the fields: **First name**, **Last name**

2.2 Schema for ‘**Approver*****’*** containing the fields: **First name**, **Last name**

2.3 Schema for ’**Project**’ containing the fields: **Project name**, **Account ID**

In order to mint tokens into another account (not into the account of the minting user) setup the required field

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FZqKw6WBt4tWgLqoSLuvP%2Fimage.png?alt=media&#x26;token=6cd5fbcd-73cd-410f-bb6b-2f1baab59b60" alt=""><figcaption></figcaption></figure>

2.4 Schema for ’**Report**’ containing the following fields: **Start Date, End Date, Amount**

(Please see example 2 *for the more detailed description of how to work with Documents*)

3. Add blocks for registering ‘**User*****’*** and ‘**Approver*****’*** into the containers created in the step 1

**Note:** it is important that DID of the user is used for ID of the documents as this value will be used further in the document for filtration

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FwZ4TDkhv8OjcKp3l9qEp%2Fimage.png?alt=media&#x26;token=9b08665d-cf11-4229-b284-f907dad8ff59" alt=""><figcaption></figcaption></figure>

4. Add simplified grids for displaying Projects, Reports and Tokens

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FDEMNoIbcgfBqNxJN8Mor%2Fimage.png?alt=media&#x26;token=59ea448a-6640-45be-9bc1-b4b4a544cb36" alt=""><figcaption></figcaption></figure>

5. Create the token

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FlHb82JqKMbQqvF6mgeof%2Fimage.png?alt=media&#x26;token=8bd3c792-9423-4368-bea1-a0a928f9dce2" alt=""><figcaption></figcaption></figure>

### **Document Operations**

#### 1. Project Definition

**1.1 Create a project**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FCzNkPpZNoryssOLCvkXQ%2Fimage.png?alt=media&#x26;token=3b6afcfa-313e-4acd-b934-fbdc173cff40" alt=""><figcaption></figcaption></figure>

#### 1.2 Save the project

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FcU6gXEOEZo92hZZTsWUB%2Fimage.png?alt=media&#x26;token=0b15cc3d-3184-48d8-8061-4d79d1e2da9a" alt=""><figcaption></figcaption></figure>

#### 1.3 Link to the token

1.3.1 Since another (not current user) account is used for minted tokens ’**tokenActionBlock**’ cannot be used, instead we will use ‘**tokenConfirmationBlock*****’***

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FgvPWvOsmLjGUgKFg6bTY%2Fimage.png?alt=media&#x26;token=48481ee9-6534-4bff-a1e2-a3de6641e7a0" alt=""><figcaption></figcaption></figure>

1.3.2 To configure the target account for mixed tokens select ‘*Custom*’ value for ‘*Type*’ and the filed in the document from which to take the value for the Account ID (this field must have type: ‘**Account**’)

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F1KZQAiIcLkLnTUhye2xn%2FTemplate_4_screenshot_09.png?alt=media&#x26;token=623b907a-1e65-4dfb-8616-3d37a0f7a3ec" alt=""><figcaption></figcaption></figure>

1.3.3 By default ’**tokenConfirmationBlock**’ does not have a link to the next block, thus it needs to be manually added

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FzBgwh9nMr92zSZ96jRDs%2FTemplate_4_screenshot_10.png?alt=media&#x26;token=73129ef5-a24c-42d0-9e39-f1f1d410a8c1" alt=""><figcaption></figcaption></figure>

1.4 Add an approver as after the creation the project is not assigned to anyone

1.4.1 Add ’**interfaceActionBlock**’ wrapped into a container.

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FzF8PXGkPMmHt281Zlrna%2FTemplate_4_screenshot_11.png?alt=media&#x26;token=d5a36dd4-6662-46b2-a270-458e5c091778" alt=""><figcaption></figcaption></figure>

1.4.2 Select **Dropdown \_** value \*\*\*\* for **\_ Type**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F8K82im0Fah73DSy0DNtG%2FTemplate_4_screenshot_12.png?alt=media&#x26;token=ca992d94-968d-4daa-a899-a2ea10c6b8fd" alt=""><figcaption></figcaption></figure>

1.4.3 Use system field **assignedTo** to filter documents based on users they are assigned to.

Record value from **assignedTo \_** into\_ **Field** (This field will be changing our block)

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FQl1cqk90weP6M8J40gJA%2FTemplate_4_screenshot_13.png?alt=media&#x26;token=350fddda-5d76-4deb-9ebc-578dd702d017" alt=""><figcaption></figcaption></figure>

1.4.4 Configure values from which fields from the document would be labels, and which ones would be values

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FF2xN3dWwdPKV8mfjaxoH%2FTemplate_4_screenshot_14.png?alt=media&#x26;token=fa551435-4578-46bd-ad8a-c7cf82cd1547" alt=""><figcaption></figcaption></figure>

1.4.5 Use ‘**documentsSourceAddon**’ for data for **Dropdown*****.***

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F9hGmRLVJtkhvJlxVlaOZ%2FTemplate_4_screenshot_15.png?alt=media&#x26;token=9f1693f3-3be4-4325-9327-1da0014815f1" alt=""><figcaption></figcaption></figure>

1.4.6 Save the changed document

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FWO4pnmhHINHHrhY7FSzZ%2FTemplate_4_screenshot_16.png?alt=media&#x26;token=093a2779-b3e0-4109-9cdb-ff1bd746d873" alt=""><figcaption></figcaption></figure>

1.4.7 As ‘**documentsSourceAddon**’ does not have default events, we need manually add them.

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FMeU8BADT0j5WZsx8EivN%2FTemplate_4_screenshot_17.png?alt=media&#x26;token=e7f1a8d2-2c8c-4819-b538-40c3537a95e3" alt=""><figcaption></figcaption></figure>

1.4.8 Return to grid settings and add **Dropdown** into the target column.

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F554JtaIaGJIunZKgh5J5%2FTemplate_4_screenshot_18.png?alt=media&#x26;token=227bb888-9f1b-4cb3-b825-e6656d52e641" alt=""><figcaption></figcaption></figure>

1.5 Project Approval. Setting up the grid for project approvals.

1.5.1 To select only the projects assigned to the current Approver set the ‘**Assigned to User**’ flag

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F21l29kqZxCwWxhjgGhsq%2FTemplate_4_screenshot_19.png?alt=media&#x26;token=78db2b1e-4a65-4518-bdda-9e26134f24c9" alt=""><figcaption></figcaption></figure>

1.5.2 Add document approval block

*(Please see* [*example 2*](https://docs.guardianservice.io/technical-information/library-of-policy-examples/data-input-via-forms-using-roles-to-partition-user-activities) *for the more detailed description of this workflow)*

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FqX2gtF5S5kYxdLMIlIVE%2FTemplate_4_screenshot_20.png?alt=media&#x26;token=f70a54d9-c763-4df7-b276-6cbb14862380" alt=""><figcaption></figcaption></figure>

1.5.3 Add Approve button into the grid

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2Fn3aqhOVX98Awu7xoMnFI%2FTemplate_4_screenshot_21.png?alt=media&#x26;token=83955e98-2597-41cc-ad03-2f8c645ed857" alt=""><figcaption></figcaption></figure>

1.5.4 After the Approve, setup the KYC for the account connected to the project

Use ‘**tokenActionBlock**’ with the appropriate settings

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FTp9PQdNQc3vx2Xbde1vd%2FTemplate_4_screenshot_22.png?alt=media&#x26;token=fe5d02e5-1ea7-425a-b3a1-13f418b44f63" alt=""><figcaption></figcaption></figure>

1.5.5 Configure the signing/verification of the document with the Approver signature by adding ‘**reassigningBlock**’. This block creates a copy of the source document and re-signs it with the key of the selected user.

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FAStt5qTwG4qeNUYi5gyU%2FTemplate_4_screenshot_23.png?alt=media&#x26;token=ab91c15b-e88a-4aa5-80e4-83667e442224" alt=""><figcaption></figcaption></figure>

1.5.6 Add Status attribute for easy filtering

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FxbbuvmgNb67AwepmW73A%2FTemplate_4_screenshot_24.png?alt=media&#x26;token=4e66b41e-3758-40e4-a557-2f2e1b3c8d7c" alt=""><figcaption></figcaption></figure>

#### 2. Report.

To enable report creation only for approved projects, add create button into the grid selectively for documents with ‘Approved’ status

2.1 Add a ‘**documentsSourceAddon**' block to differentiate the documents on the basis of their status

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F090AUbkOnxqhSaPFm1S5%2FTemplate_4_screenshot_25.png?alt=media&#x26;token=de922f66-1be6-492d-9606-cc9225ec6951" alt=""><figcaption></figcaption></figure>

2.2 Repeat the sequence for project creation to create the report

{% hint style="info" %}
**Note:** switch off ‘**Default Active**’ since create report button does not need to be an independent object
{% endhint %}

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FhQHqsaVahiQoRvb3XWqc%2FTemplate_4_screenshot_26.png?alt=media&#x26;token=7e896ba9-5096-40d8-9fae-e3816efe90ea" alt=""><figcaption></figcaption></figure>

2.3 Add the button for creating reports into the grid

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FymlEoDMd3S6DVUjkkAmg%2FTemplate_4_screenshot_27.png?alt=media&#x26;token=31f993dd-69d3-401b-9b30-b6c2806d1e7d" alt=""><figcaption></figcaption></figure>

2.4 Use ‘**mintDocumentBlock**’ for creating (minting) tokens

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FiBooL3V95V9mCfXDbY1a%2FTemplate_4_screenshot_28.png?alt=media&#x26;token=ef8de4ec-473c-41b5-8bf0-92fb585134b1" alt=""><figcaption></figcaption></figure>

#### 3. Results

**3.1 Reports**

3.1.1 Add grid to display reports

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FMMaT2jdTlcUVSjWHYdcK%2FTemplate_4_screenshot_29.png?alt=media&#x26;token=45c6560c-e248-45a9-85e2-7f2d7f26bb60" alt=""><figcaption></figcaption></figure>

3.1.2 To filter reports on the basis of their project add dynamic filter ‘**filtersAddon**’

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FuFNYQSvb9jUPY3gNG3V9%2FTemplate_4_screenshot_30.png?alt=media&#x26;token=a41638ca-aaef-4946-8d4e-a8d7f3d8250b" alt=""><figcaption></figcaption></figure>

Adding FiltersAddon

3.1.3 Documents created on the basis of other documents are automatically linked via the ***ref*** field. Use it for filtration

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FfCP8PEIhsMpf1b1uXFOp%2FTemplate_4_screenshot_31.png?alt=media&#x26;token=dfad0a0b-79cd-45c4-8884-5b6edf015378" alt=""><figcaption></figcaption></figure>

3.1.4 Add the data source for the filter which will display all approved projects of the current user

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FfP3NP21F8rbZg9KQtNuJ%2FTemplate_4_screenshot_32.png?alt=media&#x26;token=2e3a72a9-7654-434c-84a1-d7afb2505017" alt=""><figcaption></figcaption></figure>

3.1.5 Add display of all minted tokens

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2Fj3PH8e6iZ7CItTMHUVK9%2FTemplate_4_screenshot_33.png?alt=media&#x26;token=a5492103-0991-41eb-aea7-e0bbc3b2e92a" alt=""><figcaption></figcaption></figure>

#### **Demo**

**Choose a role**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FinVjru6OZtFesEzw2fM2%2FTemplate_4_demot_01.png?alt=media&#x26;token=1dbdb776-17b9-4ecf-a0da-3a1c87b0ad46" alt=""><figcaption></figcaption></figure>

**Create Approver**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FRI2Kvlexd9qdJ7f8fHCP%2FTemplate_4_demot_02.png?alt=media&#x26;token=9520a126-a01c-4c40-a7b3-b7e90e55507c" alt=""><figcaption></figcaption></figure>

**Create User**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FCOJUCE1GVIZ6tZQVAoRn%2FTemplate_4_demot_03.png?alt=media&#x26;token=0b39aa93-185a-450c-827e-e84edd12f836" alt=""><figcaption></figcaption></figure>

**Create Project**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F8tw1f6ssCrKGx50OFDuH%2FTemplate_4_demot_04.png?alt=media&#x26;token=faa4b210-57c2-4aee-b5ee-65ad8bd6db89" alt=""><figcaption></figcaption></figure>

**Associate token**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FvbPwQARScbLfjLQWE34C%2FTemplate_4_demot_05.png?alt=media&#x26;token=3189f409-484a-4b3b-b85f-4a99d0281b82" alt=""><figcaption></figcaption></figure>

**Choose an approver**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FaFEy8ruvOD9B0OykDlO7%2FTemplate_4_demot_06.png?alt=media&#x26;token=03613529-c3d9-4440-9b56-3b6a8d909ca5" alt=""><figcaption></figcaption></figure>

**Approve project**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FKo8AL5yIwNiOTR6RdGmc%2FTemplate_4_demot_07.png?alt=media&#x26;token=3d8c9b2e-769b-44a8-9de0-f1931e52e9ff" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FIG1PWj1AU30BucicQygQ%2FTemplate_4_demot_08.png?alt=media&#x26;token=07f66c89-4223-43f7-a063-c7df06243db7" alt=""><figcaption></figcaption></figure>

**Create report**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FXbtr5DhYQYqZNRj4oK0m%2FTemplate_4_demot_09.png?alt=media&#x26;token=9cad56d5-ca46-4337-80d4-f35e325d1c2b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F4hSecGvh56HSpcgQFvVl%2FTemplate_4_demot_10.png?alt=media&#x26;token=5e3f8ce2-3938-4791-86de-0b510aaace1f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FlBgI37SL0Kc07X21DRzq%2FTemplate_4_demot_11.png?alt=media&#x26;token=84d483d9-ebc0-43c4-9e68-8df16855edd2" alt=""><figcaption></figcaption></figure>
