Hi all , can anyone help me with the below requirement please.
I have a address cdt . In the interface below ( attached screenshot ) i have two section temporary and permanent address.
So there is a check box also in the interface .
My requirement is : if the check box is not selected both the temporary address and permanent address should be saved and if its selected both the address should be saved. But it should be saved in the same CDT
So can anyone help me on how to solve this.
a!localVariables( local!temporaryAddress:'type!{urn:com:appian:types:KYC}KYC_addressDetails'(), local!permanentAddress:'type!{urn:com:appian:types:KYC}KYC_addressDetails'(), a!formLayout( label: "Customer Address Details", contents: { a!sectionLayout( label: "Temporary Address", contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Address Line1", labelPosition: if( ri!button_txt, "ADJACENT", "ABOVE" ), placeholder: "Enter Your Address Line1", value: ri!temporaryAddress.line1, saveInto: ri!temporaryAddress.line1, characterLimit: 255 /* validations: if(regexmatch("^[a-zA-Z ]*$",ri!KYC_addressDetails.line1),null,"Enter only text")*/ ) } ), a!columnLayout( contents: { a!textField( label: "Address Line2", labelPosition: if( ri!button_txt, "ADJACENT", "ABOVE" ), placeholder: "Enter Your Address Line2", value:ri!temporaryAddress.line2, saveInto: ri!temporaryAddress.line2, characterLimit: 255 /*readOnly: ri!button_txt*/, required: true /*validations: if(regexmatch("^[a-zA-Z ]*$",ri!KYC_addressDetails.line2),null,"Enter only text")*/ ) } ) } ), a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "City", labelPosition: if( ri!button_txt, "ADJACENT", "ABOVE" ), placeholder: "Enter Your City", value:ri!temporaryAddress.city, saveInto: ri!temporaryAddress.city, characterLimit: 255 /*readOnly: ri!button_txt*/, required: true /*validations: if(regexmatch("^[a-zA-Z ]*$",ri!KYC_addressDetails.city),null,"Enter only text")*/ ) } ), a!columnLayout( contents: { a!textField( label: "State", labelPosition: if( ri!button_txt, "ADJACENT", "ABOVE" ), placeholder: "Enter Your State", value: ri!temporaryAddress.state, saveInto: ri!temporaryAddress.state, characterLimit: 255 /*readOnly: ri!button_txt*/, required: true /*validations: if(regexmatch("^[a-zA-Z ]*$",ri!KYC_addressDetails.state),null,"Enter only text")*/ ) } ) } ) }, isCollapsible: true ), a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Country", labelPosition: if( ri!button_txt, "ADJACENT", "ABOVE" ), placeholder: "Enter Your Country", value: ri!temporaryAddress.country, saveInto:ri!temporaryAddress.country, characterLimit: 255 /*readOnly: ri!button_txt*/, required: true /*validations: if(regexmatch("^[a-zA-Z ]*$",ri!KYC_addressDetails.country),null,"Enter only text")*/ ) } ), a!columnLayout( contents: { a!integerField( label: "Zip Code", labelPosition: if( ri!button_txt, "ADJACENT", "ABOVE" ), placeholder: "Enter Your Zip Code", value: ri!temporaryAddress.zipCode, saveInto:ri!temporaryAddress.zipCode /*readOnly: ri!button_txt*/, required: true ) } ) } ), a!checkboxField( label: "", labelPosition: "ABOVE", choiceLabels: {"Temporary Address is the Permanent Address"}, choiceValues: {true}, saveInto: a!save( ri!permanentAddress, ri!temporaryAddress ), validations: {} ), a!sectionLayout( label: "Permanent ", contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Address Line1", labelPosition: "ABOVE", placeholder: "Enter Your Permanent Address Line1", value: ri!permanentAddress.line1, saveInto: ri!permanentAddress.line1, refreshAfter: "UNFOCUS" /*validations: if(regexmatch("^[a-zA-Z ]*$",ri!permanentAddress.line1),null,"Enter only text")*/ ) } ), a!columnLayout( contents: { a!textField( label: "Address Line2", labelPosition: "ABOVE", placeholder: "Enter Your Permanent Address Line2", value: ri!permanentAddress.line2, saveInto: ri!permanentAddress.line2, refreshAfter: "UNFOCUS" /*validations: if(regexmatch("^[a-zA-Z ]*$",ri!permanentAddress.line2),null,"Enter only text")*/ ) } ) } ), a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Country", labelPosition: "ABOVE", placeholder: "Enter Your Country", value: ri!permanentAddress.country, saveInto: ri!permanentAddress.country, refreshAfter: "UNFOCUS" /*validations: if(regexmatch("^[a-zA-Z ]*$",ri!permanentAddress.country),null,"Enter only text")*/ ) } ), a!columnLayout( contents: { a!textField( label: "City", labelPosition: "ABOVE", placeholder: "Enter Your City", value: ri!permanentAddress.city, saveInto: ri!permanentAddress.city, refreshAfter: "UNFOCUS" /*validations: if(regexmatch("^[a-zA-Z ]*$",ri!permanentAddress.city),null,"Enter only text")*/ ) } ) } ), a!columnsLayout( columns: { a!columnLayout( contents: { a!integerField( label: "Zip Code", labelPosition: "ABOVE", placeholder: "Enter Your Zip Code", value: ri!permanentAddress.zipcode, saveInto: ri!permanentAddress.zipcode, refreshAfter: "UNFOCUS", validations: {} ) } ), a!columnLayout( contents: { a!textField( label: "State", labelPosition: "ABOVE", placeholder: "Enter Your State", value: ri!permanentAddress.state, saveInto: ri!permanentAddress.state, refreshAfter: "UNFOCUS" /*validations: if(regexmatch("^[a-zA-Z ]*$",ri!permanentAddress.state),null,"Enter only text")*/ ) } ) } ) }, isCollapsible: true ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Next", value: true, saveInto:{ a!save(ri!button_txt,ri!button_txt+1), a!save(ri!KYC_addressDetails,local!temporaryAddress), a!save(ri!KYC_addressDetails,local!permanentAddress) }, style: "PRIMARY", validate: true ) }, secondaryButtons: { a!buttonWidget( label: "Go back", value: "false", saveInto: a!save(ri!button_txt,ri!button_txt-1), submit: false, style: "NORMAL", validate: false ) } ) ) )
Discussion posts and replies are publicly visible
Hi there,
On the checkBox's saveInto, you can store its value in a temp variable and then add multiple a!save() to save the values of temporary fields in the permanent fields (one value in one a!save()) if the value of the temp variable is not null. If it is null, clear all the permanent fields.
It looks like you have 2 rule inputs for storing temporary and permanent addresses. You can directly write
a!save( ri!permanentAddress, ri!temporaryAddress )
If the value of that temp variable is not null. Else, change the second value of a!save() to null.
Can you elaborate please .
If checkbox is selected i can save either temp or permanent , but if its not selected i must save both temp and permanent.
And here we are able to save it into rule inputs , but how to save it into single table
a!checkboxField( label: "", labelPosition: "ABOVE", choiceLabels: {"Temporary Address is the Permanent Address"}, choiceValues: {true}, saveInto: { local!sameAddress, a!save( ri!permanentAddress, if( a!isNullOrEmpty(local!sameAddress), null, ri!temporaryAddress ) ) }, validations: {} )