I have one requirement to show the aggregated task list as a webpart in any page of SP 2013 on premise, where user will see the assigned task list directly without going onto my site. After some research I found a good article here , and from that I am just trying to read the task using Work management API of SharePoint Client Object Model.
I have simply copied and pasted the code in site page and tried to console the task items but it is giving me an error in
sp.workmanagement.js as below:
TypeError: this.get_context is not a function
I am stuck since two days, still finding no solution. If anyone can help that would be very helpful.
I have also noticed that this code does work when I put the below script code in publishing page and the page is in edit mode.
So far I figured out that something of order or library reference is missing, but I am unable to get what's wrong with this.