web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

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 recordpastedimage1600761450475v1.jpeg

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: js for Fetching record and show that record into a grid

    Hello,

    Code you mentioned used to work in Classic UI but doesn't work in UCI. Check this post if you want to make your code work - dotnetdust.blogspot.com/.../setting-sub-grid-filterxml-in-unified.html

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: js for Fetching record and show that record into a grid

    It sounds like this would be best accomplished with a retrievemultiple plugin.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 228

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 156 Super User 2025 Season 2

#3
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 149

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans