Configuring a filter for an Object type variable

When designing business processes you often need to limit the range of displayed values of variables of an object type. For example, if you add a Contact type variable to a task context, all the contacts from the database will be shown in the drop-down list. If you want to only show the contacts that belong to a specific contractor, you can use a special filter.

Let's say we have two variables in a process: Contractor and Contact. When a contractor is selected, you want only the selected contractor's contacts to be displayed. Add a script to the task's context settings for changing the Contractor variable ( https://www.elma-bpm.ru/kb/help/ProcessWebHelp/scr/Designer/Task_form_dynamic/index.html ). The script will look as shown below:

var contactSettings = (EntitySettings)context.GetSettingsFor(c => c.Cobtact);
contactSettings.FilterQuery = context.Contractor!= null ? "Contractor=" + context.Contractor.Id : "Id > 0";

If no contractor is selected in the task form, the list of contacts will be full.

If the contractor is selected, then the list will be shown according to the filer.