Configure the S-Docs LWC for Document Generation in Experience Cloud

Introduction

Harness the power of the S-Docs Lightning Web Component (LWC) library to empower admins and users to streamline workflows and enhance end-user experiences.

This article covers configuration on an Experience Cloud Site for both the Generate Documents and Documents list Lightning Web Components. These LWCs work best when used together on a page.

You are ready to configure when:

  1. You know how to navigate to and customize a record page using the Experience Cloud Builder.

  2. You have authored templates for the object you are customizing.

Sharing Settings

A few things to consider before you start configuring the LWCs for an experience cloud site:

  1. Experience cloud has a different record sharing model than your internal users. Make sure you Sharing settings are suitably updated to include the correct sharing needed for the base objects that are used by your templates.

  2. Sharing for SDOC__SDTemplate, SDOC__SDoc__c, and SDOC__SDRelationship__c: S-Docs uses custom objects that hold the templates, generated documents, and the documents' relationship to the base record. The sharing settings for these need to be also updated to ensure external users like community users can see the corresponding records. Depending on your use case you may choose to limit what templates are visible to your end users. You can use any of the standard Salesforce techniques in order to share these records with community users. If you don’t configure sharing correctly, the templates that you select in the LWCs in the following steps will not show up for your end users.

Permission Set(s)

There are some new apex classes that support the Experience Cloud and LWC. As of the October '23 release, these are included in the SDocs LWC Community User permission set.

For an org running the September '23 release, an org admin will need to add the below apex classes to a custom permission set to assign to community users.

Create a new permision set called “SDocs LWCs” and add the following apex classes to that permission set:

  • SDOC__DocumentSDK
  • SDOC__ESignSDK
  • SDOC__BaseRecordTemplatesPicklist
  • SDOC__Exceptions
  • SDOC__FieldUtility
  • SDOC__Logger
  • SDOC__LwcUtil
  • SDOC__SDoc
  • SDOC__SDocEmail
  • SDOC__SDocPDF
  • SDOC__SOQL
  • SDOC__SecureQuery
  • SDOC__TemplateEmail

Once you have created the permission set, assign this to your community user. Depending on your process flow for onboarding community users this assignment can be automated to assign this permission set when new community users are being created.
Starting with the October '23 admins can assign the SDocs LWC Community User permission set.

Configure The Components

Step 1: Navigate to your Digital Experience Site and open Experience Cloud Builder

In the builder pick your record detail page in which you want to include S-Docs document generation (e.g., the Account Detail page).

Step 2: Decide where you want to place the S-Docs LWC components

The Experience Cloud builder allows a variety of options and layouts. Decide where your end users are most likely to want to access the document generation and generated document components. The following example utilizes a new tab created in the Account Detail page called “S-Docs.” This is meant for illustration purposes. This tab can be renamed to best accommodate your end users. Additionally, the S-Docs LWC components can be displayed in other locations.

Step 3: Drag and drop the S-Docs LWC components

In the component panel on the left-hand side search for “S-Docs” and you’ll see 3 components listed:

Generate Documents (S-Docs): This component allows end users to generate documents based on the templates configured.

Documents (S-Docs): This component displays all documents that were generated using the templates configured in the Generate Documents (S-Docs) component.

Generate Document SDK (S-Docs): This component has no UI and is meant to be used with other custom LWCs that require document generation needs. We will not cover configuring this LWC component in this help article.

At this time, please ignore the warning message that displays in the component panel above the S-Docs LWC components. We are evaluating why that is being triggered and will resolve it in an upcoming release. We are not introducing any change that is going to compromise the security of your org or Experience Cloud setup. If you have questions please reach out to S-Docs support.

Drag and drop the Generate Documents (S-Docs) and Documents (S-Docs) components to the record detail page to the location of your choice. The below examples illustrate the components as implemented in an “S-Docs” tab.

Step 4: Configure the Generate Document (S-Docs) LWC

Click on the Generate Documents (S-Docs) component to access the configuration panel on the right, shown below. This panel will allow you to configure the component and control the display for your end users.

  • Title: Header title of the LWC your end users will see. Defaults to “Templates to Generate”
  • Template IDs or Names: A comma-separated list of template IDs or names
  • Notify User - A notification will be displayed to the user when each document completes generation
  • Open Preview - A preview of the document will open when each document completes generation
  • Record Id: Do not edit this property. The default is the {!recordId} variable which is the current record’s id
  • Object API Name: Replace this to the API name of your object (e.g. Account, Case, Custom_Object__c, etc. - no variable syntax)

Note: Make sure you set the Object API Name property first before you configure the other properties. You may see the below error message if you have it configured incorrectly or have the default {!objectApiName} value.

Step 5: Configure the Documents(S-Docs) LWC

Click on the Documents(S-Docs) component to access the below configuration panel on the right, shown below. This panel will allow you to configure the component and control the display for your end users.

  • Title: Header title of the LWC your end users will see. Defaults to “Generated Documents”
  • Email Template: Add a template's record ID if you want your Experience Cloud users to be able to email the generated documents select the S-Docs email template
  • Automatically Open Email Editor: When enabled, once a document is generated, S-Docs will automatically open the email composer window where the end user can compose an email and send the generated document as an attachment
  • Record Id: Do not edit this property. The default is {!recordId} which is the current record’s id
  • Object API Name: Change this to the API name of your object (e.g. Account, Case, Custom_Object__c, etc.)

Configure access to post-generation actions your user will need to complete their workflows:

  • Show Refresh: Enable/Disable the ability to refresh data in generated documents
  • Show Delete: Enable/Disable the ability to delete generated documents
  • Show Versions: Enable/Disable the ability to display document versions

Note: Make sure you set the Object API Name property first before you configure the other properties. If you have not previously generated documents for the templates in Step #4, this component will not display any documents.

Post-generation action access configuration is available starting with the October '23 release (v5.1.1)

Step 6: Preview and Publish

Once complete, preview your changes and publish once you are satisfied with the changes.

Step 7: Verify by logging in as a Experience Cloud users

Once your site is published, you can use the Login as Experience Cloud user button on the Contact record of your choice to verify the LWC components are showing correctly.

If you do not see any templates in the Templates to Generate tile, refer to the Sharing Settings section of this article to ensure the sharing settings for the SDOC Template object is set up correctly.

Known Limitations

In the September’23 release, the below are known limitations:

  • You cannot configure what actions are displayed on the drop-down next to the generated documents. For example, you cannot define that your Experience Cloud users should not see the “Delete” or “Edit” menu options.

  • The Send email button isn’t configurable for Experience Cloud users. All users of this component will see the button and can email the document using the S-Docs email composer.

We are working on some of these limitations so that we can provide more flexibility to our customers. Feedback is always welcome and much appreciated.

Was this helpful?