Hi All,
We are calling WCMUsePojo (AbcDetails) and want to pass an attribute (part no) which are coming via handlebar, and somehow the attributes are not getting resolved. However, in data-sly-call we can pass the handlebar attributes.
Views
Replies
Total Likes
Hello @Gunjan_13 -
<sly data-sly-use.abcDetails="com.abc.demo.AbcDetails">
<sly data-sly-call="${testTemplate.demoOrder @abcInfo=abcDetails.getProperties(), partNo=partNo}">
</sly>
</sly>
Thank you @Tanika02 for looking into it.
The problem is I need to call the WCMUse and need to pass a value. And then I will get an object from the WCMUse, and later I need to call another sightly and pass that object and few more attributes. These attributes I am getting from handlebar and the below line works too (if I can get abcDetails anyhow)
data-sly-call="${testTemplate.demoOrder @abcInfo=abcDetails, definition='{{../../demo}}', parentIndex='{{../../test}}', info='{{../test1}}'}">
NOT WORKING -
data-sly-use.abcDetails="${'com.abc.demo.AbcDetails' @partNo = '{{../partNo}}'}">
partNo is going AS IS ( '{{../partNo}}') to the WCMUse, I am not sure why it is not getting resolved. But, when I save the value to the workingPartNo, workingPartNo is getting printed correctly.
<sly data-sly-test.workingPartNo ="{{../partNo}}">
workingPartNo - has the right value.
ISSUE - How to pass workingPartNo to WCUSe and get the abcDetails.
Hi @Gunjan_13 , when you were able to print them correctly <sly data-sly-test.workingPartNo ="{{../partNo}}"> can you try sending saved workingPartNo instead of handlebar attribute directly like below
<data-sly-use.abcDetails="${'com.abc.demo.AbcDetails' @partNo = workingPartNo}">
I believe handlebar values are only accessible inside handlebar script tags.
Hi @krishna_sai yes was able to print it, and tried sending like above, But it dint work.
Hello @Gunjan_13
Have you tried doing this the JavaScript way?
<script data-sly-script="workingPartNo = ${../partNo @ context='scriptString'}"></script>
<sly data-sly-use.abcDetails="com.abc.demo.AbcDetails @partNo=workingPartNo"></sly>
Views
Likes
Replies
Views
Likes
Replies