Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

js for Fetching record and show that record into a grid

(0) ShareShare
ReportReport
Posted on by 365

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 record2543.93cap.JPG

  • Pankaj Gogoi Profile Picture
    Pankaj Gogoi 3,177 on at
    RE: js for Fetching record and show that record into a grid

    Hi,

    Hope this references helps.

    http://dotnetdust.blogspot.com/2020/06/setting-sub-grid-filterxml-in-unified.html

    https://medium.com/@meelamri23/dynamically-set-fetchxml-to-subgrid-on-dynamics-365-v9-uci-a4a531200e73

    I would suggest to insert a Quick View form instead of the subgrid.

    Best Regards,

    PG

  • Denny Deng Profile Picture
    Denny Deng on at
    RE: js for Fetching record and show that record into a grid

    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>"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans
Liquid error: parsing "/globalsearch/?q=call+of+duty++modern+warefare+full+crack+for+pc" - Nested quantifier +.