Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

js for Fetching record and show that record into a grid

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

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee 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.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 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

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans