Hi, I'm trying to create a filter for addCustomFilter function where the value is an array of Guids (teamId), and the operator is 'in', but I can't seem to get the xml right.
I'm trying to iterate through the array and add a <value> tag for each guid in the array.
var userTeams = dataService.GetTeamsIdOfUser(userId[0].id); var filter = "<filter type='and'><condition attribute='teamid' operator='in'>"; userTeams.forEach(function (val) { filter+= "<value='{" + val + "}'></value>" }); filter += "</filter>"; Xrm.Page.getControl("mtx_assign2userteam").addCustomFilter(filter,"team");
can anyone show me what I'm doing wrong?
Thanks in advance!
*This post is locked for comments
It looks like you are missing the end tag for the condition-tag. Try adding the </condition> right before you close the filter tag
Hi,
You can add the filter condition as follows: "<condition attribute='teamid' operator='in'>"+
"<value>"+id1+"</value>"+
"<value>"+id2+"</value>"+
"</condition>"+
"</filter>"+
If found useful, please mark this answer as verified.
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6