Reply to Message

View discussion in a popup

Replying to:
RainerVM
Enthusiast
Enthusiast

Hi Angela,

sorry this works also not, because during the execution of the workflow there is no endDate available. And doing the same with the startDate doesn't work either, because it could be that another workflow has been started a view milliseconds later than the current, then I would get the other one and not the current running.

But I found a way to get the current workflow token by myself, a bit tricky but it works

For everyone who is interested in - here you will find the code of an Action (I called it getCurrentWfToken):

Input: none (but must be used within a workflow)

Output: WorkflowToken of the current running workflow

var objWfToken = null;

try {

var strAnswerUrl = workflow.getAnswerUrl().url;

var strWfTokenId = strAnswerUrl .replace(/^(\[\s\S]TokenId=)|(&returnUrl\[\s\S])$/g,"");

objWfToken = Server.findForType("WorkflowToken",strWfTokenId);

} catch (objErrMsg) {

System.error(objErrMsg);

}

return objWfToken;

Reply
0 Kudos