Extending Schema with Field that executes Javascript Tags

Avatar

Avatar
Validate 10
Level 3
davidh2892249
Level 3

Likes

17 likes

Total Posts

132 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Validate 10
Level 3
davidh2892249
Level 3

Likes

17 likes

Total Posts

132 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile
davidh2892249
Level 3

17-04-2019

Hi All,

I'm looking to extend the delivery schema.

I've been able to do that fine, but I'd like to be able to add javascript Tags in the input form of the new field and make the tags execute.

E.g. like the subject field supports <%= recipient.firstName %> and replaces the tag with the recipient's first name value.

I've created a new string field on the delivery schema, but when I add a javascript tag like the above, it doesn't execute - it just shows the tag as a string.

Any ideas how to make the js tags execute?

Thanks

David

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

983 likes

Total Posts

1,097 posts

Correct reply

517 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

983 likes

Total Posts

1,097 posts

Correct reply

517 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

23-04-2019

Hi,

The immediate answer is to just use eval(), e.g.:

var s = (@field + '').match(/<%=?(.+?)%>/)[1];

if (s) eval(s);

This isn't quite the same as what deliveries do, as they have a pre-parser which collects db tables and fields and populates data ala active record, to allow for things like <%= recipient.firstName %>. Nor is it similar to Dynamic JavaScript pages, which have a couple web server objects available.

Features can be added as needed though.

Thanks,

-Jon

Answers (2)

Answers (2)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

983 likes

Total Posts

1,097 posts

Correct reply

517 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

983 likes

Total Posts

1,097 posts

Correct reply

517 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

17-04-2019

Hi,

You can script the field's consumer to parse and render tags found in the fields.

Outside that, delivery and jssp are the only ootb features that render jssp tags afaik.

Thanks,

-Jon

Avatar

Avatar
Validate 10
Level 3
davidh2892249
Level 3

Likes

17 likes

Total Posts

132 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Validate 10
Level 3
davidh2892249
Level 3

Likes

17 likes

Total Posts

132 posts

Correct reply

2 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile
davidh2892249
Level 3

18-04-2019

Thanks Jon, appreciate the response.

Can you give a working example? (with screengrabs would be great) so i can replicate and know where things are to be added.