Possible to use npm libraries in eForms?
Is it possible to use JavaScript libraries in eForms? Specifically, there is a JavaScript library that I would like to use to upload Excel files and convert the Excel contents into JSON that is stored in a JavaScript variable. The library is called SheetJS. You can find it at npm by searching for "xlsx". (The library can run in browsers. It does not require node to run). I have the link for the xlsx.full.min.js script from Cloudflare CDN. I would like to use this library because:(1) it does not matter what the Excel file is named, and (2) it automatically reads the file and converts the data to JSON. No need for AgilePoint to store the Excel file anywhere. I want to use the JSON as the body of a REST API POST request in the process model after the eForm is closed.
-
Kelly,
I tried this basic JavaScript which needs to be improvised but I was able to achieve your requirement.
In the Form JavaScript window I added below function.
function loadSheetJS(){
let scriptEle = document.createElement("script");
scriptEle.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js ");
document.body.appendChild(scriptEle);
}then in Rule Builder, for Form Event as 'Load' I configured to Execute Method -> loadSheeJS.
Saved the eform and opened it to test. In developer console I was able to see the the google CDN jQuery was loaded. Replace the JavaScript URL and try for SheetJS.


Regards,
Harish
請登入寫評論。
評論
1 條評論