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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Invoke ribbon action f...
Power Apps
Unanswered

Invoke ribbon action function from PCF control

(0) ShareShare
ReportReport
Posted on by 30

Hi Guys,

 

Is there a way we could invoke javascript function through PCF control which are bind with ribbon actions?

 

actually I can see that js file as web resources loading into browser which contain those methods but they are in separate iframe so my PCF control can't able to see them ... and can't able to make call to these javascript methods.

 

I want to simulate these ribbon button menu inside my PCF through context menu, but the bottle neck is to have access to those javascript functions 😞

 

I would appreciated any help 🙂

 

Regards,

Awais

I have the same question (0)
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @awais , 

     

    From a PCF you cannot acces the Javascripts on the form or ribbon, at least not supported.

    Is it a Dataset PCF or a Field PCF?

    If it's a script that you wrote, and you don't access the formContext in the script, maybe you can include it in your PCF?

     

    The only kind of "events" you can trigger from the PCF is changing values of the bound attributes. Maybe you can introduce a new "dummy" attribute, when you want to trigger the function, change it's value inside the PCF and let  the ribbon script attach to this "OnChange" event.

     

    If that's not an option, but you can change the  script behind the ribbon function (and you cannot solve the problem in another way), maybe you can try using postMessage inside the PCF and let the ribbon script listen to this message. The problem is that you would need to send the message to all the frames, because you don't know where the ribbon scripts will be loaded. It's not very bad, since the other Frames will ignore your message. I've wrote a blog about this (https://dianabirkelbach.wordpress.com/2020/05/15/can-pcfs-communicate/) but it's a bit of a gray zone. 

     

    Hope this helps 🙂

     

    Kind regards,

    Diana

  • awais Profile Picture
    30 on at

    Thanks @DianaBirkelbach,

    It is Field PCF control. actually I don't want to access formContext, basically some existing ribbon actions exists to do some operations against OOB subgrid selection. Now in my PCF I want to perform same operations on my react-ui detailList control selection.

     

    I will try your postMessage suggestion. 

     

    Regards,

    Awais

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @awais ,

    Not sure if I've got the use case to the end, but I wanted to check that you are aware that the Dataset PCFs are able to select records, which the ribbon can interact with. Exactly like the OOB Grids.

    You can use dataset.setSelectedRecordIds: https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/dataset/setselectedrecordids

     

    Maybe you don't need to go the hard way to trigger the ribbon action. 

     

    Kind regards,

    Diana

  • awais Profile Picture
    30 on at

    Hi @DianaBirkelbach 

    Thanks, I don't thing I can use Dataset PCF, actually I am building records from custom json of all connections record and thy are not related with one type of entity.

    Ribbon bind with OOB grid is existing logic which I am trying to use as is in my PCF 🙂 

    Regards,

    Awais

  • Verified answer
    Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    I've got it now @awais .

    An alternative could be making Virtual Entity out of JSONs, and using the rest of the logic without a PCF. Just a thought, in case it helps you stay supported and  it's not too complicated.

    Kind regards,

    Diana

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard