I've been trying to follow this article:
I have not been successful. Here is what I have so far:
I changed the web request from EMPTY to Issue Data and it finally worked, so it seems the documentation was either for a different purpose or not correct.
Hello @Jh
Based on this
...your issue's Description field literally contains the text
Worker's Manager |
You won't be able to extract a name from the Description field if the field doesn't contain the information.
Please provide an example of the text that you expect the Description field to contain.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I blurred it out but the log basically shows
Description: Worker's Manager | John Smith
I'd like for it to read the value after:
Worker's Manager | xxxx
OR
Proposed Manager | xxxx
The xxxx will always be a display name of a user
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What are the details of your Create Variable step(s)?
Will the Description field always have both Worker's Manager and the Proposed Manager information, or just one or the other?
Can the Description contain any additional text after the name you are trying to extract?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Create Variable Name/Value
managerDisplayName
{{issue.description.match("(Worker’s Manager \| |Worker's Manager \| |Proposed Manager \| )([^\n\r]+)").group(2)}}
Create Variable Name/Value
managerAccountId
{{webResponse.body.get(0).accountId}}
The description only has one or the other and does not have any other text other than the Display Name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where are you getting the information about the use of the group() function appended to the match() function? Can you provide a link to your source? I could not find any mention of it in the documentation for manipulating text smart values.
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/
Nor did I find it mentioned in the solution in the post you referenced.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
group() function, I took from some examples I've found. Like: Example
From what I thought, it captures all the text following the specified prefix until the end of the line.
match() function, I meant to use the smart value that matches either "Worker's Manager | " or "Proposed Manager | " and captures the text following it.
If this is the issue or if you have suggestions on how to handle it better, please let me know. I followed the link I mentioned to the T before but that did not work either.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have links to any examples showing group() being used? The one you provided does not do that.
Regardless, based on this:
The description only has one or the other and does not have any other text other than the Display Name.
...I believe you can simplify your Create Variable statement to use this instead:
{{issue.Description.substringAfter("|")}}
The substringAfter() function is documented here:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please provide screen images showing your modified rule, and screen images showing the details of each step.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Smart value field/variable names are case and spacing sensitive. In you Log action you have not used the exact same variable name that you used in your Create Variable action. The case of the "n" in "name" is not the same.
You have that same mismatch in your Send Web Request
Make sure all uses of the variable have the exact same case as the Name that you assigned to the variable and see if that changes the results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you confirmed manually that a user exist that actually has the displayName for which you are searching?
If the web response body is empty, that suggests no matches were found.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems the issue is the web request showing empty. From the original post link I sent, others have had the same issue, although I followed the instructions on converting my API token to the format they suggested, ensuring no extra spaces or line breaks.
<EMAIL>:<API_TOKEN>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I changed the web request from EMPTY to Issue Data and it finally worked, so it seems the documentation was either for a different purpose or not correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is great news!
If my responses helped you resolve your issue, please consider clicking the Accept Answer button to mark your Question as Solved. That helps others searching the community find posts with validated solutions.
You also have the option to create a new Answer on your post with the information about you learned above about the Web Request Body setting, and click Accept Answer on that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.