Expand my Community achievements bar.

Extending or Creating custom page templates using OTB MCM email components

Avatar

Level 3

Hi All,

I am working on a requirement where in I need to create custom email-templates and these will be used to create email pages in AEM and later it will be synced to Adobe campaign and from there emails will be sent to several people.

When I verified the adobe documentation @ https://docs.adobe.com/docs/en/aem/6-1/administer/integration/marketing-cloud/campaign/best-practice... says as below:

There are currently seven components available for use inside campaign templates( under path /libs/mcm/campaign).These components are optimized for mail content; that is, they adhere to the best practices outlined in this document. Using other out-of-the-box components will usually violate these rules.

I created custom components by using the best practices explained in the documentation. I also used some of the OTB components on the email-component page. I packaged everything which includes. content-email-page custom components and templates and installed on n another machine. But when I open  the content-email-page I see the content but on the side kick is not loading the custom components , but it is loading OTB-mcm-components.

I have created the email-content-page under this path-->/content/campaign.

One more observation is that when I create a new page all components are loading in the side kick. The issue is only only on the page which has been copied from  one instance to another instance.

So I don't know if I can  use the custom components for Adobe-campaign created by using  best practice provided in Adobe documentation. I need to know the step by steps for creating custom-templates and components on  AEM for use in Adobe campaign.

I also want to know is it allowed to extend the components under path -->/libs/mcm/campaign in apps folder to build some custom functionalities on these components.

5 Replies

Avatar

Level 10

I also want to know is it allowed to extend the components under path -->/libs/mcm/campaign in apps folder to build some custom functionalities on these components

You can extend these HTL (Formerly SIghtly) components like you can any other AEM component. There is nothing special about these that would result in not being able to extend them. 

Avatar

Level 3

Hi,

I am facing issues on custom content pages , wherein page properties don't open on page when I did customization as explained below. I am not getting any java-script error as well. But I am able to open  page page-properties  from site admin screen by right clicking on the page and selecting the properties from menu.

I just overlaid the /libs/mcm/campaign into apps folder and just renamed the component /apps/mcm/campaign/components/campaign_newsletterpage into /apps/mcm/campaign/components/campaign_newsletterpage_custom and then renamed the template /apps/mcm/campaign/templates/campaign_newsletterpage to /apps/mcm/campaign/templates/campaign_newsletterpage_custom

Then  I created a content page for the template under /content/campaigns using this new template  /apps/mcm/campaign/templates/campaign_newsletterpage_custom. When  I do this the pageproperties on the content page are not opening, but I am able to open page properties of the content-page from site admin screen. So on the page page properties are not opening. The page-properties is having an option to pick configuration information with respect to Adobe campaign. So page properties should work on the page.

Avatar

Level 1

Hi Subramanya,

Were you able to find fix for this issue?

I am facing similar issue while customizing few page properties. 

Avatar

Level 1

As for now these are the Adobe Campaign Templates within AEM: "mcm/neolane/components/newsletter", "mcm/campaign/components/newsletter", "mcm/campaign/components/campaign_newsletterpage"

I tried to extend my Custom Page Component from the Pages listed above. However, I got the following error when I publish the content to Adobe Campaign:

Failure Stack

com.adobe.granite.workflow.WorkflowException: Script execution resulted in an error

at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:176)

at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:244)

at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:500)

at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.startJob(JobQueueImpl.java:291)

at org.apache.sling.event.impl.jobs.queues.JobQueueImpl.access$100(JobQueueImpl.java:58)

at org.apache.sling.event.impl.jobs.queues.JobQueueImpl$1.run(JobQueueImpl.java:227)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

Caused by: org.apache.sling.api.scripting.ScriptEvaluationException: Failure running script /etc/workflow/scripts/campaign/approve.ecma: Wrapped com.adobe.cq.mcm.campaign.NewsletterException: Page /content/campaigns/myproject/master/e-mails/demo-6 is not a newsletter (/etc/workflow/scripts/campaign/approve.ecma#7)

at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:416)

at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184)

at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:174)

... 8 more

Caused by: org.mozilla.javascript.WrappedException: Wrapped com.adobe.cq.mcm.campaign.NewsletterException: Page /content/campaigns/myproject/master/e-mails/demo-6 is not a newsletter (/etc/workflow/scripts/campaign/approve.ecma#7)

at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1893)

at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)

at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)

at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)

at org.mozilla.javascript.gen._etc_workflow_scripts_campaign_approve_ecma_1672._c_script_0(/etc/workflow/scripts/campaign/approve.ecma:7)

at org.mozilla.javascript.gen._etc_workflow_scripts_campaign_approve_ecma_1672.call(/etc/workflow/scripts/campaign/approve.ecma)

at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)

at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3282)

at org.mozilla.javascript.gen._etc_workflow_scripts_campaign_approve_ecma_1672.call(/etc/workflow/scripts/campaign/approve.ecma)

at org.mozilla.javascript.gen._etc_workflow_scripts_campaign_approve_ecma_1672.exec(/etc/workflow/scripts/campaign/approve.ecma)

at org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine$SlingCompiledScript.eval(RhinoJavaScriptEngine.java:272)

at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386)

... 10 more

Caused by: com.adobe.cq.mcm.campaign.NewsletterException: Page /content/campaigns/myproject/master/e-mails/demo-6 is not a newsletter

at com.adobe.cq.mcm.campaign.impl.NewsletterManagerImpl.check(NewsletterManagerImpl.java:74)

at com.adobe.cq.mcm.campaign.impl.NewsletterManagerImpl.approve(NewsletterManagerImpl.java:211)

at sun.reflect.GeneratedMethodAccessor4114.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)

... 20 more

All Page Components can be extended from the mcm/ libraries but it won't work with the Adobe Campaign integration. Based on these restrictions I would have to overwrite any of these components: "mcm/neolane/components/newsletter", "mcm/campaign/components/newsletter", "mcm/campaign/components/campaign_newsletterpage"