i need to copy the system filed value to the custom filed while creating the issue, could any one post the code to get the value from system field
Hey there Manideep!
Usually you can get the value of a system field simply by calling methods directly on the Issue object. For instance, if you're dealing with a MutableIssue object, you have a ton of getter methods at your disposal:
issue.summary //gets you the summary
issue.description //gets you the description
//etc...
But it really depends on the context. What is your use-case? Why are you trying to get the system field values and where are you wanting to get them (i.e. in a post-function, behaviour, listener, etc...)?
Hi Aidan Derossett [Adaptavist]
Thanks for reply,
As i was new to this scriptrunner.this was one of our requirement
I want to get them in behaviour , i tried with issue .summary showing null but i was failed to get the issue object could you suggest me the way how to get the issue object
I you post the complete code that would help me a lot.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey again,
For Behaviours the process is a little bit different. If you'd simply like to access a field that's on the form (like the create issue dialog or something), then we have a whole bunch of built in methods that you can use to do so: getFieldById, getFieldByName, etc... And with those you can get the summary field:
def summary = getFieldById("summary")
def summaryVal = summary.value
//etc...
But, if you need the issue object itself, we also have built-in variables that you can use, like "underlyingIssue." That variable represents the current issue, so it's an Issue object and you could treat it as such, doing something like:
def summary = underlyingIssue.summary
If you want to know more about Behaviours or need to look at some examples, we have some great resources in our documentation.
Does that answer your question? :D
Best,
Aidan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aidan Derossett [Adaptavist],
Thanks very very much, its works fine.
I had one more doubt this works when we are creating the task, but what about the already created ones. Do i need to write post functions , if we write post function how can we add custom fields programatically
Thanks
Manideep
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.