logo

Dynamic forms for business process tasks: selecting linked objects

You frequently need to make it possible to select two linked objects in a process task form, for example, contracts with a certain customer. Let's take a look at how it is done.
 
Variables of two different types are added to the context:
  • Customer object
  • Contract object
In the task form, you include a script that is called when the Customer type variable is modified. The script adds a filter to the Contracts context variable. During the process instance, it will be possible to select only the entries that pass through the filter.
public void contract_choise(Context context, EleWise.ELMA.Model.Views.FormViewBuilder<Context> form)
{
    var settings = (EntitySettings)context.GetSettingsFor(c=>c.Contract);
    settings.FilterQuery = "Contractor = " + context.Customer.Id;
    settings.Save();
}