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

Update record in workflow

Avatar

Avatar
Validate 1
Level 2
Pabst_dk
Level 2

Likes

11 likes

Total Posts

23 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 2
Pabst_dk
Level 2

Likes

11 likes

Total Posts

23 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Pabst_dk
Level 2

07-11-2018

Hi,

I am looking for a solution to update a record through a workflow (only to be kept in the workflow for later usage for export).

I am working on Adobe Campaign Classic v7 build 8797

So far I have been looking around and found a solution there is working (for someone else) on Standard.

I've tried to change it to the data I want to update but without luck.

This is the content of my JS

var schemaName = vars.targetSchema.substr(vars.targetSchema.indexOf(":") + 1);

logInfo(schemaName);

logInfo(vars.targetSchema);

var query = xtk.queryDef.create(

  <queryDef schema={vars.targetSchema} operation="select">

    <select>

      <node expr="@id"/>

      <node expr="@ProductDate"/>

    </select>

  </queryDef>

);

var resultSet = query.ExecuteQuery();

var collection = <{schemaName}-collection _operation="update" xtkschema={vars.targetSchema}/>;

for each (var row in resultSet) {

     var ProductDate = formatDate(row.@ProductDate, "%2D%2M%4Y");

     var schemaNameProgram = <{schemaName}-collection id={row.@id} ProductDate='ProductDate' _key='@id' xtkschema={vars.targetSchema}/>;

     collection.appendChild(schemaNameProgram);

     logInfo(ProductDate);

}

xtk.session.WriteCollection(collection);

Without any change I get this error

JST-310000 Error while compiling script 'WKF963/js' line 17: invalid XML tag syntax (line='var collection = <{schemaName}-collection _operation="update" xtkschema={vars.targetSchema}/>; ' token='-collection _operation="update" xtkschema={vars.targetSchema}/>; ').

SCR-160032 JavaScript: error while compiling script 'WKF963/js'.

When changing the {schemaName} to match my schema in the flow it runs without errors but does not update the record as expected.

Thanks in advance,

Best, Jonas

Jean-Serge BironAmit_KumarflorentlbAdhiyan

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 2
Pabst_dk
Level 2

Likes

11 likes

Total Posts

23 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 2
Pabst_dk
Level 2

Likes

11 likes

Total Posts

23 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Pabst_dk
Level 2

18-11-2018

Hi Deb,

I solved with another solution by changing the data stream and formatting through an enrichment step, where I changed the data from the fields and got the outcome in the flow data as expected.

This was done due to i could not get your solution to function as you described in your answers.

Best, Jonas

Answers (3)

Answers (3)

Avatar

Avatar
Boost 25
Level 4
Deb007
Level 4

Likes

48 likes

Total Posts

85 posts

Correct Reply

24 solutions
Top badges earned
Boost 25
Affirm 10
Applaud 5
Give Back 5
Establish
View profile

Avatar
Boost 25
Level 4
Deb007
Level 4

Likes

48 likes

Total Posts

85 posts

Correct Reply

24 solutions
Top badges earned
Boost 25
Affirm 10
Applaud 5
Give Back 5
Establish
View profile
Deb007
Level 4

07-11-2018

Hi Jonas,

If you only want to update the temp table and it can be achieved by sql, the following script in your js will work.

var sql = "UPDATE  "+vars.tableName+" SET dProductdate = function(dProductdate )  ";

sqlExec(sql);

Using appropriate sql function you can you get it done.

Regards,

Deb

Avatar

Avatar
Boost 25
Level 4
Deb007
Level 4

Likes

48 likes

Total Posts

85 posts

Correct Reply

24 solutions
Top badges earned
Boost 25
Affirm 10
Applaud 5
Give Back 5
Establish
View profile

Avatar
Boost 25
Level 4
Deb007
Level 4

Likes

48 likes

Total Posts

85 posts

Correct Reply

24 solutions
Top badges earned
Boost 25
Affirm 10
Applaud 5
Give Back 5
Establish
View profile
Deb007
Level 4

12-11-2018

Hi Jonas,

You can refer the following link to achieve date format change during export.

How to display date and time in UTC format i.e, 2018-05-02T13:47:33.743Z?

Regards,

Deb

Avatar

Avatar
Validate 1
Level 2
Pabst_dk
Level 2

Likes

11 likes

Total Posts

23 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 2
Pabst_dk
Level 2

Likes

11 likes

Total Posts

23 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Pabst_dk
Level 2

12-11-2018

Hi Deb,

Thanks for the answer,

But i cant get this to work, as is?

My data field has the data: SQL field 'tsProductdate' of type 'Date' (Productdate)

And where should I place the js to format the date?

Hope you can help elaborate a bit further

Thanks in advance,

Best, Jonas