Store Executer to Custom Field

Store Executer

Stores Executer of transition into customfield

public class StoreExecuterFunction implements FunctionProvider{

	private FieldManager fieldManager;

	private static final Category log = Category.getInstance(StoreExecuterFunction.class);

	public void execute(Map transientVars, Map args, PropertySet ps) {

	GenericValue issue = (GenericValue)transientVars.get("issue");
        String fieldName = (String)args.get("field.name");
        try
        {
        	// get CustomField from FieldManager
        	fieldManager = ManagerFactory.getFieldManager();
        	CustomField cf = fieldManager.getCustomField(fieldName);

        	// get the type of CustomField
        	String cfType = cf.getCustomFieldType().getKey();
        	User executer = (User)ManagerFactory.getWorkflowManager().getRemoteUser(transientVars);

        	if (cfType.equals("com.atlassian.jira.plugin.system.customfieldtypes:userpicker"))
        	{
        		cf.updateValue(issue,executer);
        		issue.store();
        	}
        	else // simple String
        	{
        		cf.updateValue(issue,executer.getName());
        		issue.store();
        	}
        }

        catch
        (Exception e)
        {
        	 log.error("Exception: " + e, e);
        }

	}
}

Labels

workflow workflow Delete
plugin plugin Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Aug 21, 2006

    Pete Schneider says:

    Is there a JAR file for this somewhere? I'd really like to have this functional...

    Is there a JAR file for this somewhere?

    I'd really like to have this functionality, but I'm not a coder at all, so I'm not sure what to do with this snippet of sourcecode to get it into my installation of Jira.

  2. Sep 29, 2006

    Carl Jones says:

    A JAR file would be much appreciated.  I presume that it would be a post fu...

    A JAR file would be much appreciated.  I presume that it would be a post function.  I'd like this so that when QA rejects a fix by engineering that the transition can re-assign the issue back to the proper engineer!

    1. Sep 29, 2006

      Philip Herbst says:

      I see what i can do. Cheers, Philip

      I see what i can do.

      Cheers,

      Philip

  3. May 31, 2007

    Michael Garmon says:

    Hi Philip, In your last comment you stated that you would see what you could do...

    Hi Philip,

    In your last comment you stated that you would see what you could do about creating this as a JAR file. Where you able to do this and if so where could I get this JAR file?I would make it easer for me to implement this if you would.

    Thank you

    Mike