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
BedrockMission!

Learn More

View all

Sign in to view all badges

How to send an email through an javascript

Avatar

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile
naveens49375819
Level 2

09-04-2018

Hi Jean,

I am trying to send an email using submit delivery method but getting an following error.

09/04/2018 09:35:41 SCR-160012 JavaScript: error while evaluating script 'WKF11540/js'.

09/04/2018 09:35:41 SOP-330011 Error while executing the method 'SubmitDelivery' of service 'nms:delivery'.

09/04/2018 09:35:41 DLV-490051 Failed to analyze delivery (identifier 'unknown').

09/04/2018 09:35:41 DLV-490050 The XML document to add to the scenario does not have a valid format.

09/04/2018 09:35:41 Element 'targetPart' is unknown (see definition of element '/targets' in schema 'Deliveries (nms:delivery)').

Can I pass targets and content inside submit delivery method?

Thanks

Naveen S

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile
naveens49375819
Level 2

10-04-2018

Thanks Jean for you reply.

I have figured out in the script it was some variable issue.

You can close the ticket

Regards

Naveen

Answers (7)

Answers (7)

Avatar

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Jean-Serge_Biro
MVP

09-04-2018

oh your 2nd post and mine have been posted simultaneously

annother example, if you must use it within a webApp Javascript activity:

nms.delivery.QueueNotification('internal-name-of-delivery',

<delivery>

  <targets>

    <deliveryTarget>

      <targetPart type='query' exclusion='false' ignoreDeleteStatus='false'>

        <where>

          <condition expr={'@id ='+ ctx.recipient.@id}/>

        </where>

      </targetPart>

    </deliveryTarget>

  </targets>

</delivery>);

Regards

JS

Avatar

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile
naveens49375819
Level 2

10-04-2018

Hi Jean,

I have created a template and utilizing that template internal name and trying to target population dynamically by passing email through variable and content too dynamic.

I have removed type="query" and Submitdelivery its working fine now but I couldn't be able to pass email address has a variable inside experssion.

here is the code

var abc = "<html><body><p>xxx</p></body></html>"

var emailId = "abc.xyz@yyy.com"

var deliveryId = nms.delivery.SubmitDelivery("DM79018",<delivery>

<targets >

    <deliveryTarget >

      <targetPart    exclusion='false'  ignoreDeleteStatus='false'>

        <where>

          <condition expr={'@email=' +emailId}/>

        </where>

      </targetPart>

    </deliveryTarget>

  </targets>

                                  <content>

                                    <html>

                                      <source>{abc}</source>

                                    </html>

                                  </content>

                                </delivery>);

                               

                                logInfo(deliveryId)

Avatar

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Jean-Serge_Biro
MVP

10-04-2018

Hi Naveens,

SubmitNotification method is only useful for continuous deliveries (adding new target contacts, not for changing the delivery content).

I mentioned it because of the 2 other methods described in the documentation for target feed (external file etc).

It is weird why an error still occurs after type='query' added. Sorry I don't undertand. Is the mistake the same?
Is your delivery DM79018 a standard one, or recurrent one, or continuous one ?

(in that latter case, again it is Submit Notification that must be used, but with no content change.)

Can you copy/paste the xml code in a text editor (such as Notepad++, Ultraedit, etc) in order to see if you have special characters in it, not visible/shown as blank char?

Please may you try also with :

            <where filteringSchema="nms:recipient"> 

                <condition expr="@email = 'xxxx@yyyy.com'"/> 

Regards

JS

Avatar

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Jean-Serge_Biro
MVP

09-04-2018

Hi naveens,

Please may you add the missing attribute in targetPart:

type='query'

Regards

JS

Avatar

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile
naveens49375819
Level 2

09-04-2018

After adding type="query" In submitDelivery its not working but it works in submit notification but I need feed content as well.

Avatar

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Jean-Serge_Biro
MVP

09-04-2018

Hi Naveen,

Please may you read the SubmitNotification method in the JSAPI.chm documentation, it is more detailed about the 3 possibilities for the target element than submitDelivery method (for which the documentation doesn't give any example, except one in JSON but not for target  part).

For instance, in the SubmitDelivery method, you can write:

<targets > 

    <deliveryTarget> 

        <targetPart> 

            <where filteringSchema="nms:recipient"> 

                <condition expr="@email = 'xxxx@yyyy.com'"/> 

            </where> 

        </targetPart> 

    </deliveryTarget> 

</targets >

Regards
J-Serge

Avatar

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile

Avatar
Validate 1
Level 2
naveens49375819
Level 2

Likes

4 likes

Total Posts

28 posts

Correct Reply

3 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 3
Affirm 1
View profile
naveens49375819
Level 2

09-04-2018

Here is the code.

var abc = "<html><body><p>text</p></body></html>"

var deliveryId = nms.delivery.SubmitDelivery("DM79018",<delivery>

<targets >

    <deliveryTarget >

      <targetPart  exclusion='false'   ignoreDeleteStatus='false'>

        <where>

          <condition expr="@email = 'naveen@xyz.com'"/>

        </where>

      </targetPart>

    </deliveryTarget>

  </targets>                                  <content>

                                    <html>

                                      <source>{abc}</source>

                                    </html>

                                  </content>

                                </delivery>);

                               

                                logInfo(deliveryId)