Skip to main content

Does LeanIX support setting the value of a custom field from within a calculation?

I’ve a routine that calculates data sensitivity correctly and is working but would now like to record when the last sensitivity calculation ran.

My code is:

// Set the date that this calculation was performed
data.DataSensitivityDateUpdated = Date();

Where DataSensitivityDateUpdated is the custom field and Date() is presumed to return the current date.

The Calculation runs without error, but the custom DataSensitivityDateUpdated field is not updated.

Is the return statement the only way for a Calculation to update a field?

Hi ​@Postie Mike 

There are several problems with this approach:

  1. A calculation can only update one single field, and the value is set using “return”
  2. Even if you created a second calculation for the “date” field, you would have to find a way how to run both calculations at once.

Possible solutions are:

  • Making both calculations depend on a trigger field by referencing the trigger in the code but not using it in the actual calculation
  • Combining it with an Automation: If the DataSensitivity field is updated, set the trigger field for the date calculation, and reset it again immediately afterwards so that it can be triggered again
  • To simplify the logic, you can also use our Aronis Automation Platform, which does not have any restrictions regarding triggers and number of fields to update in one single call.

Thanks ​@Thomas Schreiner, appreciate the suggestions I’m exploring chaining the calculations to see if that works. Hopefully, LeanIX will quickly develop their Calculation capability - and the documentation - because it is simplistic currently.


Reply