add PickerFieldUser value to rule input

Hi All,

can anyone please tel me how to add PickerFieldUsers value into rule input 

Thanks in advance

  Discussion posts and replies are publicly visible

Parents
  • Hi Vineeth

    Just like any other interface input component it has a 'value' parameter and a 'saveInto' parameter. Set these both to point to the relevant rule input. So, where your rule input is ri!selectedUsers (an array of 'User'):

    a!pickerFieldUsers(
    value: ri!selectedUsers,
    saveInto: ri!selectedUsers
    )
  • Hi Stewart, thanks for the reply , but the PickerFieldUsers field is inside Grid, so the Above one is not working
  • 0
    Certified Lead Developer
    in reply to vineethk0001
    If you have a more unusual use case, please provide relevant sample code so that we can see what you're trying to do.
  • Hi Mike,
    below is my code, please let me know what do i have to change,
    oad(
    local!apprName,
    local!Managers: {},
    a!formLayout(
    label: "Adding, Editing or deleting additional manager",
    contents: {
    a!gridLayout(
    totalCount: count(
    local!Managers
    ),
    headerCells: {
    a!gridLayoutHeaderCell(
    label: "Name"
    ),
    a!gridLayoutHeaderCell(
    label: "level"
    ),
    a!gridLayoutHeaderCell(
    label: ""
    )
    },
    rows: a!forEach(
    items: local!Managers,
    expression: a!gridRowLayout(
    id: fv!index,
    contents: {
    a!pickerFieldUsers(
    label: "Name " & fv!index,
    value: fv!item.Approvers,
    maxSelections: 3,
    required: true

    ),
    /* For the Title Column*/
    a!integerField(
    label: "Level " & fv!index,
    value: fv!item.Levels,
    saveInto: a!save(ri!Levels, fv!item.Levels),
    required: true
    ),
    /* For the Removal Column*/
    a!imageField(
    label: "delete " & fv!index,
    images: a!documentImage(
    document: a!iconIndicator(
    "REMOVE"
    ),
    altText: "Remove Employee",
    caption: "Remove " & fv!item.Name & " " & fv!item.Levels,
    link: a!dynamicLink(
    value: fv!index,
    saveInto: {
    a!save(
    local!Managers,
    remove(
    local!Managers,
    save!value
    )
    )
    }
    )
    ),
    size: "ICON"
    )
    }
    )
    ),
    addRowlink: a!dynamicLink(
    label: "Add Manager",
    value: {
    Name: ""
    },
    saveInto: {
    a!save(
    local!Managers,
    append(
    local!Managers,
    save!value
    )
    )
    }
    )
    )
    },
    buttons: a!buttonLayout(
    primaryButtons: a!buttonWidgetSubmit(
    label: "Submit"
    )
    )
    )
    )
  • 0
    Certified Lead Developer
    in reply to vineethk0001

    Well, your user picker wasn't saving anything in the version you posted because it doesn't contain any SaveInto.  I've revised your form somewhat to where it saves everything locally.  If you still need it to interact with a rule input in some specific way, you'll need to explain a bit more clearly what you're hoping to have happen.  But for now hopefully this is a good start:

    load(
      /*local!apprName,*/
      local!Managers: {},
      a!formLayout(
        label: "Adding, Editing or deleting additional manager",
        contents: {
          a!paragraphField(
            label: "DEBUG",
            showWhen: false(),
            value: local!Managers
          ),
          
          a!gridLayout(
            totalCount: count( local!Managers ),
            headerCells: {
              a!gridLayoutHeaderCell( label: "Name" ),
              a!gridLayoutHeaderCell( label: "level" ),
              a!gridLayoutHeaderCell( label: "" )
            },
            columnConfigs: {
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 5),
              a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
              a!gridLayoutColumnConfig(width: "ICON")
            },
            rows: a!forEach(
              items: local!Managers,
              expression: a!gridRowLayout(
                id: fv!index,
                contents: {
                  a!pickerFieldUsers(
                    label: "Name " & fv!index,
                    value: fv!item.Approvers,
                    saveInto: fv!item.Approvers,
                    maxSelections: 3,
                    required: true
                  ),
                  /* For the Title Column*/
                  a!integerField(
                    label: "Level " & fv!index,
                    value: fv!item.Levels,
                    saveInto: {
                      /*a!save(*/
                        /*ri!Levels,*/
                        /*fv!item.Levels*/
                      /*),*/
                      fv!item.Levels
                    },
                    required: true
                  ),
                  /* For the Removal Column*/
                  a!richTextDisplayField(
                    value: {
                      a!richTextIcon(
                        icon: "REMOVE",
                        size: "MEDIUM",
                        caption: "Remove",
                        color: "NEGATIVE",
                        link: a!dynamicLink(
                          saveInto: {
                            a!save(
                              local!Managers,
                              remove(
                                local!Managers,
                                fv!index
                              )
                            )
                          }
                        ),
                        linkStyle: "STANDALONE"
                      )
                    }
                  )
                  /*a!imageField(*/
                    /*label: "delete " & fv!index,*/
                    /*images: a!documentImage(*/
                      /*document: a!iconIndicator( "REMOVE" ),*/
                      /*altText: "Remove Employee",*/
                      /*caption: "Remove " & fv!item.Name & " " & fv!item.Levels,*/
                      /*link: a!dynamicLink(*/
                        /*value: fv!index,*/
                        /*saveInto: {*/
                          /*a!save(*/
                            /*local!Managers,*/
                            /*remove(*/
                              /*local!Managers,*/
                              /*save!value*/
                            /*)*/
                          /*)*/
                        /*}*/
                      /*)*/
                    /*),*/
                    /*size: "ICON"*/
                  /*)*/
                }
              )
            ),
            addRowlink: a!dynamicLink(
              label: "Add Manager",
              /*value: {*/
                /*Approvers: {},*/
                /*Levels: null()*/
              /*},*/
              saveInto: {
                a!save(
                  local!Managers,
                  append(
                    local!Managers,
                    {
                      Approvers: {},
                      Levels: null()
                    }
                  )
                )
              }
            )
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: a!buttonWidgetSubmit(
            label: "Submit"
          )
        )
      )
    )

  • Hi Mike,
    i tried the above , it worked, but when i hit on "Add New Manager" and key in the manager details, the array value gets replaced on the first row, how to over come this,
    what i have done is , i have used "JoinArray" property to take all the items and save in one with comma separated,
    not when i add the new approver, it should be added in the index 2 instead of replacing the first
Reply Children