Skip to main content
September 8, 2021
Question

without changing the rule input values how to update rule input by using local variables

  • September 8, 2021
  • 6 replies
  • 0 views

Hi,

i am using multidrop down field , i want to update my new values into local variable first then i want to update into my rule input without effecting the rule input  values when it is in editable condition and i have tried using the local variable but it is not getting store, can you guys guide how to solve this

a!multipleDropdownField(
                       label:"Pets",
                        placeholder:"select a value",
                        choiceLabels:index(local!pets,"petsNm",null()),
                        choiceValues:index(local!pets,"petsId",null()),
                        value:if(
                          ri!isEditable,
                          ri!pets.petsIdFk,
                          local!pet
                        ),
                        saveInto: if(
                        ri!isEditable,
                        {
                         a!save(
                            local!addition,
                            a!forEach(
                                items:local!pet,
                                expression:'type!{urn:com:appian:types:SHA}SHA_newPets'(
                                petsIdFk:fv!item,
                                mappingKey: local!mappingId
                              )))},
                        {
                          local!pet,
                          a!save(
                            ri!pets,
                            a!forEach(
                              items:local!pet,
                              expression: 'type!{urn:com:appian:types:SHA}SHA_newPets'(
                                petsIdFk:fv!item,
                                mappingKey: local!mappingId
                              )
                            )
                          )
                        },
                        
                        )
                       ),

    6 replies

    Participating Frequently
    September 8, 2021

    Hi, Rather than checking if editable or not, can you try saving the value always in local and finally when user is done with UI update, in the button click save into you can store the local variables value to rule input variable.

    gayathris111098
    September 8, 2021

    a!localVariables(
    local!pets: {
    { a!map(petsNm: "dog", petsId: 1) },
    { a!map(petsNm: "Cat", petsId: 2) }
    },
    local!mappingId: 1,
    
    
    local!petsSelected_ids: index(ri!pets, "petsIdFk", null()), /* local variable which holds old pet ids and new pet ids selected*/
    
    a!multipleDropdownField(
    /*disabled: not(ri!isEditable),*/
    label: "Pets",
    placeholder: "select a value",
    choiceLabels: index(local!pets, "petsNm", null()),
    choiceValues: index(local!pets, "petsId", null()),
    value: local!petsSelected_ids,
    saveInto: {
    local!petsSelected_ids,
    a!save(ri!pets,a!forEach(
    items: local!petsSelected_ids,
    expression: a!map(
    petsIdFk: fv!item,
    mappingKey: local!mappingId
    )
    )
    )
    }
    )
    )

    September 8, 2021

    thank u gayathris0003, i will try this 

    September 8, 2021

    these are my old rule inputs when i update it  the rule inputs are changing in the below format but i want (old ruleputs + new inputs) in my rule input