Documentation

crm.deal.userfield.add

Scope: crm Permissions: for all

crm.deal.userfield.add(fields)

Created new user field for deals.

System limitation for field name - 20 symbols. User field name is supplemented by prefix UF_CRM_, that is the real name length - 13 symbols.

Returns ID that can be identifier by the method crm.deal.userfield.list.

Parameters

Parameter Description
fields Set of fields At the current moment:
ENTITY_ID
USER_TYPE_ID
FIELD_NAME
LIST_FILTER_LABEL
LIST_COLUMN_LABEL
EDIT_FORM_LABEL
ERROR_MESSAGE
HELP_MESSAGE
MULTIPLE
MANDATORY
SHOW_FILTER
SETTINGS
LIST
- array("field"=>"value"[, ...]), containing user field description.

Contains the field LIST with set of values for List custom fields. Indicated when creating/updating a field. Each value is an array with the following fields:

  • VALUE - list item value. Field is required if a new item is created.
  • SORT - sorting.
  • DEF - "Y": sets list item as default value. Multiple field can have several DEF=Y. For non-multiple field, first value is deemed as default.
  • XML_ID - value external code. Parameter is active only when updating already existing list item values.
  • ID - value ID. When specified, the system deems this parameter as an update of existing list item value instead of a newly created one. This parameter is useful when calling the methods *.userfield.update.
  • DEL - when set as Y, deletes existing list item. Applied when ID parameter is available.

Full description of fields can be returned by calling crm.userfield.fields method.

Example #1

	BX24.callMethod(
	"crm.deal.userfield.add", 
	{
		fields: 
		{
			"FIELD_NAME": "MY_STRING",
			"EDIT_FORM_LABEL": "My string",
			"LIST_COLUMN_LABEL": "My string",
			"USER_TYPE_ID": "string",
			"XML_ID": "MY_STRING",
			"SETTINGS": { "DEFAULT_VALUE": "Hello, world!" }
		}
	}, 
	function(result) 
	{
		if(result.error())
			console.error(result.error());
		else
			console.dir(result.data());
	}
);

Example #2

BX24.callMethod(
	"crm.deal.userfield.add", 
	{
		fields: 
		{
			"FIELD_NAME": "MY_LIST",
			"EDIT_FORM_LABEL": "My list",
			"LIST_COLUMN_LABEL": "My list",
			"USER_TYPE_ID": "enumeration",
			"LIST": [ { "VALUE": "Item #1" }, 
                      { "VALUE": "Item #2" }, 
                      { "VALUE": "Item #3" }, 
                      { "VALUE": "Item #4" }, 
                      { "VALUE": "Item #5" } ],
			"XML_ID": "MY_LIST",
			"SETTINGS": { "LIST_HEIGHT": 3 }
		}
	}, 
	function(result) 
	{
		if(result.error())
			console.error(result.error());
		else
			console.dir(result.data());
	}
);	


© «Bitrix24», 2001-2024
Up