Configurable Workspace: Refresh Page or Attachments Sidebar on UI Action completion

Michal Sadowski
Mega Sage

Hi Workspace Superstars,

I've created a UI Action that is based on PDFGenerationAPI and generates the PDF document based on the current Purchase Order records and related data.

MichalSadowski_0-1739984756654.png

Unfortunately after the process is completed, the attachment is not immediately visible in the Attachments section of the sidebar and I am not able to force the form refresh of the entire workplace form either. This creates a poor UX where the user must manually refresh the page to see the outcome of their UI Action.

 

My UI Action is set to client = false and here's the script:

 

 

 

 

 

 

 

// Build the PDF content and attach it to the record

var v = new sn_pdfgeneratorutils.PDFGenerationAPI;

var gr = new GlideRecord("proc_po");
var currentRecord = gr.get(current.sys_id);
var html;

var currentDate = new GlideDate();
var formattedDate = currentDate.getByFormat("dd.MM.yyyy");

// html string including server side scripting to dynamically build the document goes here
if (currentRecord) {
    html = ;
}

var hfInfo = new Object();
// lots of hfInfo properties are here

var result = v.convertToPDFWithHeaderFooter(html, "proc_po", current.sys_id, "ITBestellung-" + current.number + "-" + formattedDate, hfInfo);
action.setRedirectURL(current);

 

 

 

 

 

 

 

I did experiment with setting UI Action to client = true and adding the following code in Workspace Client Script but then it breaks the main functionality of PDF generation both in classic UI and in Workspace:

 

 

 

function onClick(g_form) {
	g_form.reload();
}

 

 

 

 Can I have the best of both worlds - UI Action to generate PDF and to refresh the page in classic UI and Workspace to immediately reveal the attachment. Even better if in Workspace there's a way not to refresh the whole page, just the Attachment section of the sidebar or something similar.
Any help appreciated.
 

 

0 REPLIES 0