I cannot see my custom field

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

8 answers

This widget could not be displayed.

r u able to see custom field type?

any errors in log?

This widget could not be displayed.

No .....

This widget could not be displayed.

When you uploaded your new plugin, did you verify that it is enabled?

This widget could not be displayed.

you can see it as the plugin is enabled

This widget could not be displayed.

As you can see the plugin is enabled.....

This widget could not be displayed.

yes the plugin is enabled....i tried to attach the snapshot...bt somehow it's not working....:-(

This widget could not be displayed.

it seems somethink you missed in velocity files or atlassian-plugin.xml file

This widget could not be displayed.

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>

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

202 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you