Occasional Collector

Return value of beanshell script in output channel value empty with CMS_SET

Hello Team,

I am not getting return list value to HTML channel from Beanshell script execution. I have completely explained below the issue and details for your reference.

FS-Version: Version: 5.2.200312.78911

In Page Template code :


$CMS_SET(set_lang, #global.language)$

         $CMS_RENDER(script:"pagestoresort", pageFolderElement:pt_folder.get(),resultContainer:set_result)$   // Calling Script                       

         $CMS_SET(set_result)$$CMS_RENDER(script:"pagestoresort", pageFolderElement:pt_folder.get(),resultContainer:set_result)$$CMS_END_SET$ // Not calling

             Return_Size: $CMS_VALUE(set_result.size())$


                   $CMS_FOR(for_listValues, set_result)$



           $CMS_SET(set_page_folder, set_result.get(0))$                                                                                                

           $CMS_SET(set_image,set_page_folder.getFormData().get(set_lang, "pt_image_1").get())$                     

           $CMS_SET(set_headline,set_page_folder.getFormData().get(set_lang, "headline").get())$

Script Code:

Page lastUpdatedPage;

PageRefFolder siteStoreElement = context.getProperty("pageFolderElement");

List resultValue = context.getProperty("resultContainer");


.........//code  inside// ......



context.logInfo("**Page Class:**"+lastUpdatedPage.getClass());


context.logInfo("Result Return Size:"+resultValue.size());



Here problem is if i call the $CMS_RENDER()$ inside the $CMS_SET()$ it is not calling the script. If i call the $CMS_RENDER()$ out side the $CMS_SET()$ the specific script is called and i can see the log statements in the preview as shown in the image below.

Below screenshot is outside of CMS_SET tag RENDERED script:

18.10.2020 17:34:10.722 INFO  (Script 'pagestoresort' (id=1107464) at 0, 0): **UID:**demo_image_a_16_9_hd_2x

18.10.2020 17:34:10.722 INFO  (Script 'pagestoresort' (id=1107464) at 0, 0): **Page Class:**class

18.10.2020 17:34:10.722 INFO  (Script 'pagestoresort' (id=1107464) at 0, 0): Result Return Size:1



I am not sure what else i am missing here.. It will be helpful for me to resolve the problem.

Thanks and Regards,


0 Kudos
1 Reply
I'm new here

Re: Return value of beanshell script in output channel value empty with CMS_SET

Hi Siva,

This works as designed. Inside of CMS_SET, FirstSpirit-Expressions are treated as templates and will be evaluated once the set variable gets printed (e.g., via CMS_VALUE). For more information, see the online documentation on CMS_SET.

Best regards


0 Kudos