web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

How to load jsPDF as a dependency for other javascript file to use?

(0) ShareShare
ReportReport
Posted on by 105

I want to add a custom button to the grid that when pressed will call my javascript function that relies on jspdf

I created 2 new web resources

  1. using https://github.com/parallax/jsPDF/blob/master/dist/jspdf.es.js 
  2. My custom javascript utilizes jsPDF

I use Ribbon Workbench to add 2 actions for the command.

  1. The 1st action calls the jspdf webresource with "isNaN" function name
  2. The 2nd action calls my js webresource with my function name.

When I click on the custom button, I get javascript error "ReferenceError: jsPDF is not defined" on the line "let pdf = new jsPDF("p", "pt", "a4");" it seems that jsPDF is not being loaded at all?

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Kirk T,

    Which is your version of Dynamics 365? Is it V9?

    If yes, you could add your jspdf web resource to another JS web resource's dependence like this:

    pastedimage1639638726380v1.png

    Below is my test:

    My person.js:

    function Person(name,age) {
        this.name = name;
        this.age = age;
    }

    Another JS web resource:

    function preSetText(executionContext){
    var someone = new Person("someone",20);
    console.log(someone);
    }

    Add a button on my account form with another JS as command:

    pastedimage1639638985861v2.png

    Result:

    pastedimage1639639075841v3.gif

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 41

#2
Martin Dráb Profile Picture

Martin Dráb 36 Most Valuable Professional

#3
Satyam Prakash Profile Picture

Satyam Prakash 35

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans