saving dropdown

if(
  ri!taskCode = cons!IC_TEXT_TASKCODE_RESERVE_NO_FOREWARD,
  {
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!dropdownField(
              label: "Pull Zone",
              value: local!pullZoneValues,
              choiceLabels: local!pullZoneList,
              choiceValues: local!pullZoneList,
              placeholderLabel: "Select a Value",
              saveInto: {a!save(local!pullZoneValues,save!value),
              a!save(
                local!getLocnId,
                rule!IC_QRY_getLocnidFromMSTLocationHeader(local!pullZoneValues)
              ) }

            )
          }
        ),

        a!columnLayout(
          contents: {
            a!dropdownField(
              label: "Location ID",
              value:if(
                isnull(local!pullZone),
                null,
                index(ri!selectedTask,"locnId",null)
              ), 
            
              choiceLabels: union(local!getLocnId,local!getLocnId),
              choiceValues:union(local!getLocnId,local!getLocnId),
              disabled: isnull(local!pullZoneValues),
              placeholderLabel : "Select a Value",
              saveInto: a!save(
                ri!selectedTask.locnId,
                save!value
              )


            )
          }
        )
      }
    )

  },
  {}
),

/* rule!IC_QRY_getLocnidFromMSTLocationHeader */

a!queryEntity(
  entity: cons!IC_ENTITY_MST_LOCATION_HEADER,
  query: a!query(
    selection: a!querySelection(
      columns: {
        a!queryColumn(
         
          field: "locnId"
        )
      }
    ),
    logicalexpression: a!queryLogicalExpression(
      operator: "AND",
      filters: {
      
        a!queryFilter(
          field: "SKUId",
          operator: "is null"
        ),
          
          
        a!queryFilter(
          field: "pullZone",
          operator: "=",
          value: ri!pullZone
        )
      }
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: - 1,
      sort: {}
    )
  )
).data.locnId

the second dropdown field is not saving the values, whenever I select a value in dropdown it disappears. Any help would be appreciated.

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to Siddharth Thiagarajan

    Try this.  BTW i think for the "value" of the second dropdown we can just directly access the ri property, as it likely won't have the issue of the property not existing (rule inputs are typecast to their CDT type, so the property will exist whether it's null or not).

    if(
      ri!taskCode = cons!IC_TEXT_TASKCODE_RESERVE_NO_FOREWARD,
      {
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!dropdownField(
                  label: "Pull Zone",
                  value: local!pullZoneValues,
                  choiceLabels: local!pullZoneList,
                  choiceValues: local!pullZoneList,
                  placeholderLabel: "Select a Value",
                  saveInto: {
                    a!save(local!pullZoneValues, save!value),
                    a!save(
                      local!getLocnId,
                      rule!IC_QRY_getLocnidFromMSTLocationHeader(local!pullZoneValues)
                    ),
                    a!save(
                      ri!selectedTask.locnId,
                      null()
                    )
                  }
                )
              }
            ),
            a!columnLayout(
              contents: {
                a!dropdownField(
                  label: "Location ID",
                  value: /* property(ri!selectedTask, "locnId", null), */ ri!selectedTask.locnId,
                  choiceLabels: union(local!getLocnId, local!getLocnId),
                  choiceValues: union(local!getLocnId, local!getLocnId),
                  disabled: isnull(local!pullZoneValues),
                  placeholderLabel : "Select a Value",
                  saveInto:a!save(
                    ri!selectedTask.locnId,
                    save!value
                  )
                )
              }
            )
          }
        )
      },
      {}
    )

    (but, the important change I made is this:

    )

Children