Changelog 3B CLM v4.25

From 3B Knowledge
Jump to navigation Jump to search

Changes

  • Previously, if a request to the PDF service failed for a 3B Sign document, we would show the user an error message. This behaviour has been changed. Now, if there is a PDF error, we will fail quietly and we will update the Error Timestamp and Error Message fields on the Submitter record. Since we introduced the "Re-Generate" button in a previous version, admin users can request a PDF to be re-generated at a later stage. This brings 3B Sign closer to 3B Docs in terms of PDF generation error handling, where 3B Docs employs the same tactic

New

Once a Generated Document is actually generated (b3d__Document page or b3d__GeneratedDocument page), we will emit an event "documentReadyForPdfService" which can be captured by the PDF service as an indicator that the page is fully loaded and ready to be converted to a PDF.

Here's a sample for a PDF service implementation

/**
 * Wait for the browser to fire an event (including custom events)
 * @param {string} eventName - Event name
 * @param {integer} seconds - number of seconds to wait.
 * @returns {Promise} resolves when event fires or timeout is reached
 */
async function waitForEvent(eventName, seconds) {

    seconds = seconds || 30;

    // use race to implement a timeout
    return Promise.race([

        // add event listener and wait for event to fire before returning
        page.evaluate(function(eventName) {
            return new Promise(function(resolve, reject) {
                document.addEventListener(eventName, function(e) {
                    resolve(); // resolves when the event fires
                });
            });
        }, eventName),

        // if the event does not fire within n seconds, exit
        page.waitFor(seconds * 1000)
    ]);
}
//Call the wait event in the PDF service
waitForEvent(documentReadyForPdfService, 60)

Link

https://login.salesforce.com/packaging/installPackage.apexp?p0=04tJ7000000LOxH