Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Getting delivery template content from AEM

Avatar

Community Advisor

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.

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hey @Ishan 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

View solution in original post

4 Replies

Avatar

Level 4

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

Avatar

Community Advisor

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

Avatar

Level 4

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

Avatar

Correct answer by
Community Advisor

Hey @Ishan 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