I have made a custom field plugin.......i can see my plugin in Jira/Administration/Plugins
But I can't see the custom field......with a name Code Review I
plzzz....help
r u able to see custom field type?
any errors in log?
No .....
When you uploaded your new plugin, did you verify that it is enabled?
you can see it as the plugin is enabled
As you can see the plugin is enabled.....
yes the plugin is enabled....i tried to attach the snapshot...bt somehow it's not working....:-(
it seems somethink you missed in velocity files or atlassian-plugin.xml file
If the plugin is enabled ok, then then next question is whether you are offered the field *type* when you try to add a custom field. Most custom field plugins do NOT add a field, they enable a new TYPE of field and you have to add one in the same way you add all the standard ones. What happens when you go into the type selection for a new field? Are you offered the standard list, or is your new field type on there, or do you get a horrid Java stack trace? If it's the standard list, then can you check the log around the time you went into the screen, it will usually tell you if it's failed to get a handle on your field, and why.
Yes I am being offered the same list of fields.........
package com.altair.jira.plugins.jira.customfields;import java.math.BigDecimal;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType;import com.atlassian.jira.issue.customfields.impl.FieldValidationException;import com.atlassian.jira.issue.customfields.manager.GenericConfigManager;import com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister;import com.atlassian.jira.issue.customfields.persistence.PersistenceFieldType;public class CodeReview extends AbstractSingleFieldType { private static final Logger log = LoggerFactory.getLogger(CodeReviewId.class); public CodeReview(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager) { super(customFieldValuePersister, genericConfigManager);}@Override //this method explains what kind of database column to store the data in, here it is text protected PersistenceFieldType getDatabaseType() { return PersistenceFieldType.TYPE_LIMITED_TEXT; } protected Object getDbValueFromObject(String customFieldObject) { return getStringFromSingularObject(customFieldObject); }@Override protected Object getDbValueFromObject(Object customFieldObject) { return getStringFromSingularObject(customFieldObject); }@Override protected String getObjectFromDbValue(Object databaseValue) throws FieldValidationException { return getSingularObjectFromString(databaseValue.toString()); } public String getStringFromSingularObject(String reviewId) { if (reviewId == null) return null; else return reviewId; }@Override public String getStringFromSingularObject(Object reviewId) { if (reviewId == null) return null; else return reviewId.toString(); }
@Override public String getSingularObjectFromString(String reviewId) throws FieldValidationException { if (reviewId == null) return null; try { String str = new String(reviewId); // Check that we don't have too many decimal places if (str.length() < 2) { throw new FieldValidationException( "Mininum 2 chracters required"); } return str; } catch (NumberFormatException ex) { throw new FieldValidationException("Not a valid reviewId"); } } }
view.vm
#customControlHeader ($action $customField.id $customField.name $fieldLayoutItem.required $displayParameters $auiparams)<input class="text" id="$customField.id" name="$customField.id" type="text" value="$textutils.htmlEncode($!value)" />#customControlFooter ($action $customField.id $fieldLayoutItem.fieldDescription $displayParameters $auiparams)
atlassian-plugin.xml
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}"/> </plugin-info> <resource type="i18n" name="i18n" location="com.altair.jira.plugins.altairplugins"/> <customfield-type name="Code Review Id" i18n-name-key="code-review-id.name" key="code-review-id" class="com.altair.jira.plugins.jira.customfields.CodeReviewId"> <description key="code-review-id.description">The Code Review Id Plugin</description> <resource name="view" type="velocity" location="/templates/customfields/code-review-id/view.vm"/> <resource name="edit" type="velocity" location="/templates/customfields/code-review-id/edit.vm"/> </customfield-type></atlassian-plugin>
It looks like you're new here. Sign in or register to get started.