Getting delivery template content from AEM | Community
Skip to main content
Marcel_Szimonisz
Community Advisor
Community Advisor
March 17, 2022
Solved

Getting delivery template content from AEM

  • March 17, 2022
  • 1 reply
  • 1608 views

Hello,

I have problems to get content of delivery from AEM. I am using the AEM integration package function from JS library nms:amcIntegration.js

 

 

 

/** * Get the current content value from AEM * {DOMDocument} elDelivery The delivery * {DOMDocument} The node containing the content parts */ function nms_delivery_aemGetContent(elDelivery) { var result = <content/>; var iCMSAccountId = elDelivery.@["cmsAccount-id"];

 

 

  But any type of delivery object I provide it will always fail on the line

 

var iCMSAccountId = elDelivery.@["cmsAccount-id"];

 

I tried NLWS.nmsDelivery.load(), queryDef with JXON  (have not tried with XML). Can somebody give me some hints? Any help would be appreciated.

 

 

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

Hi @marcel_szimonisz,

 

Did you try to print the value of 

elDelivery.@["cmsAccount-id"]

before the line where it is referenced?

Does it also have values set for

elDelivery.@contentEditingMode

and

elDelivery.remoteContent.@remotePath?

 

If it is the OOTB implementation, these would be the minimum required configurations to fetch data from AEM? Is the template initially synced from AEM, or you are trying to call this in a JavaScript somewhere?

 

Thanks,

Ishan


Hey @2108451 I took the function and changed the delivery argument to be of object coming from NLWS.nmsDelivery.load(id) and it worked.

 

No idea still what version of delivery object the original function wants

1 reply

isahore
Community Advisor
Community Advisor
March 17, 2022

Hi @marcel_szimonisz,

What error do you get at this line? In my understanding this should be the external account ID used to connect to your AEM instance. Can you check if the configuration of that external account is correct?

 

Thanks,

Ishan

Marcel_Szimonisz
Community Advisor
Community Advisor
March 17, 2022

I am getting:
17/03/2022 16:02:05 js JST-310000 Error while compiling script 'nms:amcIntegration.js' line 1731: invalid XML name.

Its the line where the external account is requested. If you check the data the external account is there. Just somehow i am passing that delivery argument in wrong format. Eventhough the type I am passing is domdocument its throwing this error

isahore
Community Advisor
Community Advisor
March 17, 2022

Hi @marcel_szimonisz,

 

Did you try to print the value of 

elDelivery.@["cmsAccount-id"]

before the line where it is referenced?

Does it also have values set for

elDelivery.@contentEditingMode

and

elDelivery.remoteContent.@remotePath?

 

If it is the OOTB implementation, these would be the minimum required configurations to fetch data from AEM? Is the template initially synced from AEM, or you are trying to call this in a JavaScript somewhere?

 

Thanks,

Ishan