Skip to end of banner
Go to start of banner

Option types

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Power Custom Fields™ offers the following option types:


You can use any option type with any type of the custom field. For more information on custom fields, go to 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 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.

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 all components:

select cname, id from component;

To see it in action, see the PCF - Checkbox page.

Group Picker

An option is rendered as a group.

This is the SIL script to get groups:

return userGroups(currentUsername());

 It gets all groups to which current user belongs. 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 all groups:

select group_name from cwd_group;

To see it in action, check out the PCF - Multi Select page.

Issue Picker

An option is rendered as an issue.

This is the SIL script to get issues: 

return selectIssues("created < now()");

 It gets 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 all issue keys:

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 the PCF - Single Autocomplete page.

Project Picker

An option is rendered as a project.

This is the SIL script to get projects:

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

 It gets all 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 all projects: 

select pkey from project;

To see it in action, check out the PCF - Radio Buttons page.

User Picker

An option is rendered as a user.

This is the SIL script to get users:

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 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 all users:

select user_name from cwd_user;

To see it in action, check out the PCF - Multiple Autocomplete page.

Version Picker

An option is rendered as a version.

This is the SIL script to get versions:

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 all versions existing 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 all versions.

select vname, id from projectversion;

To see it in action, check out the PCF - Single Select page.


  • No labels