Hello together.
I am using the CLI so set some custom field values and I encounter the problem that I cannot set linebreaks.
I am particularily using the "setFieldValue"-command as in the script below
<PATH TO CLI>/jira --server "http://SERVER" --user "USER" --password "PASSWORD" --action setFieldValue --issue "ISSUE-ID" --field "FIELDNAME" --values "LINE 1 >> HOW TO INSERT NEW LINE HERE << LINE 2" --appendText
I tried a.o. with "\n", "\n ", " \n ","\r\n", "\r\n ", "\\". (All of them just make the charakters in the field, only " \n " brings up an "Exception 1" without any further note.
I have the target field with the "Normal Text Renderer" and with the "Wiki Markup Renderer" configured and editing the field directly (using the Enter Key) successfully creates a linebreak.
Any clue what I have to write there in order to create the linebreak?
Kind regards
Sascha Mareth
I "solved" this by using Ruby with the jira gem to update the custom field, where "\n" is interpreted as new line.
This particular question still is unanswered, but its not more an issue either.
Hi Sascha,
according to the documentation it should work with " \n "
Some text fields support the automatic conversion of " \n " (blanks are significant) to be replaced with a new line character - example: --description "A multi-line text field: \n # line 1 \n # line 2"
https://bobswift.atlassian.net/wiki/display/JCLI/Documentation#Documentation-setFieldValue
But I see you solved it anyway :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, the solution was to place the space character before and after the "\n" right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
I saw this also and tried it with and without spaces - but in my case nothing really worked (not even the " \n "-version with spaces before and after), so I switched to another method.
Even if this question is not really answered so far, it is also not an "open issue" anymore, and I am not available the next 2 weeks.
Thank you for all your feedback and suggestions anyways.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am having a similar problem with updating a page with rest, I have tried all the above suggestions but the page appears with no linebreaks nevertheless:
def write_data(auth, html, pageid, title = None): info = get_page_info(auth, pageid) ver = int(info['version']['number']) + 1 ancestors = get_page_ancestors(auth, pageid) anc = ancestors[-1] del anc['_links'] del anc['_expandable'] # del anc['extensions'] if title is not None: info['title'] = title data = { 'id' : str(pageid), 'type' : 'page', 'title' : info['title'], 'version' : {'number' : ver}, 'ancestors' : [anc], 'body' : { 'storage' : { 'representation' : 'storage', 'value' : str(html).replace("[log]","[log]\\\n"), } } } data = json.dumps(data) url = '{base}/{pageid}'.format(base = BASE_URL, pageid = pageid) print(data) r = requests.put( url, data = data, auth = auth, headers = { 'Content-Type' : 'application/json'} ) r.raise_for_status() print("Wrote '%s' version %d" % (info['title'], ver)) print("URL: %s%d" % (VIEW_URL, pageid))
The print(data) prints the following:
{"id": "118591392", "version": {"number": 26}, "body": {"storage": {"value": "[log]\\\n CLICK on L(1058,443)@S(0)[0,0 1920x1080]\n[log]\\\n
( Ctrl ) TYPE \"n\"\n[log]\\\n CLICK on L(1071,312)@S(0)[0,0 1920x1080]\n[log]\\\n ( Ctrl ) TYPE \"s\"\n", "representation": "storage"}}, "t
ype": "page", "title": "test2", "ancestors": [{"id": "118591369", "type": "page", "title": "test"}]}
And the outcome looks like this:
Screen Shot 2015-04-20 at 15.27.35.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The "Exception 1" is not reproducable anymore and I did not find other informations where this occured so far.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I "solved" this by using Ruby with the jira gem to update the custom field, where "\n" is interpreted as new line.
This particular question still is unanswered, but its not more an issue either.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try using octal escape, like "\012"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried now, but it does not work either -> using the "Enter"-code just makes the field to be finished and the rest ist cut off.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should report this issue to Atlassian, because I believe it's a bug in their CLI.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try to print the stack trace of the exception to get a bit more info where the error occurs?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.