How can we assign a task to particular identity by programming

Hi, I want to assign a task(i.e Review of Document, which is related to part(Part Document Relationship)) to the some team identity when I saved a Part. How can I achieve this by programming(javascript)? till now, I am able to get the Team ID, and Role and Identity, now I want to create a task for that Role. Thanks in advance, Regards, Maddy.
  • To achieve this, you need to do something like this:
    1. Create Workflow (with start + review + end activities)
    2. Assign it to Part ItemType (don't mark as default)
    3. Create new method (c#) with following code:
      Item itm = this.newItem("Workflow Map", "get"); itm.setAttribute("select", "id"); itm.setProperty("name", "{YOUR_WORKFLOW_NAME}"); itm = itm.apply(); string wf_id = itm.getID(); Item wf_process = this.instantiateWorkflow(wf_id); return wf_process.apply("startWorkflow");
    4. Create new action (server side, with item context) and set your method for this action
    5. Assign you action to Part ItemType
    `