I have a form with various fields enabled for users inputs. Values for two of the fields, submitted on and submitted by, are disabled for users and will be captured through functions. Functions i am using are today() and loggedInUser(). These work at the interface level ans show current date and users name every time the form is displayed. However, the values are not stored/written to the database after submission. They do not display in the records view either.
I have configured the appropriate data type in the save input to parameter as well. How can i fix this?
Please share a sample of your code - preferably your whole form if it's not super large, or at least the relevant parts of it. I'd be happy to help but without seeing what you're trying to do and how, it'd just be guesswork.
p.s. please use the "insert -> code" functionality to make a nice clean code box like this :)
i have tried two methods:
a!dateField( label: "Submitted On", labelPosition: if( ri!readOnly, "ADJACENT", "ABOVE" ), value: today(), saveInto: ri!RSR_IAI_IntakeAssessment.submittedOn, readOnly: ri!readOnly, disabled: true )
a!dateField( label: "Submitted On", labelPosition: if( ri!readOnly, "ADJACENT", "ABOVE" ), value: today(), saveInto: a!save( ri!RSR_IAI_IntakeAssessment.submittedOn, today() ), readOnly: ri!readOnly, disabled: true )
So.. the "saveInto" parameter for any field only executes when the user interacts with that field. Therefore any saveIntos in a Disabled field will do nothing. (note: if you still want to use the disable fields to display the values, that's fine.)
If you have CDT fields that you want populated without associating with an interactive user component, you would need to save into them manually elsewhere. My default suggestion would be to do these in your Submit button (this is why I usually ask to see the whole form code if possible).
For example, clicking the following button will capture "submittedOn" and "submittedBy" (or whatever the CDT field name is) at the time of submission.
The form is too big to share. I will try passing these parameters in the submit button section as shown in your example.
On contrary, can i also use a script node to collect these values before writing them to the database in the process?
No worries if the form is too big - though sometimes it helps to come up with a smaller / example version of a form with similar requirements where the whole form can be posted here, it just helps in allowing other users to look into what the issue might be more quickly without as much guesswork. But I think we got to the bottom of your issue anyway.
Per your second question: yes, it's also possible to do the data collection in-process. In old versions of Appian it was required, but SAIL forms give us a bit more flexibility. I believe both ways are acceptable, and which one to use depends on the particulars of different implementations. That being said, I find that when possible, it's far easier to manage data like this on the SAIL form and do minimal extra processing in the process flow - it's easier to troubleshoot, test, fix, etc. But it will be worthwhile for you to experiment and learn both ways.
Thank you Mike. Passing the values in the SAIL form worked. Appreciate your help.
Discussion posts and replies are publicly visible
© 2020 Appian. All rights reserved.