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 10 Current »

We've encountered an issue exporting this macro. Please try exporting this page again later.

Power Custom Fields offers the following option types:

You can use any option type with any custom field type. For more information on custom fields, 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 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 that returns all components:

select cname, id from component;

To see how this works, see the PCF - Checkbox page.

Group Picker

An option is rendered as a group.

This is the SIL script that returns groups:

return userGroups(currentUsername());

It returns all groups 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 that returns all groups:

select group_name from cwd_group;

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

Issue Picker

An option is rendered as an issue.

This is the SIL script that returns issues: 

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

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 that returns 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 how this works, see the PCF - Single Autocomplete page.

Project Picker

An option is rendered as a project.

This is the SIL script that returns projects:

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

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

This is the SQL script that returns all projects: 

select pkey from project;

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

User Picker

An option is rendered as a user.

This is the SIL script that returns 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 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 return all users:

select user_name from cwd_user;

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

Version Picker

An option is rendered as a version.

This is the SIL script that returns 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 returns all versions 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 return all versions.

select vname, id from projectversion;

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


  • No labels