Update an Exisiting Document
Learn how to update a document you previously created.
Set up your account
Before using components from the React SDK, see the First document use case to set up your platform account and get the API key.
Create your document
SFS provides you with two ways of creating documents: by using an API request (API way) or via our React UI (visual way). Let’s create a simple document using our API.
To do this, you can use this request. Learn more here.
As a response, you will receive a Contract Key:
Render your document
Awesome, you’ve just created your document and even added two placeholders to it. To view the document,
use the Contract Editor component and enter the Contract Key you’ve just
received as a contractKey
property for the component.
New contract
By using this component and a Contract Key, you can continue editing the document, adding and removing placeholders and recipients, and do everything you need to with documents. All changes will be saved to this specific document.
Allow users to recreate documents
In some cases, you may need to allow users to recreate the content of documents that already exist —
either by uploading their own Word/PDF file or selecting a template.
In such cases, you should use the canReDraft
=true
property of the Contract Editor.
This enables users to start the creation process from scratch for a document that already exists.
If the existing document already has placeholders included, the system will also route these flows accordingly:
- If a user uploads a Word/PDF file or creates a document from scratch, the placeholders will remain untouched.
- If a user selects a template that does not contain placeholders, then the placeholders will remain untouched, and the content will be populated from the selected template.
- If a user selects a template that already contains placeholders, then the system will do the following:
- Populate the content from the template into the document.
- Read all the placeholders from the template and all the placeholders from the document and merge them. For placeholders with the same names (on the template side and on the document side), the system will transfer the values from the document’s placeholders to the template’s placeholders.
- Document-side placeholders that don’t match any placeholder on the template side will remain untouched.
So, for example, if you have a document with a placeholder Name1
and value DocValue1
, and a template with placeholders
Name1
and value TempValue1
and Name2
and value TempValue2
, the resulting document will contain the content from the template and
two placeholders: Name1-DocValue1
and Name2-TempValue2
.