Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

Session.Write: Insert date

Avatar

Level 2

Hi guys,

I would like to use JavaScript to update a record in the recipient table.

I use the session.Write-function. How can I insert the current time into the date field "lastUpdate" in the schema for recipient "12345"?

xtk.session.Write(<recipient _operation="update" _key="@id" lastUpdate={getDate()} id="12345" xtkschema="nms:recipient"/>);

getDate does not work.

Thanks for your help in advance.

Greetings,

Tim

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Tim,

This works well.

var modifiedDate = formatDate(new Date(), "%4Y-%2M-%2D %02H:%02N:%02S")

xtk.session.Write(<recipient _operation="update" _key="@id" lastUpdate={modifiedDate} id="12345" xtkschema="nms:recipient"/>);

View solution in original post

2 Replies

Avatar

Level 10

Hello Tim,

Please use getCurrentDate() in pure Javascript code, not GetDate().

GetDate() is used in:

  • XML source schemas, see for example nms:recipient.created (NmsRecipient.tsCreated).
  • Query activity (expression editor on dates)
  • queryDef in Javascript activity

But  there is an attribute lastModified in the schema nms:recipient (sql table column: NmsRecipient.tsLastModified), so I wonder what is LastUpdate field ?

Or is it new field of ACS ? (I use Adobe Campaign v6.1.1).

Regards
J-Serge

Avatar

Correct answer by
Level 2

Hi Tim,

This works well.

var modifiedDate = formatDate(new Date(), "%4Y-%2M-%2D %02H:%02N:%02S")

xtk.session.Write(<recipient _operation="update" _key="@id" lastUpdate={modifiedDate} id="12345" xtkschema="nms:recipient"/>);