This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - How to Filter dropdown value via code

AbhishekSrivastava - Wednesday, March 30, 2016 12:07 AM:

I have a code to fetch value from Item Type Project. Below is the code:

In this code I fetch all the project name in a dropdown style in similar_project property but i have a query regarding if i want to filter by department wise project name then How will do it via this code or what modification required.

 

Normal 0 false false false EN-US X-NONE X-NONE

 
var div_id = getFieldByName("similar_project").id;
var control_id = div_id.substring(0, div_id.indexOf("span"));
var select = document.getElementById(control_id);
 
//...Replace this with a call to a external datasource...
//get Customer
var returnItm = document.thisItem.newItem("Project", "get");
returnItm.setAttribute("select", "name");
returnItm = returnItm.apply();
 
//populate the select list with options
for (var i=0;i < returnItm.getItemCount(); i++)
{
                var project = returnItm.getItemByIndex(i);
                select.options[i]=
                new Option(project.getProperty("name"),
                project.getProperty("id"));
               
}
Thanks in advance
Abhishek Srivastava