Hi Zala,
hope you and your loved ones are well too.
I suppose you have implemented some JS already to automatically update the
Harvest Duration on change of the Plant type (or jsetzes AGHelper).
So, since fiddling with JS (which is not my area usually, but I want to make a suggestion anyways), why not grab the value from the start date field (start_date?) and simply add the
Harvest Duration to that?
Probably some workflow like this
On change of
Harvest Duration (which equals change of product in your application)
a) Get new value from
harvest duration something like
Code: Select all
document.querySelector("#harvest_duration").value
b) write this to variable maybe
harvestduration
c) get day from start date
Code: Select all
document.querySelector("#start_date-dd").value
d) get month from start date
Code: Select all
document.querySelector("#start_date-mm").value
e) get year from start date
Code: Select all
document.querySelector("#start_date").value
f) build date from these three
g) use moments.js which is already loaded to calculate new date
h) split values
i) write new est
harvest date day, month, year
Again: JS is not my primary (nor secondary) world, so maybe someone with more knowledge in this area is able to do a JS-oneliner.
Maybe see the AppGini Helper from jsetzer, who also has a page how to react on lookup changes (which I did not find right now).
Olaf