Search code examples
javagroovysap-commerce-cloudbackoffice

How can i replace my widget controller with a groovy file?


Is it possible to replace a simple widget controller with Groovy class file controller ?

    <widget-definition ... id="com.mywidget">
        ...
        <controller class="MyCustomController.groovy"/>
    </widget-definition>   

Solution

  • You can still decalre your class, and call a groovy script that you can store in database, or in the classpaht, using ScriptingLanguagesService class.

    Or, create a cronjob with a scripting job, then you can run the cronjob from your class that will be used as a controller.

    Please refere to links below for technical details. https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/6.6.0.0/en-US/8bec04a386691014938a9996a977d07f.html

    https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/6.6.0.0/en-US/8b9d40fa86691014b471f5bf5a9715dd.html

    Play with those options to find a good way that fits you, I could not find any OOTB way to do what you asked for.