Skip to main content
March 5, 2022
Solved

Set Default values on CDT fields in form submit button

  • March 5, 2022
  • 7 replies
  • 0 views

Hello,

I have a table which have 5 fields. I am showing 3 non null fields on UI as user input and storing them in the record input of CDT type to that table.

The other 2 fields (UserloggedIn and Unique Identification Number), I want to set it as default value to those record input fields on submit button but it is now working. I don't want to show this field in UI and allow modifcation by User.

Placing my code below. Please suggest what is the mistake here or how to achieve it. Thank you.

Interface:

Code:

load(
local!reportedBy: loggedInUser(),
local!uin:"TEST000000000005",
a!formLayout(
label: "Kk Testing Kk",
contents: {
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!textField(
label: "Tstclientname",
labelPosition: "ABOVE",
value: ri!record.tstclientname,
saveInto: ri!record.tstclientname,
characterLimit: 55
),
a!dateField(
label: "Tstmasterdate",
labelPosition: "ABOVE",
value: date(2022, 03, 06),
saveInto: ri!record.tstmasterdate
)
}
),
a!columnLayout(
contents: {
a!dropdownField(
label: "Project Type",
labelPosition: "ABOVE",
placeholder: "--Select type--",
choiceLabels: {"New", "Existing"},
choiceValues: {"New", "Existing"},
value: ri!record.tstproducttype,
saveInto: ri!record.tstproducttype
)
}
)
}
)
},
buttons: a!buttonLayout(
primaryButtons: {
a!buttonWidget(
label: "Submit",
saveInto: {
a!save(ri!record.uin, local!uin),
a!save(ri!record.tstaddedby, local!reportedBy)
},
submit: true,
style: "PRIMARY"
)
},
secondaryButtons: {
a!buttonWidget(
label: "Cancel",
value: true,
saveInto: ri!cancel,
submit: true,
style: "NORMAL",
validate: false
)
}
)
)
)

Error:

Best answer by andrewh0007

I can see that in the ri!record input that the field value appears to be "tstuin" and not just "uin". So when trying to save into ri!record.uin the error message is telling you that the field you have specified doesn't exist.

7 replies

March 5, 2022

The same is working if I place those 2 fields on UI and input them manually.

andrewh0007
March 6, 2022

I can see that in the ri!record input that the field value appears to be "tstuin" and not just "uin". So when trying to save into ri!record.uin the error message is telling you that the field you have specified doesn't exist.

March 6, 2022

Hi ajhick,

Yes, you are right my field name is tsuin where as I was using a wrong name uin which don't exist. I referring ri!record.uin instead of ri!record.tstuin. After correcting it worked.

Thanks a lot.

March 6, 2022

Hi,

Error states some type conversation problem. Your local!uin is of type Text, Can you check what is the data type of your ri!record.uin? 

andrewh0007
March 6, 2022

No, it's not a conversion problem. It's an indexing problem.

stefanhelzle0001
Brainy
March 6, 2022

Besides the indexing issue, a few hints for improvements:

- use a!localVariables() instead of load()

- use keyword syntax: https://docs.appian.com/suite/help/22.1/Expressions.html#by-keyword