简体   繁体   中英

How can i get page URL in single-approver-definition.xml in Kaleo workflow in Liferay?

How can i get the page URL in single-approver-definition.xml in the e-mail template that is used to send an e-mail to the content creator once the reviewer approves or rejects the submission. The existing xml is as follows:

<template>
    Your submission has been reviewed and the reviewer has applied the following: 
    ${taskComments}.
</template>

I tried ${serviceContext.getAttribute("contentURL")} and it didn't work.

I want to be able to do - Your submission for ${pageURL} has been reviewed and the reviewier has applied the following: \\n ${taskComments}.\\n

Any suggestions will be appreciated.

I don't get what variable exactly you want to process in your notification. As I can only assume, you are using it for Web Contents and all interesting variables are stored in two places.

  1. Workflow context variables - they are available directly. Few examples like:

    • ${taskComments}
    • ${entryType}
    • ${userId}
    • ${userName}
    • ...
  2. ServiceContext variables - they are available using $serviceContext. Few examples:

    • $serviceContext.getAttributes().get("version")
    • $serviceContext.getAttributes().get("articleId")
    • ${serviceContext.getPortalURL()}
    • ...

For all interesting variables check this url https://www.liferay.com/web/igor.beslic/blog/-/blogs/workflow-in-action-kaleo-workflow-context-variables Some could change already, however most of them is working fine for current version.

Content changes might be made on a page, they can also be triggered through Control Panel (or the API for that matter). When you're in a workflow, you typically don't have this context any more - if you find it somehow I'd not rely on it to be there. A workflow is unrelated to the UI and pages.

Also, an article might be submitted on one page, where it might be replaced/removed before it's even approved. In that case the link wouldn't help.

What might work is to check the concept behind "Web Content Display Pages" (if your article has them configured and you deal with web content). But the mechanics will vary depending on the actual content type you're dealing with. And content that goes through workflow might not be displayed on any page at all (eg when submitted through Control Panel) or on many different pages (either explicitly - Web Content Display - or implicitly - Asset Publisher).

@tomic basically provides pointers to what you have, I'm only reasoning why your initial problem is problematic to solve at best - it's not fully specifiable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM