Using custom properties of system objects in object and document scripts
After adding a custom property to a system object or document, you may need to refer it from an object script.
Due to the fact that you cannot work with classes, which implement all the interfaces of an object, in an object script you need to explicitly specify the interface. After changing the system object, the ObjNameConfigExt interface is created. For example, for Company (IContractorLegal) it is IContractorLegalConfigExt.
- The Full Name property was added to the Company object. To use this property, cast the contractor to IContractorLegalConfigExt.
var Contractor = InterfaceActivator.Create<IContractorLegal>();
var ContractorEx = (IContractorLegalConfigExt)Contractor;
In this example, the Contractor variable will include only the standard Company properties, while the ContractorEx will include all the properties, including the custom ones.
2. In the Contract document, the My Companies object is used; a new property Object ID was added to this object. To use this property, cast MyLegalPerson to IMyLegalPersonConfigExt.
var Contract = InterfaceActivator.Create<IContract>();
Contract.MyLegalPerson will contain only standard properties.
After casting MyLegalPerson to IMyLegalPersonConfigExt, you will be able to refer custom properties.