Applying for fetching record from lookup to grid
function onformLoad(executioncontext)
{
debugger;
var formContext=executioncontext.getFormContext();
var preventivemaintenancekms= Xrm.Page.getAttribute("new_preventivemaintenancekms").getValue();
var str= preventivemaintenancekms[0].id;
//var str= formContext.data.entity.getId();
var id = str.replace("{", "").replace("}", "");
var subgridLookup = formContext.getControl("PMTask");
var fetchXml = "<filter type='and'>" +
"<condition attribute='new_preventivemaintentacetaskid' operator='in'><value>"+id +"</value></condition>" +
"</filter>";
subgridLookup.setFilterXml(fetchXml);
subgridLookup.refresh();
}
but its fetching the id but not the record
Hi,
Hope this references helps.
http://dotnetdust.blogspot.com/2020/06/setting-sub-grid-filterxml-in-unified.html
I would suggest to insert a Quick View form instead of the subgrid.
Best Regards,
PG
looks like the fetchxml is not correct, it shall look something like below:
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
" <entity name='activitypointer'>" +
" <attribute name='activitytypecode' />" +
" <attribute name='subject' />" +
" <attribute name='ownerid' />" +
" <attribute name='prioritycode' />" +
" <attribute name='regardingobjectid' />" +
" <attribute name='activityid' />" +
" <attribute name='scheduledstart' />" +
" <attribute name='scheduledend' />" +
" <attribute name='statecode' /> " +
" <attribute name='community' /> " +
" <order attribute='modifiedon' descending='false' />" +
" <filter type='and'>" +
" <condition attribute='activitytypecode' operator='ne' value='4206' />" +
" <condition attribute='activitytypecode' operator='eq' value='4210' />" +
" </filter>" +
" </entity>" +
"</fetch>"
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,101 Super User 2024 Season 2
Martin Dráb 229,908 Most Valuable Professional
nmaenpaa 101,156