Little Creative Idea Help Plz

Issue #606 resolved
Antônio3 created an issue

Hi, so im trying to create a little complex rule and having a dificult time, can you give me and idea, here's my scenario :

I have a Multi - User Picker field, where i input my users names and stuff. Called, userField1 I have this Single choice custom field, where i user can choose to put yes or no, Called Distribute

So the deal is, a User comes and put many names on UserField1, then he proceeds to the one called " Distribute " and places "Yes", when he does that, there is an automation on my WF, that create multiple issues based on the custom field " User field1" , So , lets suppose he placed the following user names on my custom field " UserField1"

" Jason.Momoa, "Agnes.Scout".

My workflow automation, will create based on the answer on the "Distribute" custom field being "Yes", several issues, based on the number of people on my "User field1", só in our case there will be 2 issues created wiith the following summary :

" Task for testing stuff (Jason.Momoa)" " Task for developing stuff ( Agnes.Scout)"

If i proceed to Re-make my transition again, there will be duplicated issues, what i want is to create a REGEX, that validates the following rule :

" If the value on my "userField1" is equal to the "Summary" of my Linked Issues (Is part of) , and my summary i will be taking the value between the parenthesis with the Following Regex (" (.[^(]*[$)]) ").

Any idea how can i set up a validator with that? , ive been trying to use the identify pattern tag, but i cant seem to make the regex and the logic to work.

Thanks in advance, great support!!!

Comments (7)

  1. Fidel Castro Armario repo owner

    Hi @antonio_stein,

    You can use "Create issues and subtasks" post-function with the following configuration:

    Captura de pantalla 2017-05-12 a las 23.20.40.png Captura de pantalla 2017-05-12 a las 23.21.00.png Captura de pantalla 2017-05-12 a las 23.21.35.png

    String list expression for generating the seed strings is:

    filterByPredicate(toStringList(%{nnnnn}), count(filterByPredicate(fieldValue(%{00000}, linkedIssues("relates to")), ^1% ~ ("(" + ^0% + ")"))) = 0) 
    

    Note that:

    • You should replace nnnnn with the field code of your Multi-Select custom field UserField1.
    • I have used issue link type "relates to". In your case you should use "is part of". Be careful to write it exactly.
    • %{00000} is field code for Summary.
    • I'm assuming that the issues you are creating are normal issues, i.e., non sub-task. In case they are sub-tasks, then you should use ^2% instead of ^1%, i.e., string list expression would be: filterByPredicate(toStringList(%{nnnnn}), count(filterByPredicate(fieldValue(%{00000}, linkedIssues("relates to")), ^2% ~ ("(" + ^0% + ")"))) = 0)

    String expression for summary is:

    "Task for testing stuff (" + ^% + ")"
    

    Boolean expression for Conditional execution is:

    %{mmmmm} = "Yes"
    

    replacing mmmmm with field code for Distribute custom field.

  2. Antônio3 Account Deactivated reporter

    Great, i'm applying this response to another problem im having, but that is not what i really need on this case, i need just to validate so i dont create duplicated issues using this method, i mean, i want to validate that i dont create multiple distributed issues with the same summary, if i create a distributed task for " Jason.Momoa" i cant create another distributed task for him, got it?

  3. Fidel Castro Armario repo owner

    Hi @antonio_stein,

    The provided string expression for generating the seed issues checks whether there already is an issue for each of the users selected at UserField1. It only returns as seed strings the users (options in UserField1 indeed) who doesn't have yet an issue linked to current issue with selected issue link type (in the example "relates to") and with summary containing the name of the user between parentheses.

    I think that seed string expression fulfills your requirements. Have you tried it?

  4. Antônio3 Account Deactivated reporter

    Oh, yea i see, i wrote the link type wrong, is there a way i can print a message to the user , so he can know that the transition isnt going to work putting this on a validator

  5. Fidel Castro Armario repo owner

    Hi @antonio_stein,

    You can use "Boolean validator with math, date-time or text-string terms" with the following boolean expressions:

    %{mmmmm} = "Yes" IMPLIES count(filterByPredicate(toStringList(%{nnnnn}), count(filterByPredicate(fieldValue(%{00000}, linkedIssues("relates to")), ^1% ~ ("(" + ^0% + ")"))) = 0)) > 0
    

    replacing nnnnn with the field code of your Multi-Select custom field UserField1, and mmmmm with field code for Distribute custom field.

    That validations checks that at least 1 seed string will be generated, i.e., at least a new issue will be created by the post-function.

  6. Antônio3 Account Deactivated reporter

    Oh, great it worked. thak you , i might need help with another trick, but i think ill open another ticket. i had to make a little change on the seed validator to make it work =ooo, thanks great support !!

  7. Log in to comment