# SDK LWC Compared to SDJobs

{% stepper %}
{% step %}
**SDK/LWC compared to SDJobs — SDK vs. S-Docs Jobs**

1. [Asynchronous (S-Docs Jobs)](https://www.sdocs.com/knowledge-base/sdocs/generate-documents-automatically/s-docs-jobs/)
   1. Leverages S-Docs Jobs object as a part of S-Docs managed package
   2. Inserts async Apex Job into Salesforce queue
   3. Can support S-Docs email templates
   4. Failures are reported via the status field on Job Object and more detailedly inside the associated Apex Job that is inserted
2. [Synchronous (SDKs)](https://www.sdocs.com/knowledge-base/sdocs/generating-documents/s-docs-software-development-kit-documentsdk/)
   1. Many different managed invocable actions that can be leveraged in flows (regular document generation, batching, document generations w/ inputs at runtime -- read more in the link above)
   2. Completes synchronous document generation (no reliance on Apex Job queue)
   3. Invocable (via flow) ***cannot*** support S-Docs email templates, but can still leverage Salesforce email quick actions for delivering documents
      1. If leveraging the Salesforce email quick action you will need to embed a link in the email body for document viewing OOTB Salesforce the email quick action will not allow for attachments
      2. Support for S-Docs email templates coming in our 7.2 version release of S-Docs slated for release approximately in July
   4. The SDKs allow for some flexibility as they can be called into action via Custom Apex, with the exception of the Apex Trigger context. Read more about supported contexts in the linked article above.
      1. In the other Apex contexts, there is the possibility to leverage an S-Docs email template for sending.
   5. Invocably, errors are handled at the flow level (email for reason of flow failure to System Admin)
      {% endstep %}

{% step %}
**SDK/LWC compared to SDJobs — RTPs vs. SDK w/ Inputs**

1. [RunTime Prompts](https://www.sdocs.com/knowledge-base/sdocs/merge-fields/runtime-prompts/) (RTPs)
   1. RTPs are configured at the template level and are native to the S-Docs product
   2. Best for when you have a smaller number of inputs required (less than 25)
   3. Not compatible with document generation methods that are automated: SDK, LWC, S-Docs Jobs
      1. Only compatible with manual button-click S-Docs generation which progresses you through the visualforce pages required to fill out the RTPs
   4. Offers slightly less flexibility for validations/formatting of data input
2. [SDK with Inputs](https://www.sdocs.com/knowledge-base/sdocs/generate-documents-automatically/invocable-apex-action-library-for-flow-builder/#textapex-job-id-generate-s-doc-with-input-output-generated-sdoc) (view additional attached documentation)
   1. Leverages invocable actions with the power of Salesforce screenflows
   2. Can accommodate many more inputs ( greater than 25)
   3. Only compatible with document generation via a Salesforce screenflow
   4. The Salesforce screenflow allows for more flexibility in formatting data inputs and enforcing validation rules (when write-back is a requirement)
   5. Only can be supported for PDF file type outputs
   6. Support for emailing documents generated via this method, with an S-Docs email template, coming in our next product release (S-Docs 7.2) which is estimated to be released around the end of June/early July
      {% endstep %}
      {% endstepper %}


---

# 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://help.sdocs.com/developer-hub/document-generation-workflows/apex-and-programmatic-automation/software-development-kit/sdk-lwc-compared-to-sdjobs.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.
