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?
You cannot capture this information on the form -- you will need to use a script task to capture.
Here is documentation on the script task: https://docs.appian.com/suite/help/19.2/Configuring_the_Script_Task.html
You will want to configure your functions like today() and loggedInUser() in the outputs section, and save them to a process variable field that can then write the data entries to your data store.
I have used the script method to capture data through the process. However, i also wanted to display these values in the interface. Was wondering if there is a way around it. Maybe i will display them and at the same time use the script to collect&write it to the database.
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 don't exactly agree that this form "cannot" be captured on-form - there might be advantages in some use cases to capturing it in-process as you describe, but there are also advantages to doing it on-form in certain situations; and either way, it is most certainly possible to do so when needed - just that it needs to be done in a particular way that a lot of new users might miss (putting it in saveIntos, etc).
Apologies, maybe I misunderstood. Is the goal not to persist this information to a datastore, but rather to have it displayed while the user completes a form?
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 )
My assumption is that he's wanting to construct a CDT of data including some user-entered data and some automated data (like the user's username) within a SAIL form, pass it back into a process, then write it to a data store. But I'm a bit unsure due to the vagueness of the original post - hence why the next step is really to have the user post more details (sail form code, confirm the process flow, etc).
The idea is to pre-populate these values while user fill rest of the fields and also write these values to the data store to be displayed in the records section once submitted
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.