Skip to main content

Hello I would like to publish an event to send data from a skuid aggregate model to a lightning component.


skuid.events.publish(‘AggMessage’, JSON.stringify(payload));


AggMessage is never making it to the component listing on


<aura:handler event=“skuid:event” action=“{!c.handleSkuidEvent}”/>


I’m assuming this is because the publishing scope of AggMessage needs to be set to “All active pages and Lightning Components” How do I set event scope from code?


Thanks,

Peter

Here’s another alternative/related question.


I made the event below with the builder with publish to Lightning Components scope and my component is receiving it. How do I add data payload to this event?





Thanks,

Peter


You can add Parameters by clicking the “+” icon on the Publish Event action. This lets you provide key-value pairs of data that is sent to the Lightning Component as an object.


The “Publish Event” action type in the Action Framework is the highly recommended way to set the publishing scope to “All active Skuid Pages and Lightning Components”. Technically yes it is possible to specify the scope via the JavaScript API but we’d like to avoid customers using that unless for some reason using the declarative “Publish Event” action is not working.


Fantastic! When I click on the disk icon to select a field to use as a value doesn’t popup anything? I’m not sure what syntax I should use for the </> button. How do I add a field from an aggregate model?


OK, I’m hopeful!   Thanks! Peter


If you want to pull in a Model field as a value, you can use {{{$Model.YourModelName.data.0.The_Field_You_Want__c}}}


It worked!   Thank you so much!


Hi Zach… I’m having to trigger an event from an html submit button in a Skuid template component which the Lightning component can listen for.

My current approach is to listen for an event locally on the Skuid page (skuid.events.publish(‘some.event’)) and to then use an event-triggered sequence in Skuid to listen to this and then publish another event via the action-framework to the surrounding Lightning Component using the broader scope.

This is working fine but it’d be nice to know how to publish to the broader scope straight from javascript rather than using the above two-step process. Any chance you could spill the beans on this?

Just a note - I also found that you had to set the even-triggered sequence to “All Active Pages and Lightning Components” for the above listener to work - even though the javascript was publishing the event from a snippet in the same Skuid page.


An alternative approach would be to be able to trigger an event-triggered sequence from within a snippet/javascript


I’ll go ahead and post the way to set publishing scope to “All Skuid Pages and Lightning Components” via JavaScript:


skuid.events.publish("AggMessage", apayload], { scope: skuid.constants.EVENT_SCOPES.GLOBAL });

Thank you!!! 🙂