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

Update contents of field of type Cdata with JavaScript Activity

Avatar

Level 1

I need to update the contents of various fields that appear in the marketing offers / offer weight tables from a workflow.

I have been able to update the contents of fields with datatype Expr with a JavaScript activity, but I do not seem to be able to update the contents of CData fields in this way.

Is there are way to do this from a workflow?

Thanks in advance for any responses.  

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Dandrews2 

In the JS activity I suppose you update your data with the xtk:session.Write method. Can you check the schema of the data you want to update please ?

The "filed" you try to update could be declared as an element and not an attribute.

In this case, you have to update it with a sub element and not a simple string / integer / boolean :

//E4X way, with XML notation
xtk.session.Write(<mySchema xtkschema="cus:mySchema" ...>
<subElement>MY NEW DATA</subElement>
</mySchema>);

//JXON way, with JSON notation
xtk.session.Write({
  mySchema : 
   { xtkschema : "cus:mySchema" ...
     subElement : { $ : "MY NEW DATA" }
  }
});

Hope this could help

Cedric

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @Dandrews2 

In the JS activity I suppose you update your data with the xtk:session.Write method. Can you check the schema of the data you want to update please ?

The "filed" you try to update could be declared as an element and not an attribute.

In this case, you have to update it with a sub element and not a simple string / integer / boolean :

//E4X way, with XML notation
xtk.session.Write(<mySchema xtkschema="cus:mySchema" ...>
<subElement>MY NEW DATA</subElement>
</mySchema>);

//JXON way, with JSON notation
xtk.session.Write({
  mySchema : 
   { xtkschema : "cus:mySchema" ...
     subElement : { $ : "MY NEW DATA" }
  }
});

Hope this could help

Cedric