/*data inputs are: index(int), newLinkToken (any type), newTeamLink_cdt (any type), */ load( local!users: todatasubset( rule!ips_getAllActiveUsersForTeam() ), local!roles: todatasubset( rule!ips_getAllRoles() ), local!selectedUserId: tointeger(null), local!expertise: todatasubset( rule!ips_getExpertiseByUserId(local!selectedUserId) ), a!gridRowLayout( id:ri!index, contents: { a!dropdownField( label: "Active Employees", choiceLabels: apply(rule!ips_formatUserName, local!users.data), choiceValues: index( local!users.data, "id", {} ), placeholderLabel: "---Select User---", value: if(rule!APN_isEmpty(ri!newTeamLink_cdt[ri!index]),null,if(rule!APN_isBlank(ri!newTeamLink_cdt[ri!index].userId),null,ri!newTeamLink_cdt[ri!index].userId)), saveInto: { ri!newTeamLink_cdt[ri!index].userId, a!save(local!selectedUserId, null) }, required: true(), readOnly: false() ), a!dropdownField( label: "Employee Role", choiceLabels: local!roles.data.roleName, choiceValues: index( local!roles.data, "id", {} ), placeholderLabel: "---Select User Role---", value: ri!newTeamLink_cdt[ri!index].roleId, saveInto: ri!newTeamLink_cdt[ri!index].roleId, required: true(), readOnly: false() ), a!dropdownField( label: "Area of Expertise", choiceLabels: local!expertise.data.expertise, choiceValues: index( local!expertise.data, "id", {} ), placeholderLabel: "---Assign Area of Expertise---", value: ri!newTeamLink_cdt[ri!index].expertiseId, saveInto: ri!newTeamLink_cdt[ri!index].expertiseId, required: true(), readOnly: false() ), a!linkField( label: "delete " & ri!index, align: "CENTER", links: a!dynamicLink( label: char( 10005 ), value: ri!index, saveInto: { a!save( ri!newTeamLink_cdt, remove( ri!newTeamLink_cdt, save!value ) ), /* * When modifying the size of the array used in a!applyComponents, * make the same change in the "token" array variable*/ a!save( ri!newLinkToken, remove( ri!newLinkToken, save!value ) ) } ) ) } ) )