Link between the contractor and company objects

This article describes how you can access the attributes of the Company object if a process uses a Contractor object.

Contractor and Company are linked by ID. An example of a script for getting the KPP is below.

Script with PublicAPI


Note
Documentation on PublicAPI is available here
Attention
The script below is relevant for ELMA up to 3.12.1 inclusive.

Context variables:

context.Contractor - variable of the Contractor type
context.KPP - variable of the String type

Namespace:

using EleWise.ELMA.API;

Script:

var cl = PublicAPI.CRM.Contractor.ContractorLegal.LoadOrNull(context.Contractor.Id);
if (cl != null){
            context.KPP = cl.KPP;
};

Script without PublicAPI

The script includes the following context variables:

context.Client - variable of the Contractor type
context.KPP - variable of the String type

For the script to work, add the following assembly:

Elewise.ELMA.CRM

Namespaces:

using EleWise.ELMA.CRM.Models;
Script:
if (context.Client is ContractorLegal)  
{  
        var cl = context.Client as ContractorLegal; 
        context.KPP=cl.KPP;
}