Mirror Page Generation | Community
Skip to main content
Level 2
February 13, 2023
Question

Mirror Page Generation

  • February 13, 2023
  • 3 replies
  • 3432 views

Hello All,

 

We have to generate

mirror page for each broadLog records.

Had tried generating mirror page in JS using GetMirrorURL.

nms.delivery.GetMirrorURL(deliveryId,broadlogId)


We are able to print mirror page for all broadLog records for email channel, but there is a catch in it.

By copying the mirror page URL generated by GetMirrorURL function, mirror page is rendering fine for the deliveries where mirror page is configured in Email delivery.

But it throws error for URLs generated by GetMirrorURL function for deliveries where mirror page URL haven't configured.

 

So is there any other way to generate mirror page for all broadLog records in a workflow?

Like, replicating https://<instance_url>/nl/jsp/m.jsp?c=<%=escapeUrl(cryptString(message.deliveryPartId.toString(16)+'|'+message.id.toString(16)))%>

 

(Had referred this community question, but unable to generate the correct mirror page URL)

 

Workflow used:

Query on broadLogRcp as targeting dimension,

JS

 

var data = xtk.queryDef.create( <queryDef schema="temp:query" operation="select" > <select> <node expr= "@id" /> //broadLogId <node expr= "@deliveryId" /> <node expr= "@deliveryPartId" /> //tried fetching deliveryPartId from [delivery/mirrorPageInfo/@id] in query </select> </queryDef> ) var output = data.ExecuteQuery(); for each (var file in output.query) { instance.vars.deliveryId = file.@delId.toString(16); instance.vars.broadlogId = file.@id.toString(16); instance.vars.partId = file.@deliveryPartId.toString(16); vars.url = "https://xxxxxxxxxxxx.campaign.adobe.com/nl/jsp/m.jsp?c="+ escapeUrl(cryptString(???????????)); //tried passing multiple probability variable in cryptstring, but has not worked for us,(message.deliveryPartId.toString(16)+'|'+message.id.toString(16))) logInfo("Mirror Page URL1: " + vars.url); }
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

isahore
Community Advisor
Community Advisor
February 13, 2023

Hi @sd_11,

Well I am not sure why that is happening, but I can suggest one quick thing that you can do. In the delivery properties, go to the validity tab, then under "mirror page management" select the mode as "Force the generation of the mirror page". Let me know if that helps.

 

Regards,

Ishan

SD_11Author
Level 2
February 15, 2023

Thanks for your response. Yes this works for new deliveries. But is there any way to fetch mirror page for all existing deliveries which have been already sent, irrespective of mirror page configured in Delivery.

akshaaga
Adobe Employee
Adobe Employee
February 14, 2023

Hi @sd_11 ,

If the GetMirrorURL function is not generating the mirror page URL for all deliveries, you can try using the delivery ID and delivery part ID to construct the mirror page URL manually.

You can use the following URL format to construct the mirror page URL:

https://<instance_url>/nl/jsp/m.jsp?c=<%=escapeUrl(cryptString(deliveryPartId.toString(16)+'|'+deliveryId.toString(16)))%>

Replace <instance_url> with your Adobe Campaign instance URL, deliveryPartId with the delivery part ID, and deliveryId with the delivery ID.

In your workflow JS code, you can construct the mirror page URL like this:

vars.url = https://<instance_url>/nl/jsp/m.jsp?c= + escapeUrl(cryptString(file.@deliveryPartId.toString(16) + '|' + file.@deliveryId.toString(16)));

This should generate a mirror page URL for all broadLog records, even for deliveries where the mirror page URL is not configured.

SD_11Author
Level 2
February 15, 2023

Hi @akshaaga ,

Yes We had tried the same.

 

Created 2 deliveries, one with mirror page configured and one with no mirror page. After sending delivery, had Queried my email id using JS to fetch those 2 records using queryDef. But by using the syntax provided, Mirror page URL generated in JS is not working even for the delivery where mirror page is configured in email body.

 

Kindly check what to add in deliveryPartId expr, and help us with the script.

 

var data = xtk.queryDef.create( <queryDef schema="nms:broadLogRcp" operation="select" > <select> <node expr= "@id" /> <node expr= "@address" /> <node expr= "[delivery/@id]" alias="@deliveryId" /> <node expr= "??????" alias="@deliveryPartId" /> //Please provide expr for deliveryPartId, We had tried few, but it doesn't worked. </select> <where> <condition expr="@address = 'myEmail@test.com'"/> </where> </queryDef> ) var output = data.ExecuteQuery(); for each (var file in output.broadLogRcp) { vars.url = "https://<hardcoded_our_instance_url>/nl/jsp/m.jsp?c="+ escapeUrl(cryptString(file.@deliveryPartId.toString(16) + '|' + file.@deliveryId.toString(16))); logInfo("Mirror Page URL : " + vars.url); }

 

Many thanks in advance!

akshaaga
Adobe Employee
Adobe Employee
February 15, 2023

Hi @sd_11 ,

To retrieve the delivery part ID of the mirror page for a broadLogRcp record, you can use the following expression in your select statement:

<node expr="[@id = currentInstance/@deliveryRcpId]/mirrorPageRcpId" alias="@deliveryPartId" />

This expression uses the currentInstance function to retrieve the ID of the deliveryRcp linked to the current broadLogRcp record, and then selects the mirrorPageRcpId of that deliveryRcp. This assumes that the mirror page was configured at the delivery level, rather than at the broadLog level.

Here is the modified script:

var data = xtk.queryDef.create(

  <queryDef schema="nms:broadLogRcp" operation="select">

    <select>

      <node expr="@id" />

      <node expr="@address" />

      <node expr="[delivery/@id]" alias="@deliveryId" />

      <node expr="[@id = currentInstance/@deliveryRcpId]/mirrorPageRcpId" alias="@deliveryPartId" />

    </select>

    <where>

      <condition expr="@address = 'myEmail@test.com'" />

    </where>

  </queryDef>

);

var output = data.ExecuteQuery();

for each (var file in output.broadLogRcp) {

  vars.url = https://<hardcoded_our_instance_url>/nl/jsp/m.jsp?c= + escapeUrl(cryptString(file.@deliveryPartId.toString(16) + '|' + file.@deliveryId.toString(16)));

  logInfo("Mirror Page URL: " + vars.url);

}

Make sure to replace <hardcoded_our_instance_url> with the URL of your Adobe Campaign instance. Also, note that the currentInstance function is only available in the context of an event, so you will need to run this code as part of an event.

Sukrity_Wadhwa
Community Manager
Community Manager
March 2, 2023

Hi @sd_11,

Were you able to resolve this query with the help of the given solutions or on your own? Do let us know.

Thanks!

Sukrity Wadhwa