Unable to use the loadlibrary() inside the delivery | Community
Skip to main content
January 13, 2020
Solved

Unable to use the loadlibrary() inside the delivery

  • January 13, 2020
  • 2 replies
  • 4718 views

Hi,

Anybody can help, why I am unable to use loadlibrary() function inside the delivery. Thank you 

 

kind Regards

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Amit_Kumar

Hi,

Jon recommends a way which will work for you but Personalisation blocks are not designed to include the Js objects in Deliveries. 

You should use the following method to include the Js.

This will Add your Js object into your execution context similar to what load library does.

 

in delivery you can use something like: 

<% eval( bigint.data ) ; %>

 

Regards,

Amit

Regards,

Amit

 

2 replies

Jonathon_wodnicki
Community Advisor
Community Advisor
January 14, 2020

Hi,

 

The loadLibrary() function is not available in deliveries.

Copy the desired js into a personalization block and include that, it's pretty much the same.

 

Thanks,

-Jon

Amit_Kumar
Amit_KumarAccepted solution
Level 10
January 15, 2020

Hi,

Jon recommends a way which will work for you but Personalisation blocks are not designed to include the Js objects in Deliveries. 

You should use the following method to include the Js.

This will Add your Js object into your execution context similar to what load library does.

 

in delivery you can use something like: 

<% eval( bigint.data ) ; %>

 

Regards,

Amit

Regards,

Amit

 

Marcel_Szimonisz
Community Advisor
Community Advisor
January 22, 2020

Hello, so I finally figured it out and it works:

  • for one function only which has to be wrapped in () such as
(function b (num) {return num + 4;}) ​
  • also eval it is very slow JS interpreter so if you use it with deliveries where you have a lot of recipients it would take eternity.

In the delivery you can use it by

<% var b = eval (yourscript.data);%> <%= b(4)%>

 

So I would use personalization blocks as well for the sake of performance and usability.