Print this page Skills - How do I assign a skill via Apex?

Knowledge Article Number 000227253
Description How do I assign a skill via Apex?
Resolution Skill data is stored in the ProfileSkill object.  When a user is assigned a skill a ProfileSkillUser record is created.  ProfileSkillUser is a junction object with a reference to a ProfileSkill and a User.  To assign a skill to a user you just need to create the one record:
ProfileSkillUser userSkill = new ProfileSkillUser(ProfileSkillId = '0Ski00000004CPZ', UserId = '005i0000001CHco');
insert userSkill;

Note that assigning a skill to a user will not endorse them.  It just makes the skill available on their profile for others to endorse.  If you would also like to endorse the skill after assigning it take a look at this article: How do I endorse a skill via Apex?

You can learn more about the skill objects and their fields from the SOAP API Developer Guide:


promote demote