Documentation

bizproc.activity.add

Scope: catalog Permissions to execute: for all

Description

bizproc.activity.add adds new activity to a workflow.

Each document generates a fields set to be handled. For example, CRM has the Address field, it is designated as UF:address. To use this type of field in your activities, specify a CRM document to be handled (DOCUMENT_TYPE key) and then this type of activities can be described (PROPERTIES key).

Parameters

  • module id =
  • entity (class)
  • document direct type
Examples:
['crm', 'CCrmDocumentLead', 'LEAD']
['lists', 'BizprocDocument', 'iblock_22']
['disk', 'Bitrix\Disk\BizProcDocument', 'STORAGE_490']
['tasks', 'Bitrix\Tasks\Integration\Bizproc\Document\Task', 'TASK_PROJECT_13']
Parameter Description
CODE* Internal activity ID, unique within the application framework.
Permissible symbols are a-z, A-Z, 0-9, period, hyphen and underscore.
HANDLER* URL, to which the activity will send data (via bitrix24 queue server), when workflow has reached its completion.
Shall reference to the same domain, where the app is installed.
AUTH_USER_ID ID of the user, whose token will be passed to the application.
USE_SUBSCRIPTION Use of subscription. Permissible values - Y or N. It is possible to specify, whether the activity should or should not await for a response from the application. If the parameter is empty or not specified - user himself/herself can configure this parameter in settings of the activity in the workflows designer.
NAME* Name of activity. It can be a string or an associative array of localized strings.
DESCRIPTION Description of activity. Can be a string or an associative array of localized strings.
PROPERTIES Array of activity parameters.
RETURN_PROPERTIES Array of returned activity values.

Attention! System name of parameter shall start with a letter and can contain only the following symbols: a-z, A-Z, 0-9 and an underscore.

Each parameter is required to have the following:

  • Name - string or an array of localizations.
  • Description - description of a parameter, string or an array of localizations.
  • Type - type of parameter. List of basic parameters:
    • bool (Yes/No)
    • date (Date)
    • datetime (Date/Time)
    • double (Number)
    • int (Integral number)
    • select (List) array of list values
    • string (String)
    • text (Text)
    • user (User)
  • Options Only for TYPE equal to select.
    [
    'value1' => 'title1',
    'value2' => 'title2',
    'value3' => 'title3',
    'value4' => 'title4',
    ]
  • Required(Y/N) - parameter requirement feature.
  • Multiple(Y/N) - parameter multiply feature.
  • Default - parameter value by default. Parameter type by default - string, optional, singular.
DOCUMENT_TYPE Tip of document, which will determine type of data for parameters.
FILTER Activity limitation rules by document type and revision.
USE_PLACEMENT Enables option to open additional settings for activity in the app slider. Can have Y/N value.

* - required parameters

Example

var params = {
   'CODE': 'md5',
   'HANDLER': 'http://yanzh.net16.net/ping.php',
   'AUTH_USER_ID': 1,
   'USE_SUBSCRIPTION': 'Y',
   'NAME': {
      'en': 'MD5 generator'
   },
   'DESCRIPTION': {
      'en': 'Activity returns MD5 hash of input parameter'
   },
   'PROPERTIES': {
      'inputString': {
         'Name': {
            'en': 'Input string'
         },
         'Description': {
            'en': 'Input string for hashing'
         },
         'Type': 'string',
         'Required': 'Y',
         'Multiple': 'N',
         'Default': '{=Document:NAME}'
      }
   },
   'RETURN_PROPERTIES': {
      'outputString': {
         'Name': {
            'en': 'MD5'
         },
         'Type': 'string',
         'Multiple': 'N',
         'Default': null
      }
   },
   'DOCUMENT_TYPE': ['lists', 'BizprocDocument', 'iblock_1'],
   'FILTER': {
      INCLUDE: [
         ['lists']
      ]
   }
};

BX24.callMethod(
   'bizproc.activity.add',
   params,
   function(result)
   {
      if(result.error())
         alert("Error: " + result.error());
      else
         alert("Success: " + result.data());
   }
);

Example of workflow parameters

select
'docType': {
        'Name': {
         'en': 'Document type'
       },
       'Required': 'Y',
       'Multiple': 'N',
       'Default': 'PDF',
       'Type': 'select',
       'Options': {
         'pdf': 'PDF',
         'docx': 'DOCX'
       }
     }

bool
'saveDoc': {
        'Name': {
            'en': 'Save document'
         },
         'Description': {
            'en': 'Assign a sequential number'
         },
         'Type': 'bool',
         'Required': 'Y',
         'Multiple': 'N',
         'Default': 'Y'
      }

string
'Parameters': {
         'Name': {
            'en': 'Templates parameters'
         },
         'Description': {
            'ru': 'ParamID={=ParamValue}',
            'en': 'ParamID={=ParamValue}'
         },
         'Type': 'string',
         'Required': 'N',
         'Multiple': 'Y'
         
      }

© «Bitrix24», 2001-2024