> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/appian/smart-services/merge-redact.md).

# Creating a simple process model with merge & redact

Learn how to create a process model using Merge and Redact smart services with this comprehensive guide. Find out how to add and configure these services in your workflow using Apryse PDFNet Smart Ser

## Overview

This guide will show you how to create a simple process model using the merge and redact smart services. They are two separate smart services, each representing a document processing step in your workflow. The smart services come out of the box with the [Apryse PDFNet Smart Services](/appian/smart-services/smart-services.md). This guide is a simple example and you are free to use these services in your process model and workflow as you deem fit.

{% hint style="info" %}
As a prerequisite, you should have the Apryse Smart Services Plugin installed.
{% endhint %}

## Adding a Process Model

Go into the app in Appian where you want to add and use a process model for document processing from the Appian designer. You can even modify an existing one if you want.

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-5d652215865911698a1ddebbad4575d1b81f872f%2F345cad0de18abccc0b6a9a7efbf5a99ee01dbe71-380x418.png?alt=media)

If you are creating one from scratch, you can name it whatever you want. The default permissions should be fine but feel free to adjust this to the requirements of your app and organization.

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-f95f347431b2e746996e2f3c5d031c75ed5677b5%2F697913ada4a26a04eb0c4662850020fe3721081b-1464x926.png?alt=media)

Once created, Appian should take you into the process modeler.

## Adding the Smart Services

Once loaded into the process modeler, you should presented with your workflow. If you created a new process model, there should be no services or steps in your model initially.

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-60913518bcb116e4720a4cffb549d36823eb4727%2F0a5d74b3432262aefcd97e558c5445ffe89a6519-2398x730.png?alt=media)

To add smart services from our Apryse PDFNet Smart Services Plugin, filter the service in the left panel using the input field at the top. Use the `apryse` search term to find all services that we provide.

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-3b6e9e9d003c174d2d6248491815fb48a3130ed0%2Fffecef42ab22bcc6fd5b2884b0bbb94a2df11bbd-223x228.png?alt=media)

We will add the `Merge Documents` and `Search & Redact Documents` services to the workflow for this example. We will first perform a merge first before redacting. This will redact from all merged document pages, but you can rearrange the steps so that redaction occurs on a certain document instead.

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-dd96bc46fcfabeefe196bad250ae116c849b22c7%2F82921865b1dcfc37dc964f9a5f3870bf581b9073-1189x369.png?alt=media)

## Configuring the Merge Smart Service

As the name suggests, the service merges multiple documents into one output document. We will need to tell the service what to merge and how to save. You can define process model parameters or variables that define which document to merge or even on how to save.

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-1360eccba1125ade5064779975f1af3b8e6f329b%2F005a7194e0e65377eacfe2d7441fe67d9546d138-856x647.png?alt=media)

Parameters:

* Document Ids - The IDs of the documents that will be merged together. You can use the document browser to look for the documents you want to merge.
* Filename - The name of the file when saved to the system.
* Save As New Document - Whether to save the merged document as a new document or overwrite the first of the input documents.
* Save Folder Id - The ID of the folder where the merged output will be saved. You can use the document browser to look for the folder you want to save the document in.
* Should Linearize Output - whether to linearize the document on save (read more in [WebViewer best practices](/web/best-practices/best-practices.md#linearize-pdf-files)).

As outputs of the smart service, you will get the output document ID that could be stored in a variable, and used in another service or task further down the workflow.

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-85e8492dd979a17f156d88464275a240d1a498c7%2F6bd29c71b4a2dbad43bd03da095dbdc01b5083e0-852x566.png?alt=media)

There are also additional outputs for error handling if you want to enter an error case in your workflow.

Outputs:

* Output Document ID - The ID of the merged output document. If `Save As New Document` is set to `false`, this will be the ID of the first document in the input list.
* Has Error - Whether an error occurred or not.
* Error Message - The error message of the error that occurred.

{% hint style="info" %}
The input and output parameters listed here are subject to change in new versions of the smart service. Please refer to the actual parameters in the smart service you are using.
{% endhint %}

## Saving the Output ID to a Process Variable

When the service merges the documents, you will get an output document ID. This ID can be saved to a process variable to be used in the next service. This is done by clicking on `+` icon next to the `Target` field.

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-3db419d4b079935a0ae865bd6f5ed0c149a13e2e%2F33978f6f3f76fe3677bcaa1b87bca0d59354d97d-403x334.png?alt=media)

You can change the variable name as needed here.

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-98988c47e6a7ee327b31329ec93536c59545e1ca%2Febfb580ab62ff3597bb9bc99aef27859163d267c-696x387.png?alt=media)

## Configuring the Search & Redact Smart Service

The Search & Redact smart service is essentially a redaction service. It will search for a term and redact it from the document. The redaction term can be a string of the term to be redacted or a pattern defined as a regular expression. This will redact the found terms from all pages of the merged document.

Note that the output ID from the previous merge step can be saved to a process variable and provided as the document ID here. This is done with the following SAIL expression:

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
=document(pv!outputDocumentId, "id")
```

{% endcode %}
{% endtab %}
{% endtabs %}

![](https://1373770520-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQBPkEFulYTrl1g37jENZ%2Fuploads%2Fgit-blob-3650625b08f6d80856d9c2854bc3d37f7547435a%2Fd9dd0b934cb5c4274520fa6041be63c2e9914212-855x647.png?alt=media)

Parameters:

* Document Ids - The IDs of the documents that will be redacted. You can use the document browser to look for the documents you want to redact.
* Search Term - The term the service will look for to redact. This can take a regular expression.
* Save As New Document - Whether to save the redacted document as a new document or overwrite the input document.
* Save Folder Id - The ID of the folder where the redacted output will be saved. You can use the document browser to look for the folder you want to save the document in.
* Prefix - The prefix to be added to the filename of the document after redaction. Only used if `Save As New Document` is set to `true`.
* Suffix - The suffix to be added to the filename of the document after redaction. Only used if `Save As New Document` is set to `true`.
* Should Linearize Output - whether to linearize the document on save (read more about [linearize pdf file best practices](/web/best-practices/best-practices.md#linearize-pdf-files))

{% hint style="info" %}
The input and output parameters listed here are subject to change in new versions of the smart service. Please refer to the actual parameters in the smart service you are using.
{% endhint %}

As with the merge service, the outputs are the same.

## Executing the Process Model

This process model can then be started with the `startProcess` function in Appian anywhere where it is needed. To summarize, this process model will first merge two documents together into a new file before redacting a term from all the pages of the merged document. This assumes you are providing the resulting output document from the previous step as the input to the next.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/appian/smart-services/merge-redact.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
