Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
vasilev
Creator
Creator

Creating story via Qlik Sense extension

Hello guys,

I try to script an extension, which creates a story with more slides. The trigger should be a button. I could initially create the story, but I don't know how to create new slides. You will find my script bellow. 

 

define( [ "qlik"
],
function ( qlik) {
 
return {
support : {
snapshot: true,
export: true,
exportData : false
},
paint: async function ($element) {
 
$element.empty();
const app = qlik.currApp();
const appId = app.id.split("\\").pop();
 
console.log("qlik:", qlik)
console.log("App:", app)
 
if (appId != "Test.qvf") {
$element.append("<p>This extension is only for the Bonus Scorecards app available!</p>");
return;
}
 
$element.html('<button id="storyBtn">Generate story</button>');
document.getElementById("storyBtn").addEventListener("click", async () => {
  const engineApp = app.model.engineApp;
 
  try {
// Story erzeugen
const story = await engineApp.createObject({
"qProp": {
"qInfo": {
"qId": "",
"qType": "story"
},
"qExtendsId": "",
"qMetaDef": {"title": "Neue Story über Extension", "description": "Story description"},
"qStateName": "",
"rank": 0,
"thumbnail": {"qStaticContentUrlDef": {}},
"qChildListDef": {"qData": {"title": "/title", "rank": "/rank"}}
}
});
 
console.log("story:", story)
const storyHandle = story.qInfo.handle;
console.log("storyHandle:", storyHandle)
 
alert("Story wurde erfolgreich erstellt!");
  } catch (err) {
console.error("Fehler bei der Story-Erstellung:", err);
alert("Fehler bei der Story-Erstellung (siehe Konsole)");
  }
});
 
//needed for export
return qlik.Promise.resolve();
}
};
 
} );

 

 

Using the API engine explorer I would use the method createChild to create a new slide. 

{
"handle": 2,
"method": "CreateChild",
"params": {
"qProp": {
"qInfo": {
"qId": "",
"qType": "slide"
},
"qExtendsId": "",
"qMetaDef": {},
"qStateName": "",
"qChildListDef": {"qData": {"title": "/title", "sheetId": "/sheetId", "ratio": "/ratio", "position": "/position",
                                "dataPath": "/dataPath", "srcPath": "/srcPath", "visualization": "/visualization",
                                "visualizationType": "/visualizationType", "style": "/style"}}
},
"qPropForThis": null
}
}

Unfortunately I can not find such a method in the app engine model. Could somebody help me to find a solution of this issue?
 
BR,
Rumen
Labels (4)
0 Replies