Skip to main content
Jan 13, 2020 2:58 PM UTC
Solved

Unable to use the loadlibrary() inside the delivery

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.
Amit_Kumar
Amit_KumarAccepted solution
Level 10
Jan 15, 2020 10:17 AM UTC

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

 

3 replies

Jonathon_wodnicki
Community Advisor
Community Advisor
Jan 14, 2020 4:50 PM UTC

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

Translate
Amit_Kumar
Amit_KumarAccepted solution
Level 10
Jan 15, 2020 10:17 AM UTC

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

 

Translate
Marcel_Szimonisz
Community Advisor
Community Advisor
Jan 22, 2020 11:11 AM UTC

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.

Translate