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

SOLVED

setAttribute to an xml creation delivery

maurizio_coro
Level 3
Level 3

Hello, I'm creating a delivery via JS and I'm trying to add an attribute dynamically to this code:

var xmlTargeting =

      <delivery>

        <targets>

          <deliveryTarget/>

        </targets>

        <variables/>

        <scheduling/>

      </delivery>;

I've tryed     xmlTargeting.targets.setAttribute("addProofInTarget","true");

but I got an error: xmlTargeting.targets.setAttribute is not a function.

Any idea on the right code?

thanks

1 Accepted Solution
MarcelSzimonisz
Correct answer by
Community Advisor
Community Advisor

Try to use  .add() method from jsapi

eg.

var proof = xmlTargeting.targets.deliveryTarget.add(<addProofingTarget/>) ;

proof.anyAttribute = something;

...

...

View solution in original post

1 Reply
MarcelSzimonisz
Correct answer by
Community Advisor
Community Advisor

Try to use  .add() method from jsapi

eg.

var proof = xmlTargeting.targets.deliveryTarget.add(<addProofingTarget/>) ;

proof.anyAttribute = something;

...

...

View solution in original post