cancel
Showing results for 
Search instead for 
Did you mean: 

Refresh data in Embedded Component on a Standard Screen

swallis
Participant

Hi,

I've created an embedded component for a custom BO, that is added to a tab on the standard Ticket screen, binding it to the public outport of the ticket. When opening the tab the EC event handler runs a BO Action script on the custom object. However, if I then edit the ticket, and go back to the tab with the EC, the script does not get run (I have put a debug on the script)

Could this be because the public outport is not firing? Is there a different outport that I could use to trigger the event handler in my EC? Or some other method?

Thanks,

Simon

swallis
Participant
0 Kudos

Essentially I am trying to get an event to run on the EC whenever the ticket is saved

Accepted Solutions (1)

Accepted Solutions (1)

swallis
Participant
0 Kudos

Ok, I have figured out a way to do this:

1. First, add the EditMode field to the Data Model to detect edit mode for the EC (hat tip: How to detect EditMode in an EmbeddedComponent)

2. Then create a new Event Handler in the EC that calls an Action to refresh the data held (my EC is pulling info from the Ticket and some other sources in order to display a mashup - as per HTML script mashup – launched from an Embedded Component)

3. Put a condition on the Event Handler so that it only runs if the EditMode is blank (i.e. the user has just clicked save on the ticket so EditMode has changed from X -> blank) I do not need it to run if EditMode is 'X' (i.e. the user has just clicked 'Edit' so EditMode has changed from blank -> X)

4. Then back in the Data Model, set the OnValueChanged Property of the field to call the Event Handler just created

swallis
Participant
0 Kudos

Minor change: in the end (given the warnings in the document about EditMode, that it could potentially be changed by SAP in future) I've gone with using a transient indicator field instead. I default it to 'false' in the BO, then 'switch' the value in the BeforeSave for the EC (i.e. indicator = !indicator) Then run the 'OnChange' script against that field. That way the EventHandler is cleaner as it just needs to run whenever that field changes.

Answers (0)