Hi all, at the Prozess start is possible to set in Workflow Mode "Persist task on creation". Is there any possibility to set this in script dynamically using API? We sometimes need it sometimes not.

Karel Tauser

asked 28.01.2016 at 09:31

tauser's gravatar image

tauser
(suspended)
accept rate: 33%


Currently there is no explicit API. But as a workaround an operation could be peformed which requires a persistent case/task. E.g. by creating (and deleting) a note.

To simplify the usage (and to hide the 'workaround') a helper class (located in the src folder of the project) could fit.

package wf;

import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.security.SecurityManagerFactory;
import ch.ivyteam.ivy.workflow.INote;

public final class TaskUtil {
    public static void persistCurrentTask() throws Exception {
        SecurityManagerFactory.getSecurityManager().executeAsSystem(() -> {
            INote note = Ivy.wfTask().createNote(Ivy.session(), TaskUtil.class.getName());
            Ivy.wfTask().deleteNote(note);
            return null;
        });
    }
}

Usage of the of the above method inside a script step:

wf.TaskUtil.persistCurrentTask()
link

answered 28.01.2016 at 15:20

Flavio%20Sadeghi's gravatar image

Flavio Sadeghi ♦♦
(suspended)
accept rate: 75%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×37

Asked: 28.01.2016 at 09:31

Seen: 1,843 times

Last updated: 28.01.2016 at 15:20