How to get Selected Choice Label in a rule input Variable

My dropdown field is this:

a!dropdownField(

label: "Appliance Id",
labelPosition: "JUSTIFIED",
placeholder: "Select the appliance",
choiceLabels: rule!LN_Concatenate_Appliance_Customer_Details(local!userId),
choiceValues: rule!LN_Fetch_Appliance_Based_Customer_Id(local!userId).data.applianceId.applianceId,
value: if(isnull(local!applianceId), null, local!applianceId),
saveInto: {local!applianceId, ri!Servicing.applianceId.applianceId},
showWhen: ri!isCustomerCare

),

I want the selected Choice Label to be saved in a rule input variable. How can I do that? The choice values is basically the id, but I need it, so I cannot replace it with the same expression rule as choiceLabel.

Thanks in advance!!

  Discussion posts and replies are publicly visible

Parents
  • Hi,

    You can use displayValue function inside your saveInto param. That way, you will be able to identify the selected label and save it into the desired RI. 
    For instance, let's suppose the RI in which you want to save is 'selectedLabel'. Now please refer to the code snippet below.

    a!dropdownField(
      label: "Appliance Id",
      labelPosition: "JUSTIFIED",
      placeholder: "Select the appliance",
      choiceLabels: rule!LN_Concatenate_Appliance_Customer_Details(local!userId),
      choiceValues: rule!LN_Fetch_Appliance_Based_Customer_Id(local!userId).data.applianceId.applianceId,
      value: local!applianceId,
      saveInto: {
        local!applianceId,
        ri!Servicing.applianceId.applianceId,
        a!save(
          ri!selectedLabel,
          displayvalue(
            local!applianceId,
            rule!LN_Fetch_Appliance_Based_Customer_Id(local!userId).data.applianceId.applianceId,
            rule!LN_Concatenate_Appliance_Customer_Details(local!userId),
            null
          )
        )
      },
      showWhen: ri!isCustomerCare
    )
    It should do the work. 

    Thanks,
    Harshit

  • Thank you so much! It worked. Yes, I just needed it for displaying in text, so casting wasn't required.

Reply Children
No Data