Neither tutorial nor sample app is working

I’m trying to do the tutorial:
https://developer.atlassian.com/platform/forge/check-jira-issues-assigned-using-workflow-validator/
besides the turorial will not work out of the box (2 bugs to get solved) after doing all the steps it does nothing at all, not even log a message.

Further I tried to create a sample app via ‘forge create’ and just added a console log message - still nothing is happening when the transition is done.

Code from the sample app created by template:

modules:
  jira:workflowValidator:
    - key: validator-test-example-workflow-validator
      function: main
      name: validator-test
      description: A Jira workflow validator example.
  function:
    - key: main
      handler: index.run
app:
  id: ari:cloud:ecosystem::app/3d57354f-970e-4203-9228-481dab833560
export const run = ({ issue, transition: { from, to } }) => {
  console.log('validator test:');

  return {
    result: false,
    errorMessage: `Issue ${issue.key} is not ready for transition from status ${from.id} to ${to.id}`,
  }
};

for good measurement I also tried to add the permission scopes for jira work:

permissions:
  scopes:
    - read:jira-work
    - write:jira-work

Hi @mbrach,
Welcome to Developer Atlassian Community.

I have run the exact code as you pasted and everything works for me.
Have you added your validator to a workflow transition and published the workflow draft?

Additionally, I’d like to say that I don’t get the second part of your post (“for good measurement, I also tried to add the permission scopes for jira work”) as the code seems to be exactly the same.

HI @BeataSzturemska,

thanks for the welcome :smiley:

I have

  • the validator available: yes
  • added it
  • published the draft
  • tried it with an old issues
  • created a new one

But I do not see an error message or even a log message in the tunnel - do you?
It still is only deployed in development - but i think this should work as well? Or is this perhaps an limitation for validators?
Any other things I’ve could have missed?

2nd part:
Missed the correct copy & paste :confused: sorry… I will edit :slight_smile:

@BeataSzturemska : I’ve added some screenshots, perhaps this helps you to point out what I am doing wrong… And Thank you in advance for the help :slight_smile:


image

Hi @mbrach , what is this issue is assigned validator? This looks like it’s registered by a different app you created. I don’t know what that validator does but if I were to believe the description, it fails because the issue from the screenshot is unassigned. Therefore the transition fails on that validator and the validator-test is not triggered.
Can you keep validator-test as the only validator in the transition and check again if it in fact is not triggered?

This was the first validator I tried to create, defined in the tutorial https://developer.atlassian.com/platform/forge/check-jira-issues-assigned-using-workflow-validator/?_ga=2.145111220.1634974503.1653979413-2102234732.1643808419
And its exactly what it should do: show an error during transition if no user is assigned. But this is NOT happening - that is why I tried to make an own test, which even does NOTHING…

The expected behavior IS to show an error, which is NOT happening…

FYI:
the Validator test is expected to not validate anything!
The expectation is: when a transition is happening, log an message to console and show an error anytime…

As you requested, I’ve removed the “issue is assigned” validator and kept the “validator-test”.
Result: still no console message, still no error shown in UI.

On base of another question (Error message from Workflow Validator not displaying on Jira Cloud Issue Create Screen), I’ve created a new validator defined only in manifest:

modules:
  jira:workflowValidator:
    - key: validator-expression-test-example-workflow-validator
      name: validator-expression-test
      description: A Jira workflow validator example.
      expression: true || false
      errorMessage: "Please display this..."

Even that is not doing anything…

I also tried to deploy and install the validators in the production environment, this was also not changing anything…

So either the validator implementation is not working at all, or there are some limitations, prerequisitions or settings which are not done. My site was freshly created and besides installing some apps from the tutorials I did not change anything there.

We had a call with @mbrach and it turned out that the workflow, where the validator was used, was never assigned to the project where the issues have been created. It was because the project was of a team-managed type. When we created a company-managed project, the validators registered by the Forge app worked as expected.

As of now, there’s no way to use Forge transition rules in the team-managed project’s workflow.

5 Likes

Great work and wonderful support! Thank you very much! :smiley:
Function based validator is now also working like expected :+1:

I gave feedback at the tutorial, that this limitation was not pointed out.

Only leaves the question why an workflow of an trashed project is still visible as active… In scheme view its shown :person_shrugging:
But that doesn’t bother me at all now :wink:

1 Like

@mbrach it must be because trashed project is not permanently removed and can be restored.

As a user I then would expect to find it in the inactive section, or at least that it would have a marker like the project itself in the schemes view :thinking:

Sure, I understand. You can create issues for any suggestions you have in the public Jira Cloud project. Thanks in advance for your contribution!

Also, the documentation for Forge workflow validators mentions at the top that it’s only available to the company-managed projects.