dear all,
i have this scenario:
i have list of volunteers(contact entity), and someone will make a volunteer request(custom entity) according to some conditions, after that i use plugin to have list of volunteers that matching requested skills and copy them to third entity called volunteer request selected (custom entity) this entity have volunteers Id, volunteer request Id and it's own id.
my problem is when i in another entity and have a lookup to volunteers(contact entity) called "new_volunteer", but i need to load all volunteers with specific volunteer request Id. i suppose that i have volunteer request Id ( i get it using window.top.opener.Xrm.Page.data.entity.getId().
i know that i have to use addcustomview.
is this code javascript below true (cause i have an error):
i need for sample load all volunteers in request2 (req2)
function preFilterLookupVolunteer()
{
Xrm.Page.getControl("new_volunteer").addPreSearch(function () { addLookupFilterVolunteer(); });
}
function addLookupFilterVolunteer()
{
\\get the request id.
var reqid= window.top.opener.Xrm.Page.data.entity.getId();
alert(reqid);
var viewId = "{44B23EF1-0ADD-E411-817C-00155DEE9E05}"; //view Guid
var entityName = "contact";
var viewDisplayName = "volunteerinReq"; // my custom view
var fetchXml ="<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="contact">
<attribute name="fullname" />
<attribute name="contactid" />
<order attribute="fullname" descending="false" />
<link-entity name="new_volunteer_requestselected" from="new_volunteer" to="contactid" alias="aa">
<filter type="and">
<condition attribute="new_volunteerrequestedid" operator="eq" uiname="req2" uitype="new_volunteersrequest" value="{B7EAC8CE-6CD0-E411-816F-00155DEE9E05}" />
</filter>
</link-entity>
</entity>
</fetch>";
var layoutXml = "<grid name='resultset' " +
"object='1' " +
"jump='name' " +
"select='1' " +
"icon='1' " +
"preview='1'>" +
"<row name='result' " +
"id='contactid'>" +
"<cell name='fullname' width='250' />" +
"</row>" +
"</grid>";
Xrm.Page.getControl(“new_volunteer”).addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
}
thanks all in advance.