Execute query rule in dropdown from UI values

Hello, 

I am trying to populate a dropdown by executing a query rule that is based on a CDT. I would need UI values to be passed as parameters to the query rule and populate dropdown dynamically when the user input value changes.  Issue is the value does not change when passed to query rule as a parameter and seems to take the original value only. 

Below is the code that I got so far: 

a!textField(
label: "Mfg Org",
labelPosition: "ADJACENT",
value: ri!expediteline.item_mfg_org_code,
saveInto: {
a!save(
local!mfgShipMethods,rule!EXP_GetMfgShipMethodsByOrg(local!itemMfgOrgCode,if(isnull(ri!expediteline.mfg_source_org_code_2),
if(ri!expediteline.mfg_source_org_code=local!itemMfgOrgCode,ri!expediteline.ship_from,ri!expediteline.mfg_source_org_code),ri!expediteline.mfg_source_org_code_2))
),
a!save(local!itemMfgOrgCode,ri!expediteline.item_mfg_org_code)

},
refreshAfter: "UNFOCUS",
required: true,
readonly: false,
validations: {}
)

Here I am trying to save the text field value from UI into a local variable and pass as parameter to the query rule.

Thanks

  Discussion posts and replies are publicly visible

Parents
  • Hi bpmnewb,


    can you give more clarity on your issue. In which local variable you want to store values and which is rule ?
    There is one rule which you are calling here : rule!EXP_GetMfgShipMethodsByOrg , what it suppose to return and take as input. I tried to implement the same thing in my machine and it worked.


    If possible please provide more code.

    Regards
    Abhay
  • Hi ,
    Query rule i s supposed to take value entered (ri!expediteline.item_mfg_org_code) on the text field as input and execute the query rule that would populate another dropdown field. Below is the code for the dropdown field:

    a!dropdownField(
    label:"Mfg Ship Methods",
    labelPosition: "ADJACENT",
    placeholderLabel: "--- Select a Value ---",
    choiceLabels: if(count(local!mfgShipMethods)>0,index(local!mfgShipMethods,"ship_method",null),{}),
    choiceValues: if(count(local!mfgShipMethods)>0,local!mfgShipMethods.ship_method,{}),
    value:ri!expediteline.iso_ship_method,
    saveInto: ri!expediteline.iso_ship_method,
    validations: {}
    )
    Local variable local!mfgShipMethods is populated in the load section of the page initially:

    local!mfgShipMethods : rule!EXP_GetMfgShipMethodsByOrg(ri!expediteline.item_mfg_org_code,ri!expediteline.mfg_source_org_code),

    I need local!mfgShipMethods executed every time when the user input ri!expediteline.item_mfg_org_code changes from UI.

    Thanks,
Reply
  • Hi ,
    Query rule i s supposed to take value entered (ri!expediteline.item_mfg_org_code) on the text field as input and execute the query rule that would populate another dropdown field. Below is the code for the dropdown field:

    a!dropdownField(
    label:"Mfg Ship Methods",
    labelPosition: "ADJACENT",
    placeholderLabel: "--- Select a Value ---",
    choiceLabels: if(count(local!mfgShipMethods)>0,index(local!mfgShipMethods,"ship_method",null),{}),
    choiceValues: if(count(local!mfgShipMethods)>0,local!mfgShipMethods.ship_method,{}),
    value:ri!expediteline.iso_ship_method,
    saveInto: ri!expediteline.iso_ship_method,
    validations: {}
    )
    Local variable local!mfgShipMethods is populated in the load section of the page initially:

    local!mfgShipMethods : rule!EXP_GetMfgShipMethodsByOrg(ri!expediteline.item_mfg_org_code,ri!expediteline.mfg_source_org_code),

    I need local!mfgShipMethods executed every time when the user input ri!expediteline.item_mfg_org_code changes from UI.

    Thanks,
Children