Extending or Creating custom page templates using OTB MCM email components | Community
Skip to main content
Level 3
July 28, 2016

Extending or Creating custom page templates using OTB MCM email components

  • July 28, 2016
  • 1 reply
  • 3217 views

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-practices-for-email-templates.html 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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

smacdonald2008
Level 10
July 28, 2016

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. 

December 11, 2018

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"

August 25, 2022

Did you find a solution to extend it.