Documentation

crm.status.add

Scope: catalog Permissions to execute: for all

crm.status.add(fields)

Create new element in the specified directory.

When adding a stage for custom deal pipeline, pipeline prefix is automatically added to status identifier. This is to determine a pipeline by stage identifier.

Parameters

ParameterDescription
fieldsSet of fields is an array of the array("field"=>"value"[, ...]) type, containing directory field values. (Required)

Attention! Starting from CRM version 20.5.500 there is a length and format limit for STATUS_ID field for specific ENTITY_ID:

  • STATUS (lead status). Max length: 21, can contain only Latin characters, digits, dash and underscore characters.
  • QUOTE_STATUS (invoice status). Max length: 22, can contain only Latin characters, digits, dash and underscore characters.
  • DEAL_STAGE (deal status). Max length: 22, can contain only Latin characters, digits, dash and underscore characters.
  • DEAL_STAGE_xx (deal status in non-default pipelines. xx - pipeline identifier). Max length: 19 if xx less than 10; Max length: 18 if xx less than 100 and etc. Can contain only Latin characters, digits, dash and underscore characters
  • For the rest of ENTITY_ID, maximum length STATUS_ID - 50 characters, containing any symbols.

Example

	BX24.callMethod(
		"crm.status.add", 
		{
			fields:
			{ 
				"ENTITY_ID": "DEAL_STAGE",		
				"STATUS_ID": "DECISION",
				"NAME": "Decision making",
				"SORT": 70
			}
		}, 
		function(result) 
		{
			if(result.error())
				console.error(result.error());
			else
				console.info("Creates a directory element with ID " + result.data());
		}
	);	
BX24.callMethod(
        "crm.status.add", 
        {
           fields:
           { 
               "ENTITY_ID": "DEAL_STAGE_1",        
               "STATUS_ID": "DECISION",
               "NAME": "Decision making",
               "SORT": 70
           }
       }, 
       function(result) 
       {
           if(result.error())
               console.error(result.error());
           else
               console.info("Creates a directory element with ID " + result.data());
       }
   );

In the second example the field STATUS_ID will be saved as С1:DECISION. It indicates that the prefix "C1:" will be added, where 1 - deal pipeline identifier, with directory DEAL_STAGE_1.



© «Bitrix24», 2001-2024
Up