Hello Folks,
I have content from AEM which gets synced in Campaign Email Delivery. I want to retrieve the updated content every time when it gets refreshed. I retrieved using "var deliveryContent = delivery.content.html.source;" in the Delivery Script using variables.
But it is not giving updated content, since AEM Content gets refreshed automatically during Delivery Run-time Analysis. I am getting same old content every time. So would like to understand is there any way where we can use queryDef on [content/html/source] in JS afor the Delivery ID passed and retrieve content after it is synced from AEM
Could someone please throw some light on this, quick help is appreciated
Regards,
Sri Bhargav
Hello Folks,
I tried something like below:
var query = xtk.queryDef.create(
<queryDef schema="nms:delivery" operation="select">
<select>
<node expr="[content/html/source]"/>
<node expr="@label"/>
</select>
<where>
<condition expr={"@internalName = '"+deliveryInternalName+"'"}/>
</where>
</queryDef>),result;
result = query.ExecuteQuery();
var statsResults = result.delivery;
for(var eachResp in statsResults)
{
var deliveryLabel = statsResults[eachResp].@label;
logInfo(deliveryLabel);
//var deliveryContent = statsResults[eachResp].[content/html/source];
var dataStr = sqlGetMemo("SELECT mData from nmsDelivery WHERE sInternalName="+eachResp.@internalName);
//var dataXml = DOMDocument.fromXMLString(dataStr);
//var content = dataXml.root.getValue("content/html/source");
}
But Unable to fetch content and getting various errors, since it is an XML Field stored under path: content/html/source, is there any specific way to access this? If so let me know!
Regards,
Sri Bhargav
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi,
To fetch AEM content for a delivery, use nms.delivery.aemGetContent(delivery).
To select paths in queryDef, use alias="html" in the <node/> element.
Thanks,
-Jon
Hi Jon,
Apologies! I didn't understand completely what you mentioned. Quite confusing
Where do i need to use nms.delivery.aemGetContent(delivery), is it in Select Query? If possible can you provide me any snippet as reference please
Regards,
Sri Bhargav
Views
Replies
Total Likes
It's an undocumented js function. The delivery param here is a delivery object, from a queryDef 'get' on nms:delivery. You can probably sub in your eachResp iterator there.
Hi Jon,
I have tried the way you suggested. Below is the code:
var deliveryInternalName = "DEVDM12285";
var query = xtk.queryDef.create(
<queryDef schema="nms:delivery" operation="select">
<select>
<node expr="[content/html/source]" alias="content/html"/>
</select>
<where>
<condition expr={"@internalName = '"+deliveryInternalName+"'"}/>
</where>
</queryDef>),result;
result = query.ExecuteQuery();
var statsResults = result.delivery;
for(var eachResp in statsResults)
{
var deliveryContent = nms.delivery.aemGetContent(eachResp);
logInfo(deliveryContent);
}
I am getting different error: 05/17/2019 1:49:24 AM js No permalink provided to identify the content
Can you please help if anything wrong i done?
I am using select instead of get, but select will create a cursor to iterate over every record. But in my case there is only one delivery at a time.
Regards,
Sri Bhargav
Views
Replies
Total Likes
Hi Jon,
I tried it another way as shown below. This time using "get"
var deliveryInternalName = "DEVDM12380";
var query = xtk.queryDef.create(
<queryDef schema="nms:delivery" operation="get">
<select>
<node expr="@label"/>
<node expr="@internalName"/>
<node expr="[content/html/source]" alias="html"/>
</select>
<where>
<condition expr={"@internalName = '"+deliveryInternalName+"'"}/>
</where>
</queryDef>),result;
result = query.ExecuteQuery();//.toXMLString();
logInfo(result.@label);
logInfo(result.@internalName);
logInfo(nms.delivery.aemGetContent(result));
But same error i am facing No permalink provided to identify the content. Is it like something wrong with AEM and Campaign Integration?
Regards,
Sri Bhargav
Views
Replies
Total Likes
Hello,
Could someone please help me in looking into error?
Regards,
Sri Bhargav
Views
Replies
Total Likes
Hello Jon,
I understood from the above method that nms.delivery.aemGetContent(delivery) is a JS functiion and there it does some logic for pulling content. But while checking so why am i getting "No Permalink provided to identify the content".
Any Inputs please?
Regards,
Sri Bhargav
Views
Replies
Total Likes
Hi,
Usage example, from nms:amcIntegration.js; looks like you need [remoteContent/@remotePath], and to follow expected structure:
// Fetch content from AEM
if(application.hasPackage("nms:aemIntegration") )
{
template = xtk.queryDef.create(
<queryDef operation="get" schema="nms:delivery">
<select>
<node expr="@id"/>
<node expr="@internalName"/>
<node expr="@contentEditingMode"/>
<node expr="[@cmsAccount-id]"/>
<node expr="[remoteContent/@remotePath]"/>
</select>
<where>
<condition expr={"@id = " + iDeliveryId}/>
</where>
</queryDef>).ExecuteQuery();
if( String(template.@contentEditingMode) == "2" && // AEM contents
String(template.remoteContent.@remotePath) )
{
logInfo(this.sg.aemGetContent());
var aemContent = nms.delivery.aemGetContent(template);
Thanks,
-Jon
Views
Likes
Replies
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies