Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Unable to use the loadlibrary() inside the delivery

akhileshbh
Level 1
Level 1

akhileshbh_0-1578927516874.png

Hi,

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

 

kind Regards

1 Accepted Solution
Amit_Kumar
Correct answer by
Community Advisor
Community Advisor

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.

Amit_Kumar_0-1579083359058.png

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

 

View solution in original post

0 Replies
wodnicki
Community Advisor
Community Advisor

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
Correct answer by
Community Advisor
Community Advisor

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.

Amit_Kumar_0-1579083359058.png

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

 

View solution in original post

MarcelSzimonisz
Community Advisor
Community Advisor

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.