Project members
Some tooltip text!
• 2 minutes to read
• 2 minutes to read
A project always has a project manager or owner. In addition, it can have (and usually has) project members.
Tip
Read about working with persons.
View project member info
Integer projectMemberId = 9;
NSProjectAgent agent;
NSProjectMember member = agent.GetProjectMember(projectMemberId);
printLine(member.GetFullName());
List project members
NSProjectMember[] GetProjectMembers(Integer projectId)
Integer projectId = 1;
NSProjectAgent agent;
NSProjectMember[] memberList = agent.GetProjectMembers(projectId);
foreach (NSProjectMember m in memberList) {
printLine(m.GetLastname());
}
NSProjectMember[] GetProjectMembersById(Integer[] projectIds)
NSProjectAgent agent;
Integer[] projectIds;
projectIds.pushBack(1);
projectIds.pushBack(3);
projectIds.pushBack(42);
NSProjectMember[] memberList = agent.GetProjectMembersById(projectIds);
Get members from current project
NSProjectAgent agent;
NSProjectEntity p = agent.GetProjectEntity(1);
NSProjectMember[] memberList = p.GetProjectMembers();
Register a member
NSProjectAgent agent;
NSProjectMember member = agent.CreateDefaultProjectMember();
member.SetPersonId(7);
member.SetProjectId(4);
member.SetProjectMemberTypeId(2);
member = agent.SaveProjectMember(member);
printLine(member.GetProjectmemberId().toString());
List available roles
SearchEngine se;
se.addFields("PMembType", "PMembType_id,name");
print(se.executeTextTable());
Add members to project
AddProjectMembers()
will connect 1 or more project members to a project.
NSProjectAgent agent;
NSProjectMember member = agent.GetProjectMember(4);
Integer projectId = 1;
NSProjectMember[] memberList;
memberList.pushBack(member);
agent.AddProjectMembers(projectId, memberList);
Update a member
To update a member, you have to get the member, set the appropriate values, and then call UpdateProjectMember()
.
NSProjectAgent agent;
NSProjectMember member = agent.GetProjectMember(5);
member.SetProjectMemberTypeId(3);
member = agent.UpdateProjectMember(member);
Delete members
Void DeleteProjectMemberByIds(Integer[] projectMemberIds)
NSProjectAgent agent;
Integer[] memberIds;
memberIds.pushBack(5);
memberIds.pushBack(17);
memberIds.pushBack(23);
agent.DeleteProjectMemberByIds(memberIds);
Void DeleteProjectMembers(Integer projectId, Integer[] memberIds)
Removes members from a selected project.
NSProjectAgent agent;
Integer[] memberIds;
memberIds.pushBack(5);
agent.DeleteProjectMembers(8,memberIds);
Reference
NSProjectMember
Field | Get method | Description |
---|---|---|
projectmember_id | GetProjectmemberId() | ID |
project_id | GetProjectId() | project |
mtype_idx | GetProjectMemberTypeId() | role (member type) |
person_id | GetPersonId() | ID of person |
For a complete list of fields, see the database reference.