Skip to main content
Inspiring
February 15, 2024
Question

User Defined Calculated Field

  • February 15, 2024
  • 1 reply
  • 693 views

Is there a script to allow the user to enter a value if the user updates the value? When the user puts a custom value in Text 1-22 the custom calculation script overwrites what the user puts in.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
February 15, 2024

It's possible, but you need to think carefully about how it should work. Say field C has a calculation of A+B.

The user manually changes field C at some point, which we allow them to do. But then they change the value of A.

Should field C update automatically now, or should it keep the value the user entered for good?

Badhawg66Author
Inspiring
February 16, 2024

Field C (Text 23) already calculates all of the fields but  I want the value of field C to update automatically if the value of field A or B (Text 1-22) is changed. I want an option for the user to change the value of A and B instead of using a suggested value. The value the user enters should stay until either checkbox is changed. If the checkbox is changed it will go back to the suggested value.

try67
Community Expert
Community Expert
February 16, 2024

Sorry, I don't follow what check-boxes you're referring to. But if you want the value to update when the fields used for the calculation are edited then you can use something like this:

 

var sourceFields = ["FieldA", "FieldB"]; // Fill this array with the names of the fields this field depends on 
if (event.source!=null && sourceFields.indexOf(event.source.name)!=-1) {
	// put the rest of the calculation script here
}