Example for Create Task API in CRM

This example shows how to create Open task and assign it to Employee.



DECLARE
   l_task_id         NUMBER;
   l_return_status   VARCHAR2 (1);
   l_msg_data        VARCHAR2 (2000);
   l_msg_count       NUMBER;
   l_msg_index_out   NUMBER          := 0;
   l_msg_data1       VARCHAR2 (2000);
BEGIN
   jtf_tasks_pub.create_task (p_api_version               => 1,
                              p_init_msg_list             => fnd_api.g_true,
                              p_commit                    => fnd_api.g_false,
                              p_task_name                 => 'Test Amendment',
                              p_task_type_name            => 'Amendment',
                              p_task_type_id              => 11578,
                              p_task_status_id            => 14,
                              p_owner_type_code           => 'RS_EMPLOYEE',
                              p_owner_id                  => 100000113,
                              p_description               => 'Amendment',
                              p_customer_id               => 122048,
                              p_address_id                => 1444,
                              p_task_status_id            => 10,
                              p_task_status_name          => 'Open',
                              p_task_priority_id          => 7,
                              p_owner_id                  => 100015984,
                              p_owner_type_code           => 'RS_EMPLOYEE',
                              p_attribute12               => 'Y',
                              p_planned_start_date        => SYSDATE,
                              p_planned_end_date          => SYSDATE,
                              p_scheduled_start_date      => SYSDATE,
                              p_scheduled_end_date        => SYSDATE,
                              x_return_status             => l_return_status,
                              x_msg_count                 => l_msg_count,
                              x_msg_data                  => l_msg_data,
                              x_task_id                   => l_task_id
                             );

   IF l_return_status = 'S'
   THEN
      DBMS_OUTPUT.put_line ('Completed successfully');
      DBMS_OUTPUT.put_line ('The Task ID Created is ' || l_task_id);
   ELSIF (l_msg_count > 0)
   THEN
      FOR i IN 1 .. fnd_msg_pub.count_msg
      LOOP
         fnd_msg_pub.get (p_msg_index          => i,
                          p_data               => l_msg_data,
                          p_encoded            => 'F',
                          p_msg_index_out      => l_msg_index_out
                         );
         l_msg_data1 := l_msg_data1 || ' ' || l_msg_data;
         DBMS_OUTPUT.put_line ('Value is' || l_msg_data1);
      END LOOP;

      DBMS_OUTPUT.put_line ('Completed Unsuccessfully');
   END IF;
END;
/

No comments:

Post a Comment

How to find all cancel Requisitions

SELECT prha . *   FROM po_Requisition_headers_all prha , po_action_history pah   WHERE      1 = 1        AND pah . object_id ...