I have a regular component on a form - let’s say it’s a birth date.
This form is a manual task in a process.
By default, when a user opens this form, I want this component to be already filled with a date from a previous form (from a different manual task).
However, if such date is not present (was not entered on a previous form) I need the system to calculate the birth date from PESEL.
Only when both values are empty (the date from the previous form and the PESEL value) I want the user to fill the date manually.
So what I eventually need is a cascade:
- if present, use the previously entered birth date
- else, if PESEL is present, calculate birth date from PESEL
- if both are empty, let the user fill the date manually.
What is the recommended approach to this problem?
I recommend using technical fields in such cases.
I assume you have two fields: date of birth and PESEL, and the date from the previous request will come as an input parameter to the form and will be mapped to a session variable.
So, first of all, I would add a technical field with a script attached that calculates the date of birth from the PESEL as timestamp.
Then I would create a technical field that will map the first non-empty value from the list: date of birth from previous form and date of birth from PESEL.
Finally, I would map the technical field mentioned above to the date component via “Źródło danych z innego pola” and set an active condition to check if the technical field is empty.
Remember to add listening where required
Below is an example application with the described solution containing the necessary scripts:
example.artifact (40.8 KB)
But… do I have to do it manually for all 200 fields?
Maybe you could come up with some kind of automation, or a ScriptCode ?
Damn you’re right!
They overlap, in a way, but yes.
Thanks for your answer.