Preview of content using jssp | Community
Skip to main content
Level 3
May 26, 2021
Solved

Preview of content using jssp

  • May 26, 2021
  • 1 reply
  • 3004 views

I am attempting to build a jssp page for content preview to be used inside a webapp for content creation. The goal is to have an iframe show the transformed content, just as the preview shown in the client content editor.

I got this:

 

<% logonEscalation("webapp"); response.setContentType("text/html;charset=utf-8"); var preview =[] var contentId = 86800; if(contentId>0){ preview = ncm.publishing.TransformJavaScript("rbe:blockContent","HTML", 86800 ) } document.write( preview[1]!=undefined ? preview[1].toSource() : "No content found") %>

 

And get error:

SOP-330011 Error while executing the method 'TransformJavaScript' of service 'ncm:publishing'.

Can anyone suggest what I should be doing?

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 CedricRey

Hello Jonas,

Are you able to preview these content in the console, via the publishing ?

 

Can you try to use the ncm.publishing.TransformFromId method ? In this case, you"ll have to give the ncm:publishing name (ns:name format) but also, the model name from the publishing (the one you gave in the Transformation models part, when you setup the type of tranformation (xsl or jst), the output format and then the XSL or JST to use) and for the third parameter, you have to give the content in a particular format : the content schema name (the one you created for your content, like 'ncm:content'), a pipe '|' and the id of the content.

It should be something like this :

<% var content = ncm.publishing.TransformFromId('cus:myPublishing','HTML','cus:myContent|123456'); %> <%==content[1]%>

 

This is what the console does when it displays preview from the content view.

 

Cédric

1 reply

CedricRey
CedricReyAccepted solution
Level 5
May 26, 2021

Hello Jonas,

Are you able to preview these content in the console, via the publishing ?

 

Can you try to use the ncm.publishing.TransformFromId method ? In this case, you"ll have to give the ncm:publishing name (ns:name format) but also, the model name from the publishing (the one you gave in the Transformation models part, when you setup the type of tranformation (xsl or jst), the output format and then the XSL or JST to use) and for the third parameter, you have to give the content in a particular format : the content schema name (the one you created for your content, like 'ncm:content'), a pipe '|' and the id of the content.

It should be something like this :

<% var content = ncm.publishing.TransformFromId('cus:myPublishing','HTML','cus:myContent|123456'); %> <%==content[1]%>

 

This is what the console does when it displays preview from the content view.

 

Cédric

CedricRey
Level 5
May 27, 2021
Jonas, I just see that you try to add the "Delivery operators" (name=delivery) right to the "webapp" operator. This is not this one I added, but the one with technical @2175539="content" (don't know the english label sorry).