Return data from custom component to PSU

Product: PowerShell Universal
Version: 1.4.6

I’ve managed to create a simple component to drag items between two lists. The dragging works well, but what I would like to do is return the items from destination list, but how do I send data from a component back to a dashboard? My thinking is just having a button, when the user clicks I get the data I want and then somehow send it to the dashboard, for example this could just be a string. TIA.

just as an update, I have managed to render the react button and then register a PS function which is called when the button is clicked using:
UniversalDashboard.publish(‘element-event’, {
type: “clientEvent”,
eventId: this.props.id,
eventName: ‘OnClick’,
eventData: “something”
});

but when I look at the endpoints that are created, I dont see this one - how can I get the eventData from my powershell script, where is it hidden :slight_smile:

I figured it out, the below are passed back to the calling function as vars. so I just neeed to reference $eventdata to get my data back.
I really love PSU, but sometimes I find it endlessly frustrating to get the info I need :slight_smile:

UniversalDashboard.publish(‘element-event’, {
type: “clientEvent”,
eventId: this.props.id,
eventName: ‘OnClick’,
eventData: “something”
}

powershell function
-OnClick {Show-UDToast -Message $eventdata}

If you aren’t finding the information you need, can you please email us at support@ironmansoftware.com so we can improve whatever is missing?

Sometimes its hard to catch everything in the forums. I can update the improve the documentation for custom components to include the information here.

1 Like