Hi
I want to copy value from a custom field over to comments with prefix custom field name and followed by the value.
e.g. say I have a custom field Driver Version with a value of say 1.2.3. I want to copy in the comments this text Driver Version: 1.2.3.
I want to this task in bulk (i.e update 2000 issues at one go).
Is this possible?
Rahul
Thanks. This was helpful. This is the script I ended up with. I was hoping to parameterize it but never quite got that far.
// For all issues with a value for specified custom field, append CustomFieldName: CustomFieldValue to the description and as a comment. // Set both name of custom field and ID before running this script. // Confirm correct operation by checking at least one issue. // This is used to avoid losing data when deleting a custom field. string fieldName = "My Custom Field Name"; string curruser = currentUser(); string[] keys = selectIssues("\"" + fieldName + "\" is not EMPTY"); for (string k in keys) { // Get field value string fieldValue = %k%.customfield_11514; /* The code below does not work for field names with spaces in them, so use the line above string[] fieldValues = getIssueFields(k); string fieldValue = fieldValues[fieldName]; */ // Append custom field name and value to description field %k%.description = %k%.description + "\r\n\r\n" + fieldName + ": " + fieldValue; // Append custom field name and value as a comment addComment(k, curruser, fieldName + ": " + fieldValue); }
HI Nell,
Can I know where should I implement this code like post function?
I want to implement on bulk update, is it possible?
Can I know how to implement because i am new this scriptrunner? What are the requirements to implement this?
Thanks,
Jana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Obviously it is possible.
1. Install JJupin
2. Add the SIL runner on the dashboard and run the following script
string curruser = currentUser();
string [] keys = selectIssues("project = PRJ ..... bla bla");
for(string k in keys) {
addComment(k, curruser, "Driver version:" + customfield_54321);
}
3. Uninstall JJupin
Note: I did not tested the script, this is just the example, and you anyway need to put a proper JQL and customfieldId into it.
Ah, ... and JJupin has a nice feature, it shows where CF's are used. You may want to try that too ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Luther
This is just an example, the need behind this is that we are trying to cut down on number of custom fields.
Once we copy the data to comments we are going to delete the custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any comments guys?
Thanks in advance for your help
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can I ask why you would do this? Since Driver Version is already being tracked on the issues, why would you put in a comment with the exact same data?
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.