Error while fixing a bug in dropdown

Certified Senior Developer

Hi,

"Expression evaluation error [evaluation ID = c3662:90d03] in rule 'bc_frm_addasset' at function a!dropdownField [line 114]: A null parameter has been passed.".

An user cannot edit an asset when an UoM is deactivated. For eg. if Meters is deactivated in UoM reference table, then an user trying to edit an asset with 78 Meters as quantity can't edit the asset as it throws an error. 

So I am trying to use intersection function but getting the above error.  Any suggestions how to fix this? 

TIA

a!dropdownField(
                          label: "Unit of Measure",
                          labelPosition: "ABOVE",
                          placeholder: cons!BC_TEXT_PLACE_HOLDER_SELECT_VALUE,
                          choiceLabels: property(
                            local!unitOfMeasurementList,
                            "description",
                            null
                          ),
                          choiceValues: property(
                            local!unitOfMeasurementList,
                            "measureId",
                            null
                          ),
                          value: intersection(tointeger(ri!asset.unitOfMeasureId),tointeger(local!unitOfMeasurementList.measureId)),
                          saveInto: { ri!asset.unitOfMeasureId },
                          required: true,
                          validations: {}
                        )

  Discussion posts and replies are publicly visible

Parents
  • Your choice values are active UoM ( assuming query from DB with parameter isActive = true).
    Solution:
    When a new request is going to be created then query as isActive = true.

    In any existing request, any task or related action query regardless of isActive and just display as a tool tool tip or something just saying the selected option is no more available for new request. Its been deactivated and will be available for this request only.

    Or as per business, you can force them to pick the active one only if anyone is editing it.

Reply
  • Your choice values are active UoM ( assuming query from DB with parameter isActive = true).
    Solution:
    When a new request is going to be created then query as isActive = true.

    In any existing request, any task or related action query regardless of isActive and just display as a tool tool tip or something just saying the selected option is no more available for new request. Its been deactivated and will be available for this request only.

    Or as per business, you can force them to pick the active one only if anyone is editing it.

Children