Documentation

bizproc.robot.add

This method registers new automation rule.

Parameters

Parameter Description
CODE Automation rule internal ID.
Permissible symbols are a-z, A-Z, 0-9, period, hyphen and underscore. Required parameter.
HANDLER Application URL, to send data. Required parameter.
AUTH_USER_ID ID of the user, token of which will be passed to the application.
NAME Name of automation rule. Can be a string or an associative array of localized strings. Required parameter.
USE_SUBSCRIPTION Use of subscription. Available values - Y or N. Can contain instruction for automation rule to wait for app response. When parameter is empty or not specified - user can configure this parameter in the workflows designer settings.
PROPERTIES Array of automation rule parameters. List of values is similar to parameters of RETURN_PROPERTIES.
USE_PLACEMENT Enables option to open additional settings for automation rules in the app slider. Can have Y/N values. Optional parameter.
RETURN_PROPERTIES Array of returned automation rule values. The parameter manages an automation rule standby time for an app response and can handle the returned data.

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

Each parameter must contain:

  • Name - string or an array of localizations.
  • Description - parameter description, string or an array of localizations.
  • Type - type of parameter. List of basic types:
    • bool (Yes/No)
    • date (Date)
    • datetime (Date/Time)
    • double (Number)
    • int (Full number)
    • select (List)
    • string (String)
    • text (Text)
    • user (User)
  • Options Only for TYPE equal to select.
    [
    'value1' => 'title1',
    'value2' => 'title2',
    'value3' => 'title3',
    'value4' => 'title4',
    ]
  • Required(Y/N) - required feature of parameter.
  • Multiple(Y/N) - multiple parameter feature.
  • Default - parameter value by default. Type of parameter by default - string, optional, non-multiple.
  • Example

    		var params = {
    			'CODE': 'robot',
    			'HANDLER': 'http:///robot.php',
    			'AUTH_USER_ID': 1,
    			'NAME': 'Example of automation rule',
    			'PROPERTIES': {
    				'bool': {
    					'Name': 'Yes/No',
    					'Type': 'bool',
    					'Required': 'Y',
    					'Multiple': 'N'
    				},
    				'date': {
    					'Name': 'Date',
    					'Type': 'date'
    				},
    				'datetime': {
    					'Name': 'Date/Time',
    					'Type': 'datetime'
    				},
    				'double': {
    					'Name': 'Number',
    					'Type': 'double',
    					'Required': 'Y'
    				},
    				'int': {
    					'Name': 'Integer number',
    					'Type': 'int'
    				},
    				'select': {
    					'Name': 'List',
    					'Type': 'select',
    					'Options': {
    						'one': 'one',
    						'two': 'two'
    					}
    				},
    				'string': {
    					'Name': 'String',
    					'Type': 'string',
    					'Default': 'default string value'
    				},
    				'text': {
    					'Name': 'Text',
    					'Type': 'text'
    				},
    				'user': {
    					'Name': 'User',
    					'Type': 'user'
    				}
    			}
    		};
    
    		BX24.callMethod(
    			'bizproc.robot.add',
    			params,
    			function(result)
    			{
    				if(result.error())
    					alert("Error: " + result.error());
    				else
    					alert("Success: " + result.data());
    			}
    		);
    
    

    © «Bitrix24», 2001-2024