Friday, January 25, 2019

Creating Project Tasks with pa_project_pub - Issue when parent task created in form vs. create with API

The Oracle Projects public APIs pa_project_pub.create_project and pa_project_pub.update_project have the ability to, among other things, load multiple tasks in a single API call, including tasks with parent-child relationships.  For example, you can create 10 tasks, each with 5 sub-tasks, and those sub-tasks might have 3 sub-sub-tasks, etc.  When loading multiple tasks in a single API call, the 'task_id' of the tasks are not yet generated, so in order to allow the creation of parent-child relationships, the projects API has a mandatory parameter called 'pm_task_reference'.  When you want to create a task as the child of another task, you can pass the pm_task_reference of the parent into a second parameter called 'pm_PARENT_task_reference' for the child.  This works well.

However, when a task is entered through the forms, the pm_task_reference is not populated, so you cannot use that value in the pm_PARENT_task_reference parameter to create a child using the API.  In this case, you must use the another parameter, 'pa_PARENT_task_id', which is the task_id of the parent task.  In this case, since the parent task has previously been created; the task_id exists and can be used.  

As it turns out, the task_id (passed to the pa_PARENT_task_id parameter) can be used for both parent tasks created through the API and for parent tasks created through the forms as long as the parent task already exist.  So if you are adding sub-tasks to existing tasks, you should use the pa_PARENT_task_id.

This is explained in the Oracle Note: PA_PROJECT_PUB.Add_task Errors - Parent Tasks Must Be Specified Before The Child Task (Doc ID 1108470.1)

As an FYI, tasks can also be created and updated using the create_task, add_task, load_task, update_task, delete_task procedures - these use scalar parameters rather than the table-types used in create_project and update_project.  

1 comment:

  1. The blog is informative and I understood that pa_PARENT_task_id is a better option to use than pm_PARENT_task_reference when you are creating a sub task because pm_PARENT_task_reference is not populated when a task is created through oracle forms.

    ReplyDelete

Please add your feedback, experience, or questions!

Popular Posts

Total Pageviews