LastModified for Template | Adobe Higher Education
Skip to main content
Level 2
March 14, 2023
解決済み

LastModified for Template

  • March 14, 2023
  • 1 の返信
  • 811 ビュー

Hi all! 

 

I'm trying to update the lastModified field for a Delivery template: 

var query = xtk.queryDef.create( <queryDef schema={vars.targetSchema} operation="select"> <select> <node expr="@id"/> </select> </queryDef>); var result = query.ExecuteQuery(); for each (var res in result) { var delivery = nms.delivery.load(res.@id); logInfo(delivery.lastModified); delivery.lastModified = getCurrentDate(); delivery.save(); logInfo(delivery.lastModified); }

 

In log I see old date and new one, after save(): 

 

But template still has old date:

 

Please help me find the problem

このトピックへの返信は締め切られました。
ベストアンサー ParthaSarathy

Hi @mariakonstantinova1995 ,

The Syntax is correct, It works fine for attributes like delivery label, but for lastModified it is not updating with above structure.

Instead you can try the below script,

var query = xtk.queryDef.create( <queryDef schema={vars.targetSchema} operation="select"> <select> <node expr="@id"/> </select> </queryDef>); var result = query.ExecuteQuery(); for each (var res in result) { vars.newLastModified = getCurrentDate(); sqlExec("UPDATE NmsDelivery SET tsLastModified=$(ts) WHERE iDeliveryId=$(l)",vars.newLastModified,res.@id); }

 

1 の返信

ParthaSarathy
Community Advisor
Community Advisor
March 14, 2023

Hi @mariakonstantinova1995 ,

The Syntax is correct, It works fine for attributes like delivery label, but for lastModified it is not updating with above structure.

Instead you can try the below script,

var query = xtk.queryDef.create( <queryDef schema={vars.targetSchema} operation="select"> <select> <node expr="@id"/> </select> </queryDef>); var result = query.ExecuteQuery(); for each (var res in result) { vars.newLastModified = getCurrentDate(); sqlExec("UPDATE NmsDelivery SET tsLastModified=$(ts) WHERE iDeliveryId=$(l)",vars.newLastModified,res.@id); }

 

~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Level 2
March 14, 2023

Hi @parthasarathy 

 

Thanks for your answer. It's working correct!

But why did it work through SQL but does not work in the usual way?