# 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](/guardian-dev/guardian/standard-registry/policies/library-of-policy-examples/creating-and-using-roles.md) for the more detailed description of how to work with roles)

![Creating 2 roles](/files/LgHANAzFoy0rer2H9Wsy)

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

![Setting up new account](/files/1vmTAv69xtN3wF682svY)

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

(Please see [example 2](/guardian-dev/guardian/standard-registry/policies/library-of-policy-examples/data-input-via-forms-using-roles-to-partition-user-activities..md) *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

![Adding DID as ID Type](/files/ofGRlXwgcKvaVFirwtdl)

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

![Adding grids](/files/fMRVzncT2J1s7yJaNfzr)

5. Create the token

![image5.png](/files/6bZqNAKkzv5Dkn41gNeo)

## **Document Operations**

### 1. Project Definition

#### 1.1 Create a project

![Creating project](/files/jHPM3W8np16DjqQ9uaN1)

### 1.2 Save the project

![Saving Project](/files/LQdY3yIaS1rnacOYKYBD)

### 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*****’***

![Adding tokenConfirmationBlock](/files/audvy1b6mQRJFvSV2eMW)

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**’)

![Selecting Account Type and Id](/files/2MMaif45DbjfXcgJ0t2P)

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

![Manually adding tokenConfirmationBlock to next Block](/files/gmkv4WSQ50BvIJHkgTJq)

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.

![Adding interfaceActionBlock](/files/46NF3VkPSlI7lUeFPbxD)

1.4.2 Select **Dropdown** *value* *for* **Type**

![Selecting Dropdown value](/files/QlF7GvmE5FmRHEyfutHG)

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)

![Using system Field assignedTo](/files/8hIQfhpkOZWej4YeFbw4)

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

![Configuring labels and values](/files/o0Rjfg7lH5OVW3lGykUb)

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

![adding documentSourceAddon](/files/JaU1viIcs0O4P1dDkgeK)

1.4.6 Save the changed document

![Saving the documents](/files/nM0c4tld9BZOv6VsgrzK)

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

![Adding events](/files/DBoBuICBOGiXHuM8Izt5)

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

![Adding Dropdown to target column](/files/VpCrvhOfYyGLWnHcVE0Y)

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

![Setting up Assigned to User flag](/files/BSx5jJN5RbzRApIoHUKw)

1.5.2 Add document approval block

*(Please see* [*example 2*](/guardian-dev/guardian/standard-registry/policies/library-of-policy-examples/data-input-via-forms-using-roles-to-partition-user-activities..md) *for the more detailed description of this workflow)*

![Adding document approval block](/files/EF78iteNhTtX00WaHbKd)

1.5.3 Add Approve button into the grid

![Adding Approve button to the grid](/files/2tYOPyHSvn8bEWH4JDd7)

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="/files/HSLdbATk0fT6SKPaBTVG" 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="/files/gS28kErEM5Z4FcUixW3I" alt=""><figcaption></figcaption></figure>

1.5.6 Add Status attribute for easy filtering

<figure><img src="/files/U3cF7qnOX1c0kGuCrzSJ" 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="/files/oOXDOaOpl1GSC63s6HBR" 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="/files/0tcfXInTEaBYBNpvmFib" alt=""><figcaption></figcaption></figure>

2.3 Add the button for creating reports into the grid

<figure><img src="/files/hyD5I5rKKSvGxRcN5oEt" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/62lVpZFiKY05Xbi3vD0e" alt=""><figcaption></figcaption></figure>

### 3. Results

#### 3.1 Reports

3.1.1 Add grid to display reports

<figure><img src="/files/8ynY4lM7XeyMuOiQ5Jaw" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/Y53HwwMMQH8EGLoeh6NF" alt=""><figcaption><p>Adding FiltersAddon</p></figcaption></figure>

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="/files/y9lqfX02f8CznmA5XcAC" 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="/files/CgccIdsWK0CdtJ8v8vB1" alt=""><figcaption></figcaption></figure>

3.1.5 Add display of all minted tokens

<figure><img src="/files/nUSl7TxZnzVrl9R9ujDQ" alt=""><figcaption></figcaption></figure>

### **Demo**

#### Choose a role

<figure><img src="/files/uN9Wu4dH3bxL1fMpKZ6l" alt=""><figcaption></figcaption></figure>

#### Create Approver

<figure><img src="/files/45p9PuaoaOqojMqMd6yU" alt=""><figcaption></figcaption></figure>

#### Create User

<figure><img src="/files/5YJECPToxwEYIjSJbH0h" alt=""><figcaption></figcaption></figure>

#### Create Project

<figure><img src="/files/pHf2C1YxXG1jOAi7afYz" alt=""><figcaption></figcaption></figure>

#### Associate token

<figure><img src="/files/Cu8syMKRMwRwsTfl9FT6" alt=""><figcaption></figcaption></figure>

#### Choose an approver

<figure><img src="/files/f8nvFTpunftxqzssgNi1" alt=""><figcaption></figcaption></figure>

#### Approve project

<figure><img src="/files/owSNbNhy8Jf49RsueN5S" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ERXnJdGK3sQGXFGDfAyV" alt=""><figcaption></figcaption></figure>

#### Create report

<figure><img src="/files/T7Q3Nkud5Jpqw5BYoReR" alt=""><figcaption></figcaption></figure>

<div><figure><img src="/files/YqTVPWgwQxoBJbJMVTsG" alt=""><figcaption></figcaption></figure> <figure><img src="/files/oRkKZr6uPDCBfZomHOvK" alt=""><figcaption></figcaption></figure></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guardian.hedera.com/guardian-dev/guardian/standard-registry/policies/library-of-policy-examples/mrv-document-operations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
