Accessing old value of ID?

When a ticket is moved from one project to another, it's ID is changed according to the new project. We use an external list of the tickets and need to update that list accordingly in that case. I'm currently updating old workflows to Javascript. In the old workflows I could access the old ID via

var id=issue.project.oldValue.shortName+"-"+issue.numberInProject.oldValue;

I cannot find a way to do this with the Javascript based workflows. Calls like

issue.oldValue('id');

fail and I cannot find any other fitting parameters or functions. Is there a way to do this?

4 comments
Comment actions Permalink
Official comment

Hello,

I am afraid, YouTrack workflow does not allow getting the old issue's ID for now. Please feel free to vote for this feature request: JT-12687 to increase its priority and to receive the updates.

Should you have any further questions, feel free to contact us.

Comment actions Permalink

I don't think the feature request relates to my issue. We have developed workflows with the old domain-specific language that can handle this as described above. Now, we want to use the current version and thus update our workflows to JavaScript. If there is currently no solution to do that in JavaScript, we cannot do that yet. Should you not consider this a missing feature as it was possible with the old workflows but is not possible any more?

We would really like to update to JavaScript, but it seems this is currently not possible and would be glad if this could be fixed soon.

0
Comment actions Permalink

Hello,

Thank you for the clarification. I have found that there is the following workaround: ctx.issue.oldValue('project').key + '-' + ctx.issue.oldValue('numberInProject').

Please check JT-48918. I hope it will be helpful. 

0
Comment actions Permalink

It worked great! The old workflow is converted. We are currently testing it and will propably switch soon.

Thanks a lot!

0

Please sign in to leave a comment.