Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Power Custom Fields™ offers Fields offers the following option types:

...

You can use any option type with any type of the custom field type. For more information on custom fields, go to see the User Guide.

Option type

Description

Example

Component Picker

This option is rendered as a project component.

This is the SIL script to get project components.

  The

 The example below shows how to get all components that exist in the "TEST" project. The components will be added as options to the custom field which uses this SIL script as data source.

Code Block
string projectKey = "TEST";
string[] componentNames = admGetProjectComponents(projectKey);
number[] componentId;
for(string componentName in componentNames){
    JComponent componentNames = admGetProjectComponent(projectKey, componentName); 
    componentId += componentNames.id;
}
return componentId;

This is the SQL script

to get

that returns all components:

Code Block
select cname, id from component;

To see

it in action

how this works, see the PCF - Checkbox page.

Group Picker

An option is rendered as a group.

This is the SIL script

to get

that returns groups:

Code Block
return userGroups(currentUsername());
 It gets

It returns all groups

to which

that the current user belongs to. The groups will be added as options to the custom field which uses this SIL script as data source. 

This is the SQL script

to get

that returns all groups:

Code Block
select group_name from cwd_group;

To see

it in action, check out

how this works, see the PCF - Multi Select page.

Issue Picker

An option is rendered as an issue.

This is the SIL script

to get

that returns issues: 

Code Block
return selectIssues("created < now()");
 It gets

It returns all issues previously created. The issues will be added as options to the custom field which uses this SIL script as data source. 

This is the SQL script

to get

that returns all issue keys:

Code Block
select  p.project_key ||'-'||i.issuenum as "KEY"
from jiraissue i
inner join project_key p on p.project_id = i.project

To see

it in action, check out

how this works, see the PCF - Single Autocomplete page.

Project Picker

An option is rendered as a project.

This is the SIL script

to get

that returns projects:

Code Block
string [] projects = allProjects();
return projects;
 

It

gets

returns all previously created projects

previously created

. The projects will be added as options to the custom field which uses this SIL script as data source. 

This is the SQL script

to get

that returns all projects: 

Code Block
select pkey from project;

To see

it in action, check out

how this works, see the PCF - Radio Buttons page.

User Picker

An option is rendered as a user.

This is the SIL script

to get

that returns users:

Code Block
function getUsers(string [] groups){
  string [] users;
  for(string group in groups){
    string [] currentGrp;
    currentGrp = addElement(currentGrp, group);
    for(string user in usersInGroups(currentGrp)){
      users = addElementIfNotExist(users, user);
    }
  }
  return users;
}
 
 
string [] groups = {"jira-users"};
string [] users = getUsers(groups);
string [] res;
for (string user in users) {
    if (contains(user, argv["query"])) {
    res = addElementIfNotExist(res, usernameToUserKey(user));
    }
}
return res;
 It gets

It returns all users existing in some groups (in this case, "jira-users") and adds the usernames that match the search as options to the custom fields using this data source.

This is the SQL script to

get

return all users:

Code Block
select user_name from cwd_user;

To see it in action,

check out

see the PCF - Multiple Autocomplete page.

Version Picker

An option is rendered as a version.

This is the SIL script

to get

that returns versions:

Code Block
string projectKey = "TEST";
string[] versionNames = admGetProjectVersions(projectKey);
number[] versionId;
for(string versionName in versionNames){
    JVersion version = admGetProjectVersion(projectKey, versionName); 
    versionId += version.id;
}
return versionId;
 It gets

It returns all versions

existing

that exist in the "TEST" project. The versions will be added as options to the custom field which uses this SIL script as data source. 

This is the SQL script to

get

return all versions.

Code Block
select vname, id from projectversion;

To see

it in action, check out

how this works, see the PCF - Single Select page.