task_insert_by_task_code ()

task_insert_by_task_code ()

Function prototype

task_insert_by_task_code ( session, admission, task_code, [date])

API VersionALL

Inserts a task with TASK CODE in an admission in a given date.

If the admission belongs to a TRIAL PROGRAM, then the same TASK CODE may exist either for the 'Control' or 'Intervention' groups. In that case, the function takes into account to which group belongs the ADMISSION to insert the appropriate TASK. If the TASK CODE has not been defined for an specific trial group, then the function will try to find the TASK TEMPLATE that has no trial group assigned

Version:


Input

parameters:

  • session: is the session token obtained in the session_init() call
  • admission: A reference to the ADMISSION where the TASK will be inserted in
  • task_code: code of a TASK TEMPLATE
  • date: (optional) Date to insert the task, if not date is given it will be the current date in the timezone of the active user

Output

parameters:

  • result: a reference to the TASK inserted
  • ErrorMsg: If any error occurs, then this value contains a description of the error translated to the current language
  • ErrorCode: If any error occurs, then this value contains any of the standard ERROR CODES

See below output parameters in API versions prior to 2.7.15

Request

sample:

task_insert_by_task_code( “LC00000000”,“1234”, “SPIRO“, “2012-01-01 00:00:00”)

Response

sample:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<result>1222</result>
<ErrorMsg></ErrorMsg>
<ErrorCode></ErrorCode>

Notes:


Return Error codes

ERROR CODE

INVALID_TOKEN

The session token provided is not valid

INSUFFICIENT_PRIVILEGES

The session user does not have the necessary privileges to create an ADMISSION in the SUBSCRIPTION or the TEAM reference provided is not a member of the SUBSCRIPTION

ADMISSION.NOT_FOUND

The ADMISSION reference provided in parameter admission does not correspond to an existing ADMISSION

TASK.CODE_AMBIGUOUS

The TASK CODE provided in parameter task_code exists in more than one WORKPLAN

TEMPLATE.NOT_PRESENT

The TASK CODE provided in parameter task_code was not found

TASK.NOT_INSERTEDAn unexpected error happened while inserting the TASK

API Versions prior to 2.7.15

In prior versions, the API response for this function only returned the TASK ID with no other format

Response in previous versions
1222

Related content