1

I was following the forceTK documentation and included forceTK and jQuery into lightning component:

<ltng:require scripts="{!join(',',$Resource.JavascriptRESTToolkit,$Resource.jQueryMin_2_2_4)}" />

However, when I try to create the client in controller, nothing happens:

var client = new forcetk.Client();

Any idea what I'm doing wrong? I was thinking if it can be caused by locker service preventing to load forcetk library, but I'm not sure about this. There should be no problem with jQuery library as the used version is locker service compatible.

7
  • Did you check the browser console for any errors? If you don't see any errors, you may use the afterScriptsLoaded in the ltng:require tag, just to make sure the resources has finished loading and check it's functionality there. If you've done this too, then please post the whole code.
    – SE_User
    Jul 31, 2017 at 12:09
  • Thanks for the idea. I tried it and console.log(jQuery); works while console.log(forcetk); does not. So it seems that forcetk is really not loaded and I will have to do it using Visualforce page in an iframe. Jul 31, 2017 at 13:04
  • Oh. One more thing if forcetk requires jQuery mandatorily, then try changing the order in which it's being loaded(First load jQuery, followed by forcetk).
    – SE_User
    Jul 31, 2017 at 13:34
  • Makes sense, but doesn't work unfortunately. Anyway, thanks for ideas! Jul 31, 2017 at 14:30
  • Hi, did you find solution for forcetk library to work in Lightning, other than putting it in VF iFrame, if yes please share, thanks. Sep 24, 2017 at 7:45

0

You must log in to answer this question.

Browse other questions tagged .