Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Pass Model Driven App Main Grid reference to Java Script on Click of a Custom Button

(0) ShareShare
ReportReport
Posted on by 1,085

I am trying to get a reference to my Main Grid through a JS script written on a new command of the Main Grid command bar. "SelectedControl" is the parameter I am passing to JS. I got the below code for this.

 

RameshMukka_0-1705399545245.png

 

 

function ExportWithLogos(gridContext){
 var grid = gridContext.getGrid();
 var fetchXMLStr = gridContext.getFetchXML();
 console.log(fetchXMLStr);
}

 

Somehow it doesn't work and throws the error gridContext.getFetchXML is not a function. What's wrong here?

 

Thanks,

Ramesh Mukka

  • Verified answer
    rameshmukka Profile Picture
    rameshmukka 1,085 on at
    Re: Pass Model Driven App Main Grid reference to Java Script on Click of a Custom Button

    The below code has helped. I was using the wrong function here for FetchXML. It has to be FetchXml.

     

    function ExportWithLogos(gridContext){
     var grid = gridContext.getGrid();
     //console.log(gridContext);
     var fetchXMLStr = gridContext.getFetchXml();
     console.log(fetchXMLStr);
    )

     

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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,609

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,420

Leaderboard