Feature request: allow scripts in field injections

Hi friends,

I kindly suggest a new feature: allow using scripts in field injections. Currently it allows literal values and expressions. I don’t want to use Input Parameters, as they pollute history with unnecessary transient data.


Motivation

I have a SendTask -> DelegateExpression -> ${camundaMailer}

CamundaMailer implementation:

public class CamundaMailerDelegate implements JavaDelegate {

    @Autowired
    private JavaMailSender sender;

    @Override
    public void execute(DelegateExecution delegateExecution) throws Exception {
        MimeMessage message = sender.createMimeMessage();
        MimeMessageHelper helper = new MimeMessageHelper(message);
        helper.setTo(String.valueOf(delegateExecution.getVariable("to")));
        helper.setText(String.valueOf(delegateExecution.getVariable("html")), true);
        helper.setSubject(String.valueOf(delegateExecution.getVariable("subject")));

        sender.send(message);
    }
}

When html variable exceeds 4000 characters History logger fails with exception:

org.h2.jdbc.JdbcSQLException: Value too long for column "TEXT_ VARCHAR(4000)": "STRINGDECODE('<!DOCTYPE html>....";
insert into ACT_HI_VARINST ( ... )

Possible workarounds

  1. I can alter table act_hi_varinst alter text_ type text on Postgresql and use Input Parameters, pros: this is fine, because varchar(4000) is not ok anyway, cons: history pollution with non-essential data.
  2. I can agree on some variable name prefix, e.g. transient..., so that transientHtml is not saved to history with a custom HistoryLevel, pros: relatively simple solution, cons: technical debt.

You can use Map object (containing all email info) and pass it as input variable to delegate Or change object type to https://docs.camunda.org/javadoc/camunda-bpm-platform/7.3/?org/camunda/bpm/engine/impl/util/json/JSONObject.html