The topic "Adobe Sign Workflow Sample - Single Signer" is not available in Version 3.5.
The topic "Adobe Sign Workflow Sample - Single Signer" is not available in Version 3.6.
Adobe Sign Workflow Sample - Single Signer
The following procedure details a sample workflow and forms for a sequence that contains single signer.
Prerequisites
-
The Adobe Sign properties are configured in Forms Builder. See SignNow Settings.
-
A form sequence with the necessary Adobe Sign components for a single signer is created. In our example, the Anonymous property of the sequence is selected.
Note: If you create a non-authenticated sequence, make sure that the user's email address is included in the sequence. The email address is required as the Adobe Sign recipient address.
-
A form that contains an IFrame component is created. In our example, this form is named Default-Frame with the following properties (case sensitive):
- Name = AdobeSignFrame
- Url = {{vm.models.frameUrl}}
The IFrame form can be part of the initial sequence; however, in the procedure below, we are adding the form to the workflow.
We recommend that you copy the original Default-Frame form, edit the copy, and use it in your sequences. Save a backup copy of your form.
To optimize the display of your e-signature forms on mobile devices, you may want to add the CSS described in this Note.
Create the Workflow
-
Launch Workflow Composer and open the workflow. See Open the Workflow for a Sequence.
-
In Workflow Composer, drag the State icons and Transition lines to so that you can easily locate each item in the StateMachine workflow.
The workflow requires the following arguments and variables. You can create these arguments and variables before working on the activities, or you can add them when they are needed for a specific activity (as described below).
Keep in mind that arguments are passed in JSON format and that JSON elements are case sensitive. Be sure to match the casing of argument names in Workflow Composer and Form Designer. |
LogLine Activities
While testing and troubleshooting the workflow, we recommend adding LogLine activities at critical stages within the workflow. The following expression will provide logging for specific objects (replace <object> with the object name):
Newtonsoft.Json.JsonConvert.SerializeObject(<object>, Newtonsoft.Json.Formatting.Indented)
For example, to capture errors related to the CreateAdobeSignRequest activity, you would place a LogLine activity with the following expression below the CreateAdobeSignRequest activity.
Newtonsoft.Json.JsonConvert.SerializeObject(AdobeSignRequest, Newtonsoft.Json.Formatting.Indented)
We recommend setting the Level value to Information for any LogLine or LogObject activities. See Best Practices for Logging and Logging in Azure.
Note: If your sequence is non-authenticated (Anonymous=true), the LookupUser and GetEntity activities are not applicable, but a CreateEntity activity may be needed instead. Be sure that any anonymous sequence includes the user's email address. It is required as the Adobe Sign recipient address.
The first step is to capture the information of the user who logged in to the form.
- Create a variable named studentId of Type Int32.
-
Drop a LookupUser activity in the Entry area of the Welcome form.
- In the UserId property, specify studentId. This is the variable created in the previous step.
- In the UserName property, specify formInstance.UserName. The user name is retrieved from the login account information.
-
Drop a GetEntity activity in the below the LookupUser activity.
- In the EntityId property, specify studentId.
- In the Result property, specify studentEntity.
Workflow Composer automatically wraps the activities in a Sequence.
-
Save the workflow locally and continue with the next set of steps.
Since the workflow can be busy for a long time, we recommend that you persist the workflow instance before creating the PDF.
-
Double-click the Next transition from the form that is used to collect the data, CMC_Student_Personal Info.
-
Drag a Persist activity into the Trigger area below the Next activity. The Persist activity does not require any properties to be specified.
Workflow Composer automatically wraps the Next and Persist activities in a Sequence.
-
Save the workflow locally and continue with the next set of steps.
-
In Workflow Composer, click the Arguments tab.
-
Create an argument named frameUrl. Set the Direction to In/Out. Set the Type to String.
Be sure to use the exact casing shown here.
-
Click the StateMachine link in the Designer pane.
-
Drop a State activity onto the transition line after the Next transition from the form that contains the Adobe Sign components (CMC_Student_Personal Info).
-
Change the default name of the State activity to the name of the form that contains the IFrame. In our case, the name is Default-Frame.
-
Save the workflow locally and continue with the next set of steps.
In the following steps we will create a set of activities in the Default-Frame State, which represents the IFrame form.
-
Double-click the State icon of the form that contains the IFrame component.
-
Create a variable named URL. Set the Variable type to String. Set the Scope to StateMachine. This variable will be assigned to the PDF that will be created from the form.
-
Drop an Assign activity into the Entry area of the State.
-
In the To field, specify the variable name URL.
-
In the Value field, specify the following:
forminstance.RendererBaseUrl + "#/viewCreator/" + formInstance.WorkflowDefinitionId.ToString + "/forms=CMC_Student_Personal_AdobeSign"
Where "/forms=CMC_Student_Personal_AdobeSign" indicates the Forms Builder form that contains the Adobe Sign components.
Notes
-
If the form name has a space, replace the space with a + sign, e.g., CMC_Student_Personal+Info_AdobeSign
-
If multiple forms are sent to Adobe Sign, specify a comma-separated list of form names in the "/forms=" attribute.
-
-
-
Drop a Persist activity below the Assign activity.
-
Create a variable with a name like Pdf. Set the Scope to StateMachine. This variable will hold the document image created from the form.
Note: Make sure you use the same variable name when you reference this variable later in the workflow. (This applies to any other variable.)
-
In the Variable type field, select Array of [T] and select Browse for Type.
-
In the "Browse and Select a .Net Type" window, specify "byte", select the System variable "Byte", and click OK.
-
-
Drop a PrintUrlToPdf activity below the Persist activity.
Specify the properties for the activity as follows:
-
PdfDocument = Pdf (This is the name of the variable created above.)
-
Url = URL (This is the name of the variable created above.)
-
Validation Messages = formInstance.ValidationMessages
-
-
Save the workflow locally and continue with the next set of steps.
In the following steps we will continue to add activities to the Default-Frame State, which represents the IFrame form.
-
Create a variable named AdobeSignConfig. Set the Scope to StateMachine.
In the Variable type field, select Browse for Type. In the "Browse and Select a .Net Type" window, scroll down to Cmc.Nexus.FormsBuilder.Contracts > Cmc.Nexus.FormsBuilder.Entities and select AdobeSignConfig.
-
In the State of the IFrame form, drop a GetAdobeSignConfig activity below the PrintUrlToPdf activity.
Specify the properties for the activity as follows:
- AdobeSignConfig = AdobeSignConfig
- Validation Messages = formInstance.ValidationMessages
The GetAdobeSignConfig activity retrieves the User Name, Password, Integrators Key, and REST API Url from the Adobe Sign settings in Forms Builder. These values enable the workflow to log in to Adobe Sign.
To process the Adobe Sign request, the Email Subject needs to be assigned to the AdobeSignConfig variable. This property is required.
-
Create the following variables:
Variable Name Type Scope Default AdobeSignDocument Cmc.Nexus.FormsBuilder.Entities.AdobeSignDocument StateMachine New AdobeSignDocument AdobeSignRecipient Cmc.Nexus.FormsBuilder.Entities.AdobeSignRecipient StateMachine New AdobeSignRecipient AdobeSignRequest Cmc.Nexus.FormsBuilder.Entities.AdobeSignRequest StateMachine N/A -
Below the GetAdobeSignConfig activity, drop an Assign activity for each row in the following table and type the indicated values:
"To" Field Value Notes AdobeSignConfig.EmailSubject "CMC Campus AdobeSign Testing" This is the email that the end user will receive after the signing process is done. AdobeSignDocument.DocumentId "1" When multiple AdobeSign documents are included in the same AdobeSign envelope, every document needs a unique Id. In this example, there is only one document. AdobeSignDocument.Name "StudentInfoPdf.pdf" Name of the signed document. AdobeSignDocument.Content Pdf Name of the variable that holds the document image (see Create a PDF of the Form). In our example the name of the variable is Pdf. AdobeSignRecipient.FirstName studentEntity.FirstName First name of the user who submitted the signed document. AdobeSignRecipient.LastName studentEntity.LastName Last name of the user who submitted the signed document. AdobeSignRecipient.Email AdobeSignConfig.SignerAccountEmail Email address of the person who will receive the signed document. -
Save the workflow locally and continue with the next set of steps.
In the following steps we will continue to add activities to the Default-Frame State, which represents the IFrame form.
-
Drop the CreateAdobeSignRequest activity below the previous activity.
Specify the properties for the CreateAdobeSignRequest activity using the names of the variables created above as follows:
Warning: Do not enter anything in ResumeBookmark if you are creating single signer workflows. This could cause InstanceHandleConflictExceptions and aborted workflows. Fill this in only for Multi-Signer workflows.
-
Drop an If activity below the CreateAdobeSignRequest activity.
-
In the Condition field, specify formInstance.ValidationMessages.HasErrors.
-
In the Else branch, drop an Assign activity.
In the To field, specify frameUrl. (This is the argument associated with the IFrame form.)
In the Value field, specify AdobeSignRequest.Url.
Be sure to use the exact casing shown here.
-
-
Save the workflow locally and continue with the next set of steps.
In the following steps we will create activities in the Submit transition which follows the IFrame form.
-
Double-click the T1 transition after the Default-Frame state and rename it as Submit.
-
Drop a WaitForFormBookmark activity into the Trigger area of the Submit transition.
-
Rename the WaitForFormBookmark activity as Submit.
-
Create a variable named AdobeSignedDocument. In the Variable type field, select AdobeSignDocument. Set the Scope to StateMachine.
-
Drop a GetAdobeSignSignedDocument activity below the Submit activity.
Specify the properties for the activity as follows:
- AgreementId= AdobeSignRequest.AgreementId
- AdobeSignConfig = AdobeSignConfig
- AdobeSignDocument = AdobeSignedDocument (This is the name of the variable created above.)
- Validation Messages = formInstance.ValidationMessages
Workflow Composer automatically wraps the activities in a Sequence.
-
Save the workflow locally and continue with the next set of steps.
You can log in to your Adobe Sign account and view the signed document "StudentInfoPdf".
Note
Adobe Sign provides signers the Decline to form fill option.
If the decline option is selected:
The signer will see a webpage (IFrame) stating "You declined to sign <PDF name>."
The signer will receive an email stating that Adobe Sign terminated the agreement exchange.
Adobe Sign will not return control of the sequence to Forms Builder and the workflow will not continue. The workflow will remain as a persisted instance. You will need to terminate persisted workflows periodically using either Sequence Designer (see Delete Persisted Workflow Instances) or Workflow Composer (see Persisted Workflows).
To convert an Adobe Sign document to a DocumentEntity that can be attached to a record in Anthology Student, add CreateDocument and SaveDocument activities to the workflow. These activities will be placed in the Submit transition.
-
Create a variable named Doc. Set the Scope to StateMachine.
In the Variable type field, select Browse for Type. In the "Browse and Select a .Net Type" window, scroll down to Cmc.Nexus.Crm.Contracts > Cmc.Nexus.Crm.Entities and select DocumentEntity.
-
Drop a CreateDocument activity below the GetSignedDocument activity.
Specify the required properties for the activity as follows:
- Module = Select a Module from the drop-down list.
- Document Type = Select a Type (Template) from the drop-down list.
- Document Status = Select a Type from the drop-down list.
- Student = Specify a Student Id or use a variable.
- Due Date = Specify a date or use a variable, e.g., DateTime.Now
- Document (OutArgument) = Doc (This is the variable created above for the DocumentEntity.)
- Validation Messages = formInstance.ValidationMessages
-
Below the CreateDocument activity, drop an Assign activity for each row in the following table and type the indicated values:
"To" Field Value Doc.DocumentImage SignedDocument.Content Doc.OriginalFileName "Signedpdf.Pdf" Doc.ImageType "Pdf" Doc.IsDocumentAddedManually true -
Drop a SaveDocument activity below the CreateDocument activity.
Specify the properties for the SaveDocument activity as follows:
- Document (InOutArgument) = Doc (This is the variable created above for the DocumentEntity.)
- Validation Messages = formInstance.ValidationMessages
-
In the Condition field of the Submit transition, specify the following (to prevent users from submitting a form that has validation errors): Not formInstance.ValidationMessages.Has Errors
-
Save the workflow locally and continue with the next set of steps.
-
Click Publish. The New Workflow Definition Version window is displayed.
-
If you want the workflow to be run as soon as the event occurs on the entity, select Enable This Workflow Version?, otherwise leave the check box cleared.
-
Click Save, then Cancel to close the publisher window.
-
In the Sequence List, select and complete the form that contains the Adobe Sign fields.
-
Verify that the signed Adobe Sign document is available at the return URL.
-
Verify that the signed document is added to the Anthology Student database.
Note: While testing your workflow, make sure that you terminate the previous instance of the workflow before running an updated version of the same workflow. In Workflow Composer, click Open Persisted Workflow, select your workflow instance, and click Terminate.
In Forms Builder 3.6 and later, persisted workflow instances can be deleted from the Sequence Designer workspace. For more information, see Delete Persisted Workflow Instances.