Uploaded image for project: 'PUBLIC - Liferay Documentation'
  1. PUBLIC - Liferay Documentation
  2. LRDOCS-3215

How to use services in other bundles than under kernel should be included in Scripting in workflow document.

    Details

    • Type: New Article
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Fix Version/s: 7.0.x
    • Component/s: Forms
    • Labels:

      Description

      How to use services in other bundles than under kernel should be included in Scripting in workflow document.

      Can you add more samples, or at least a sample calling services in other bundles than kernel related services as below?

      I just worked on Scripting in workflow but found out there's no documentation in terms of calling bundles other than under kernel.

      Since DXP is on OSGi, I figured out RegistryUtil that's used in Java code might also work in Script and confirmed it worked. (Without RegistryUtil, you'll get exception and can't call JournalArticleLocalService)

      The sample I used was below.

      1. Add web contents.
      2. Add the script below to the whatever the workflow and assign to something , or simulate it in Script window.

      import com.liferay.registry.RegistryUtil;
      import com.liferay.journal.model.JournalArticle;
      import com.liferay.journal.model.JournalArticleDisplay;
      def jalocalservice = RegistryUtil.getRegistry().getService("com.liferay.journal.service.JournalArticleLocalService");
      
      def articles = jalocalservice.getArticles();
      for (JournalArticle at:articles) {
          out.println("article Name:${at.getUrlTitle()}");
      }
      

      Then the output will be the titles of created Web contents.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: