is there a way to restrict calendar creation to admins or specific people/groups?
Hi @Tobias
For your requirement, you could try something like this on the ScriptRunner Console:-
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
def issueManager = ComponentAccessor.issueManager
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issue = issueManager.getIssueByCurrentKey('MOCK-1') as MutableIssue
def description = issue.description.replace("\\n", "\n")
issue.setDescription(description)
issueManager.updateIssue(loggedInUser,issue, EventDispatchOption.DO_NOT_DISPATCH,false)
Please note, the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.
The main point is on this line:-
def description = issue.description.replace("\\n", "\n")
You will need to use the replace method to convert the \n parameter in your String which will be read as \\n to \n to enable the line break.
Below is a print screen of the ScriptRunner Console configuration:-
Below are a few test screens:-
1) This is how the text in the Description field is displayed initially:-
2) This is how the text in the Description field is after running the code above:-
I hope this helps to answer your question. :)
Thank you and Kind Regards,
Ram
Hi @Ram Kumar Aravindakshan _Adaptavist_
thanks for providing this solution it works really well. How to implement this in Jira? I think best would be to trigger it in a transition or what do you think? The best way would be after creation, but I think this could cause some problems.
Best Regards,
Tobias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tobias
You can either do it during a Transition, i.e. using the Post-Function or even using the Listener to answer your question.
If you want to do it using the Post-Function, you could even use the Create transition, i.e. once the issue is created, the text will be re-formatted. This shouldn't cause any issues.
Thank you and Kind Regards,
Ram
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.