Team Members Examples
The [project_team] table doesn't currently have a primary key. Once implemented this will enable the other API operations.
Inserting a Team Member requires the following properties:
- projectId
- userId
- userLevel -- the role in which the user plays in the project
Additionally, the typical enteredBy and modifiedBy must be passed.
Project Roles
Since the beginning of Team Elements, the roles have been:
- (1) Project Lead
- (2) Contributor
- (3) Observer
- (4) Guest
Internally in the application, the "level" field of the [lookup_project_role] table is used for inserting a project team member. When using the API, the "code" of [lookup_project_role] must be queried by "level" to ensure the team member has a proper userLevel. This is intended for future project roles.
See Lookup List Examples for retrieving a list of roles. In the meantime use 1,2,3 and 4 for the userLevel.
Inserting a Team Member at the same time as a Project
During the same transaction that a project is inserted, the projectId can be dynamically added as $C
DataRecord record = new DataRecord(); record.setName("teamMember"); record.setAction(DataRecord.INSERT); record.addField("projectId", "$C{project.id}"); record.addField("userId", 1); record.addField("userLevel", 1); record.addField("enteredBy", 1); record.addField("modifiedBy", 1); api.save(record);
Selecting Team Member Data
ArrayList<String> meta = new ArrayList<String>(); meta.add("id"); api.setTransactionMeta(meta); DataRecord record = new DataRecord(); record.setName("teamMemberList"); record.setAction(DataRecord.SELECT); record.addField("projectId", 1); record.addField("userId", 1); api.save(record); int teamMemberId = Integer.parseInt(api.getResponseValue("id"));
Deleting a Team Member
DataRecord record = new DataRecord(); record.setName("teamMember"); record.setAction(DataRecord.DELETE); record.addField("id", teamMemberId); api.save(record);
Sign in to add your comment.