Copy Parsed Text to a Field time field

Issue #519 resolved
ME created an issue

Hi Fidel,

Using "Copy Parsed Text to a Field" post function.

I'm trying to copy a time value to a text cf. However that doesn't seem to be an option. When copying for example:

Field %{12201} = 1d Field %{12202} = 2d Post Function: Between %{12201} and %{12202} Results: Between 32400 and 64800

I would like to see Between 1d and 2d.

Is that possible?

Comments (40)

  1. Fidel Castro Armario repo owner

    Moshe, TIME is not a standard custom field type of JIRA. Are you sure that's the name of the custom field type? Maybe it's being confused with name of the custom field itself, isn't it?

    I case it's a custom field type, which plugin is providing that type of custom field?

  2. ME reporter

    Hi Fidel,

    We have a custom field type called time that behaves like estimated time field in Jira, I cannot seem to figure out what plugin provides that cf.

    So maybe in order to help me, you can pretend I'm trying to fill the estimated time field with your post function?.

    THanks

  3. Fidel Castro Armario repo owner

    You can check up the custom field type at Administration > Issue > Custom fields, like shown in the screenshot:

    field_types.png

  4. Fidel Castro Armario repo owner

    Try this text expression in advanced parsing mode:

    "Between " + shortFormatDuration(modulus({12201} * 1000, 9 * {HOUR}) + floor({12201} * 1000 / 9 / {HOUR})) + " and " + shortFormatDuration(modulus({12202} * 1000, 9 * {HOUR}) + floor({12202} * 1000 / 9 / {HOUR})) + "."
    

    You need to update to the most recent version of the plugin.

  5. Fidel Castro Armario repo owner

    Sorry, use the following text to be parsed:

    "Between " + shortFormatDuration(modulus({12201} * 1000, 9 * {HOUR}) + floor({12201} * 1000 / 9 / {HOUR}) * {DAY}) + " and " + shortFormatDuration(modulus({12202} * 1000, 9 * {HOUR}) + floor({12202} * 1000 / 9 / {HOUR}) * {DAY}) + "."
    
  6. ME reporter

    Hi, That worked, many thanks.

    Let me ask you how to add the following at the end? " |By Current User"

  7. Fidel Castro Armario repo owner

    Use this text to be parsed:

    "Between " + shortFormatDuration(modulus({12201} * 1000, 9 * {HOUR}) + floor({12201} * 1000 / 9 / {HOUR}) * {DAY}) + " and " + shortFormatDuration(modulus({12202} * 1000, 9 * {HOUR}) + floor({12202} * 1000 / 9 / {HOUR}) * {DAY}) + ".|By Current User"
    
  8. Fidel Castro Armario repo owner

    Then use:

    "Between " + shortFormatDuration(modulus({12201} * 1000, 9 * {HOUR}) + floor({12201} * 1000 / 9 / {HOUR}) * {DAY}) + " and " + shortFormatDuration(modulus({12202} * 1000, 9 * {HOUR}) + floor({12202} * 1000 / 9 / {HOUR}) * {DAY}) + " | By " + %{00021}
    
  9. ME reporter

    Hi Fidel,

    When I do "1w 2d 4h 30m" it displays in the post function as "1w 4h 30m" or when i got "2w - 4w" I get "Between 1w 3d and 2w 6d" through the post function

    please assist Thanks

  10. Fidel Castro Armario repo owner

    Hi Moshe, I need to know which plugin are you using for creating Time custom fields. That way I will be able to reproduce the same behavior you are experiencing, and maybe fix it.

  11. ME reporter

    Hi cannot seem to figure out what plugin provides this custom field. I will try disabling plugin by plugin and will let you know the results.

  12. Fidel Castro Armario repo owner

    Hi Moshe,

    Try the following text expression:

    "Between " + shortFormatDuration(modulus({12201} * 1000, 9 * {HOUR}) + floor(modulus({12201} * 1000, 9 * 5 * {HOUR}) / 9 / {HOUR}) * {DAY} + floor({12201} * 1000 / 9 / 5 / {HOUR}) * {WEEK}) + " and " + shortFormatDuration(modulus({12202} * 1000, 9 * {HOUR}) + floor(modulus({12202} * 1000, 9 * 5 * {HOUR}) / 9 / {HOUR}) * {DAY} + floor({12202} * 1000 / 9 / 5 / {HOUR}) * {WEEK}) + " | By " + %{00021}
    

    9 is the number of hours in a work-day, and 5 number of days in a work-week.

  13. ME reporter

    That solved the problem.

    Let me ask you on a side note, is there a way to count one of the working days as 5 hours only instead of 9 hours (as we only work 5 hours n friday)?

    Thanks

  14. Fidel Castro Armario repo owner

    Hi Moshe,

    Sorry, but it's not possible to do it, since when you enter a duration at Time custom fields, for example "3d 1h", you don't say whether one of those 3 days is Friday, you simply are saying there are 3 days.

    The only possible solution is to average the number of hours in a work-day like this: (4 * 9 + 5) / 5 = 8.2 hours per work-day, instead of 9. But you should also change the configuration in JIRA in order to make Time fields consider 8.2 hours per work-day.

  15. ME reporter

    Hi Fidel,

    Just a quick question in regards to my issue of having less hours on friday,as mentioned above.

    I'm thinking maybe there is a way to do that in the math of the "Time to be logged" in your Log Work post function, to have it minus the hours that go above the 4 hours that has been worked on Friday for example?

  16. Fidel Castro Armario repo owner

    Hi Moshe, sorry but it would require a function for subtracting dates according to a custom work-schedule, which is not currently possible.

    Anyway, it's in the plugin's "to do" list. You can follow and vote for the following issue: Issue #443. I will close it once it's implemented.

  17. ME reporter

    Hi Fidel, I Can use some help

    Using your "Copy a parsed text to a field" post function, I'm trying to parse that same above mentioned "Time" field, however this time to the "Original Estimate" field and I cannot seem to figure out how.

    Please assist... Many thanks

  18. Fidel Castro Armario repo owner

    Since version 2.2.34 you can use the following simpler text expression:

    "Between " + shortFormatWorkDuration({12201} * 1000) + " and " + shortFormatWorkDuration({12202} * 1000) + " | By " + %{00021}
    

    I recommend you to update and use this expression, which much easier to understand.

  19. ME reporter

    I believe you misunderstood me. This time I'm trying to set the Jira system Field "Original Estimate" with the value of the TIME custom field that comes along as part of Epic Sum Up.

  20. Fidel Castro Armario repo owner

    Sorry, Moshe, I didn't understood you, although your request is clearly explained. I'm very tired today :-).

    Please, try "Mathematical and date-time expression calculator" with the following configuration:

    • Target field: Original estimate (minutes)
    • Formula:
    {12201} * 1000 / {MINUTE}
    

    Explanation: "Epic Sum Up" fields return a number of seconds while the time calculations in JIRA Workflow Toolbox use milliseconds, that's why we multiply by 1000. Then we divide by {MINUTE} since Original estimate (minutes) expects a number of minutes.

  21. Log in to comment