I used if() to check the condition in Value() parameter of dropdown which is working fine from front end, but the value is not saved when i use the same logic in SaveInto() parameter of dropdown.
Logic used in Value() parameter:
if( and( ri!eventType = cons!INS_INT_EVENT_TYPE_ID_ANZ_ARREARS, ri!policyNo = cons!INS_TXT_MULTIPLE ), "Contact Centre Outbound", if( and( ri!eventType = cons!INS_INT_EVENT_TYPE_ID_ANZ_ARREARS, ri!policyNo = cons!INS_TXT_SINGLE ), "Contact Centre Inbound", index(ri!application, "incomingSource", null) ),
)
Logic used in SaveInto() parameter:
{ if( and( ri!eventType = cons!INS_INT_EVENT_TYPE_ID_ANZ_ARREARS, ri!policyNo = cons!INS_TXT_MULTIPLE ), a!save( ri!application.incomingSource, "Contact Centre Outbound" ), if( and( ri!eventType = cons!INS_INT_EVENT_TYPE_ID_ANZ_ARREARS, ri!policyNo = cons!INS_TXT_SINGLE ), a!save( ri!application.incomingSource, "Contact Centre Inbound" ), ri!application.incomingSource ),
) },
Text marked in yellow is my first condition and text marked in green is my second condition. Both conditions are being correctly displayed but not being saved. Please let me know, where am i going wrong. Thanks in advance!
Discussion posts and replies are publicly visible
Hi poojithak2926 ,You're dynamically setting a value based on conditions, but the saveInto isn't saving the user's selection, it’s conditionally setting a value regardless of what the user picks.In dropdowns, value is what's currently selected (displayed to the user), and saveInto should save what the user selects.If you want to conditionally override what the user selects and force a particular value into ri!application.incomingSource based on other rule inputs, you need to wrap the logic inside an a!save that uses save!value.
value
You can use save!value as:{ a!save( ri!application.incomingSource, if( and( ri!eventType = cons!INS_INT_EVENT_TYPE_ID_ANZ_ARREARS, ri!policyNo = cons!INS_TXT_MULTIPLE ), "Contact Centre Outbound", if( and( ri!eventType = cons!INS_INT_EVENT_TYPE_ID_ANZ_ARREARS, ri!policyNo = cons!INS_TXT_SINGLE ), "Contact Centre Inbound", save!value ) ) ) }Try the above code and let me know!!!Hope this helps you!!!
{ a!save( ri!application.incomingSource, if( and( ri!eventType = cons!INS_INT_EVENT_TYPE_ID_ANZ_ARREARS, ri!policyNo = cons!INS_TXT_MULTIPLE ), "Contact Centre Outbound", if( and( ri!eventType = cons!INS_INT_EVENT_TYPE_ID_ANZ_ARREARS, ri!policyNo = cons!INS_TXT_SINGLE ), "Contact Centre Inbound", save!value ) ) ) }
Hello, thanks for the response. The field is set to read-only in condition 1,condition 2 and editable in the rest of the scenarios which is why i am trying to set a default value conditionally. I tried the code but still the value is not being saved.
The saveInto is only evaluated when the user interacts with that field. That's a challenge if you make it readonly.
The trick to default values, is to populate the values in the data. The fields cannot do that for you.
Check the Appian documentation