Здравствуйте, подскажите, пожалуйста, как мне реализовать изменение поля «Статус» зависящее от изменения поля «Результат» (2 справочника, выпадающие списки).
Создала Модуль MyConstants:
define("MyConstants", ["MyConstantsResources"], function(resources) {
	var lead = {
		Result: {
			NewSale: "81f6fc3e-85a9-480e-b9f1-ab105f273c82"
		},
		Stage: {
			NewSale: "8b3e4047-8a5b-4593-8e46-98475aef3db0"
		}
	};
	return {
		Lead: lead
	};
});
В LeadPageV2 (замещающей) прописала:
attributes: {
"UsrStage": {
		dataValueType: Terrasoft.DataValueType.ENUM,
		dependencies: [
			{
				columns: ["UsrResultOfLida"],
				methodName: "ChangedOfResult"
			}
		]
	}
},
methods: {
	ChangedOfResult: function() {
		var res = this.get("UsrResultOfLida");
		if(res.value === MyConstants.Lead.Result.NewSale) {
			this.set("UsrStage", MyConstants.Lead.Stage.NewSale)
		}
	}
},
При изменении значения в поле «Статус» при изменении результата подставляется «undefined». Что я не правильно написала???
Нравится
Виктория, вроде бы все правильно. Уточните, а на странице лида Вы подключили свой модуль?
Его нужно добавить в блок Dependencies, а также в define в коде по такому же принципу, как подключаются константы конфигурации:
define("LeadPageV2", ["BusinessRuleModule", "ConfigurationConstants"],
                function(BusinessRuleModule, ConfigurationConstants) {
…
Если Вы так и сделали, предоставьте, пожалуйста, весь код страницы для анализа.
Да, я его подключила, так как проверка If срабатывает.
define('LeadPageV2', ['LeadPageV2Resources', 'GeneralDetails', 'MyConstants'],
function(resources, GeneralDetails, MyConstants) {
	return {
		entitySchemaName: 'Lead',
		details: /**SCHEMA_DETAILS*/{
	"KnowledgeBase": {
		"schemaName": "KnowledgeBaseDetailV2",
		"entitySchemaName": "KnowledgeBase",
		"filter": {
			"masterColumn": "Id"
		},
		"filterMethod": "test"
	}
}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[
	{
		"operation": "merge",
		"name": "Contact",
		"values": {
			"layout": {
				"column": 0,
				"row": 0,
				"colSpan": 12,
				"rowSpan": 1
			}
		}
	},
	{
		"operation": "merge",
		"name": "Account",
		"values": {
			"layout": {
				"column": 12,
				"row": 0,
				"colSpan": 12,
				"rowSpan": 1
			},
			"caption": {
				"bindTo": "Resources.Strings.AccountCaption"
			},
			"textSize": "Default",
			"contentType": 1,
			"labelConfig": {
				"visible": true
			}
		}
	},
	{
		"operation": "merge",
		"name": "Status",
		"values": {
			"layout": {
				"column": 0,
				"row": 1,
				"colSpan": 12,
				"rowSpan": 1
			}
		}
	},
	{
		"operation": "insert",
		"name": "UsrStage1",
		"values": {
			"layout": {
				"column": 0,
				"row": 2,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "UsrStage",
			"caption": {
				"bindTo": "Resources.Strings.UsrStageCaption"
			},
			"textSize": "Default",
			"contentType": 3,
			"labelConfig": {
				"visible": true
			}
		},
		"parentName": "Header",
		"propertyName": "items",
		"index": 3
	},
	{
		"operation": "insert",
		"name": "UsrBaseAccount",
		"values": {
			"layout": {
				"column": 12,
				"row": 1,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "UsrBaseAccount",
			"caption": {
				"bindTo": "Resources.Strings.BaseAccountCaption"
			},
			"textSize": 0,
			"contentType": 5,
			"labelConfig": {
				"visible": true
			}
		},
		"parentName": "Header",
		"propertyName": "items",
		"index": 4
	},
	{
		"operation": "merge",
		"name": "Commentary",
		"values": {
			"layout": {
				"column": 0,
				"row": 1,
				"colSpan": 24,
				"rowSpan": 2
			},
			"caption": {
				"bindTo": "Resources.Strings.CommentaryCaption"
			},
			"textSize": "Default",
			"labelConfig": {
				"visible": true
			}
		}
	},
	{
		"operation": "insert",
		"name": "UsrActivityKind",
		"values": {
			"layout": {
				"column": 0,
				"row": 0,
				"colSpan": 24,
				"rowSpan": 1
			},
			"bindTo": "UsrActivityKind",
			"caption": {
				"bindTo": "Resources.Strings.UsrActivityKindCaption"
			},
			"textSize": 0,
			"contentType": 5,
			"labelConfig": {
				"visible": true
			}
		},
		"parentName": "LeadPageGeneralBlock",
		"propertyName": "items",
		"index": 1
	},
	{
		"operation": "insert",
		"name": "group",
		"values": {
			"itemType": 15,
			"caption": {
				"bindTo": "Resources.Strings.groupCaption"
			},
			"items": [],
			"controlConfig": {
				"collapsed": false
			}
		},
		"parentName": "GeneralInfoTab",
		"propertyName": "items",
		"index": 1
	},
	{
		"operation": "insert",
		"name": "group_gridLayout",
		"values": {
			"itemType": 0,
			"items": []
		},
		"parentName": "group",
		"propertyName": "items",
		"index": 0
	},
	{
		"operation": "merge",
		"name": "BusinesPhone",
		"values": {
			"layout": {
				"column": 0,
				"row": 0,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "BusinesPhone",
			"caption": {
				"bindTo": "Resources.Strings.BusinesPhoneCaption"
			},
			"textSize": "Default",
			"contentType": 1,
			"labelConfig": {
				"visible": true
			}
		}
	},
	{
		"operation": "move",
		"name": "BusinesPhone",
		"parentName": "group_gridLayout",
		"propertyName": "items",
		"index": 0
	},
	{
		"operation": "merge",
		"name": "Email",
		"values": {
			"layout": {
				"column": 0,
				"row": 1,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "Email",
			"caption": {
				"bindTo": "Resources.Strings.EmailCaption"
			}
		}
	},
	{
		"operation": "move",
		"name": "Email",
		"parentName": "group_gridLayout",
		"propertyName": "items",
		"index": 1
	},
	{
		"operation": "merge",
		"name": "Region",
		"values": {
			"layout": {
				"column": 0,
				"row": 2,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "Region",
			"caption": {
				"bindTo": "Resources.Strings.RegionCaption"
			},
			"textSize": "Default",
			"contentType": 5,
			"labelConfig": {
				"visible": true
			}
		}
	},
	{
		"operation": "move",
		"name": "Region",
		"parentName": "group_gridLayout",
		"propertyName": "items",
		"index": 2
	},
	{
		"operation": "merge",
		"name": "InformationSource",
		"values": {
			"layout": {
				"column": 0,
				"row": 3,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "InformationSource",
			"caption": {
				"bindTo": "Resources.Strings.InformationSourceCaption"
			}
		}
	},
	{
		"operation": "move",
		"name": "InformationSource",
		"parentName": "group_gridLayout",
		"propertyName": "items",
		"index": 3
	},
	{
		"operation": "remove",
		"name": "InformationSource",
		"properties": [
			"contentType"
		]
	},
	{
		"operation": "insert",
		"name": "group1",
		"values": {
			"itemType": 15,
			"caption": {
				"bindTo": "Resources.Strings.group1Caption"
			},
			"items": [],
			"controlConfig": {
				"collapsed": false
			}
		},
		"parentName": "GeneralInfoTab",
		"propertyName": "items",
		"index": 2
	},
	{
		"operation": "insert",
		"name": "group1_gridLayout",
		"values": {
			"itemType": 0,
			"items": []
		},
		"parentName": "group1",
		"propertyName": "items",
		"index": 0
	},
	{
		"operation": "insert",
		"name": "UsrOwner",
		"values": {
			"layout": {
				"column": 0,
				"row": 2,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "UsrOwner",
			"caption": {
				"bindTo": "Resources.Strings.OwnerCaption"
			},
			"textSize": 0,
			"contentType": 5,
			"labelConfig": {
				"visible": true
			}
		},
		"parentName": "group1_gridLayout",
		"propertyName": "items",
		"index": 0
	},
	{
		"operation": "insert",
		"name": "UsrOwnerPhone",
		"values": {
			"layout": {
				"column": 0,
				"row": 3,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "UsrOwnerPhone",
			"caption": {
				"bindTo": "Resources.Strings.OwnerPhoneCaption"
			},
			"textSize": 0,
			"contentType": 1,
			"labelConfig": {
				"visible": true
			}
		},
		"parentName": "group1_gridLayout",
		"propertyName": "items",
		"index": 1
	},
	{
		"operation": "insert",
		"name": "UsrKCOwner",
		"values": {
			"layout": {
				"column": 0,
				"row": 4,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "UsrKCOwner",
			"caption": {
				"bindTo": "Resources.Strings.KCOwnerCaption"
			},
			"textSize": 0,
			"contentType": 5,
			"labelConfig": {
				"visible": true
			}
		},
		"parentName": "group1_gridLayout",
		"propertyName": "items",
		"index": 2
	},
	{
		"operation": "insert",
		"name": "UsrUrgencyRequest",
		"values": {
			"layout": {
				"column": 0,
				"row": 0,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "UsrUrgencyRequest",
			"caption": {
				"bindTo": "Resources.Strings.UrgencyRequestCaption"
			},
			"textSize": 0,
			"contentType": 3,
			"labelConfig": {
				"visible": true
			}
		},
		"parentName": "group1_gridLayout",
		"propertyName": "items",
		"index": 3
	},
	{
		"operation": "insert",
		"name": "UsrResultOfLida",
		"values": {
			"layout": {
				"column": 0,
				"row": 1,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "UsrResultOfLida",
			"caption": {
				"bindTo": "Resources.Strings.ResultOfLidaCaption"
			},
			"textSize": 0,
			"contentType": 3,
			"labelConfig": {
				"visible": true
			}
		},
		"parentName": "group1_gridLayout",
		"propertyName": "items",
		"index": 4
	},
	{
		"operation": "insert",
		"name": "group2",
		"values": {
			"itemType": 15,
			"caption": {
				"bindTo": "Resources.Strings.group2Caption"
			},
			"items": [],
			"controlConfig": {
				"collapsed": false
			}
		},
		"parentName": "GeneralInfoTab",
		"propertyName": "items",
		"index": 3
	},
	{
		"operation": "insert",
		"name": "group2_gridLayout",
		"values": {
			"itemType": 0,
			"items": []
		},
		"parentName": "group2",
		"propertyName": "items",
		"index": 0
	},
	{
		"operation": "insert",
		"name": "UsrDateTimeFilling",
		"values": {
			"layout": {
				"column": 0,
				"row": 0,
				"colSpan": 12,
				"rowSpan": 1
			},
			"bindTo": "UsrDateTimeFilling",
			"caption": {
				"bindTo": "Resources.Strings.DateTimeFillingCaption"
			},
			"textSize": 0,
			"labelConfig": {
				"visible": true
			}
		},
		"parentName": "group2_gridLayout",
		"propertyName": "items",
		"index": 0
	},
	{
		"operation": "insert",
		"name": "LeadPageV24Tab",
		"values": {
			"items": [],
			"caption": {
				"bindTo": "Resources.Strings.LeadPageV24TabCaption"
			}
		},
		"parentName": "Tabs",
		"propertyName": "tabs",
		"index": 1
	},
	{
		"operation": "insert",
		"name": "LeadPageV25Tab",
		"values": {
			"items": [],
			"caption": {
				"bindTo": "Resources.Strings.LeadPageV25TabCaption"
			}
		},
		"parentName": "Tabs",
		"propertyName": "tabs",
		"index": 3
	},
	{
		"operation": "insert",
		"name": "LeadPageV25TabContainer",
		"values": {
			"itemType": 7,
			"items": []
		},
		"parentName": "LeadPageV25Tab",
		"propertyName": "items",
		"index": 0
	},
	{
		"operation": "insert",
		"name": "KnowledgeBase",
		"values": {
			"itemType": 2
		},
		"parentName": "LeadPageV25TabContainer",
		"propertyName": "items",
		"index": 0
	},
	{
		"operation": "remove",
		"name": "Title"
	},
	{
		"operation": "remove",
		"name": "FullJobTitle"
	},
	{
		"operation": "remove",
		"name": "LeadPageCategorizationContainer"
	},
	{
		"operation": "remove",
		"name": "LeadPageCategorizationBlock"
	},
	{
		"operation": "remove",
		"name": "Campaign"
	},
	{
		"operation": "remove",
		"name": "Industry"
	},
	{
		"operation": "remove",
		"name": "AnnualRevenue"
	},
	{
		"operation": "remove",
		"name": "EmployeesNumber"
	},
	{
		"operation": "remove",
		"name": "LeadPageCommunicationContainer"
	},
	{
		"operation": "remove",
		"name": "LeadPageCommunicationBlock"
	},
	{
		"operation": "remove",
		"name": "DoNotUsePhone"
	},
	{
		"operation": "remove",
		"name": "MobilePhone"
	},
	{
		"operation": "remove",
		"name": "DoNotUseSMS"
	},
	{
		"operation": "remove",
		"name": "Fax"
	},
	{
		"operation": "remove",
		"name": "DoNotUseFax"
	},
	{
		"operation": "remove",
		"name": "DoNotUseEmail"
	},
	{
		"operation": "remove",
		"name": "Website"
	},
	{
		"operation": "remove",
		"name": "LeadPageAddressContainer"
	},
	{
		"operation": "remove",
		"name": "LeadPageAddressBlock"
	},
	{
		"operation": "remove",
		"name": "AddressType"
	},
	{
		"operation": "remove",
		"name": "Country"
	},
	{
		"operation": "remove",
		"name": "City"
	},
	{
		"operation": "remove",
		"name": "Zip"
	},
	{
		"operation": "remove",
		"name": "Address"
	},
	{
		"operation": "remove",
		"name": "HistoryTab"
	},
	{
		"operation": "remove",
		"name": "LeadHistoryTabContainer"
	},
	{
		"operation": "remove",
		"name": "LeadHistoryTabBlock"
	},
	{
		"operation": "remove",
		"name": "Activities"
	},
	{
		"operation": "move",
		"name": "ESNTab",
		"parentName": "Tabs",
		"propertyName": "tabs",
		"index": 4
	}
]/**SCHEMA_DIFF*/,
		attributes: {
			"UsrStage": {
				dataValueType: Terrasoft.DataValueType.ENUM,
				dependencies: [
					{
						columns: ["UsrResultOfLida"],
						methodName: "ChangedOfResult"
					}
				]
			}
		},
		methods: {
			save: function() {
				var account = this.get("Account");
				var contact = this.get("Contact");
				if(!account) {
					var x = "Заказчик " + contact;
					this.set("Account", x);
				}
				this.callParent(arguments);
			},
			ChangedOfResult: function() {
				var res = this.get("UsrResultOfLida");
				if(res.value === MyConstants.Lead.Result.NewSale) {
					this.set("UsrStage", MyConstants.Lead.Stage.NewSale)
				}
			},
			test: function() {
				var filterGroup = new this.Terrasoft.createFilterGroup();
				filterGroup.logicalOperation = Terrasoft.LogicalOperatorType.OR;
				filterGroup.add("testFilter", this.Terrasoft.createColumnFilterWithParameter(
					this.Terrasoft.ComparisonType.NOTEQUAL, "Id", null));
				return filterGroup;
			},
		},
		rules: {},
		userCode: {}
	};
});
Виктория, понял в чем проблема.
В Вашем модуле константы справочного типа должны содержать в себе не только Id, но объект вида:
{ displayValue: resources.localizableStrings.Name, value: "a93ab0b9-ca36-4b95-9b23-e01aa169c338" }