Call sn_pdfgeneratorutils.PDFGenerationAPI in UI action

garimadubey
Tera Contributor

Hi All,

I want to generate pdf from custom table fields I am using sn_pdfgeneratorutils.PDFGenerationAPI and I am working on the scoped application.

I tested sample code from docs in a fixed script, and it worked fine but when I try to use it in UI action it gives the error, catch block as 'sn_pdfgeneratorutils not defined'.

Please suggest what would be correct way for using this in UI action.

Thanks in advance!

Please find the script used in the UI action below:

function testf() {
    alert("1");
    var fieldMap = new Object();
    fieldMap["APPLICATION NO"] = "123456";
    alert("2");
    var flatten = new Object();
    flatten["FlattenType"] = "partially_flatten";
    alert("3");
    try {
		var v = new sn_pdfgeneratorutils.PDFGenerationAPI;
        alert("4");
    } catch (e) {
        alert("Error Output##1 :" + e);
    }
    var result = v.fillDocumentFieldsAndFlatten(fieldMap, "aa74a0f497213110e2b8337e6253afc4", "incident", "57af7aec73d423002728660c4cf6a71c", "pdfName", flatten);
    gs.info(JSON.stringify(result));
}

 

2 REPLIES 2

Omkar Kumbhar
Mega Sage
Mega Sage

@garimadubey can you please check once using pageSize before your pdf generator function if this helps?

OmkarKumbhar_0-1695660509478.png

 

 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

Giovanni Perett
Tera Contributor

Hi have the same issue! It runs on UI Action but not in Flow Designer...

Did you solve it?