Hi I want to populate dropdown field on my form dynamically.I am on appian 7.2

Hi I want to populate dropdown field on my form dynamically.I am on appian 7.2
I am using following code
importScript('/plugins/servlet/FormsExt.js');
FormAPI.populateDropdown("txtMaterialCode", ["getMaterialCodeMappingExpRule","Carton","No"]);

Here
getMaterialCodeMappingExpRule is an expression rule which takes two parameters.


When I execute this code i get following error
"Unable to get value of the property 'options': object is null or undefined"

Any pointer to this will really be helpfull....

OriginalPostID-105563

OriginalPostID-105563

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Hi Amit,
    In your code sniplet you have not given id_attr and display_attr. You are fetching material code object from rule, but what field of that object you need show in dropdown that u need to specify using id_attr and display_attr.
    e.g
    example1:
    FormAPI.populateDropdown("txtMaterialCode", ["getMaterialCodeMappingExpRule","Carton","No"],"code","code");
    here i am assuming that code is the field in CDT.

    example2

    FormAPI.populateDropdown("dropdown6", ["GetBusinessOriginDetailsByOriginCode", FormAPI.getValue("dropdown5").id], "code", "description");

    kindly refer the attached Advanced form utilities guide

    AdvancedFormsAPI_v1.6.0.pdf

Reply
  • 0
    Certified Lead Developer
    Hi Amit,
    In your code sniplet you have not given id_attr and display_attr. You are fetching material code object from rule, but what field of that object you need show in dropdown that u need to specify using id_attr and display_attr.
    e.g
    example1:
    FormAPI.populateDropdown("txtMaterialCode", ["getMaterialCodeMappingExpRule","Carton","No"],"code","code");
    here i am assuming that code is the field in CDT.

    example2

    FormAPI.populateDropdown("dropdown6", ["GetBusinessOriginDetailsByOriginCode", FormAPI.getValue("dropdown5").id], "code", "description");

    kindly refer the attached Advanced form utilities guide

    AdvancedFormsAPI_v1.6.0.pdf

Children
No Data