Closed aboultonhumana closed 8 months ago
@aboultonhumana,
Have you tried using your JSON in the designer? I didn't find any issues there. I'm closing this issue. Please respond to this thread if you have any further questions.
@aboultonhumana,
Have you tried using your JSON in the designer? I didn't find any issues there. I'm closing this issue. Please respond to this thread if you have any further questions.
Correct, Action.ToggleVisibility triggers the action event (i.e. pops up the alert with the data) in the Designer tool but not in SharePoint Framework (v 1.18 and tested with earlier versions). The other universal actions do trigger the event in code.
@aboultonhumana, Have you spoken with the developers who maintain SharePoint Framework? As demonstrated, Adaptive Cards are functioning correctly, as the designer is running on the latest version of Adaptive Cards.
Thanks @jwoo-msft -- agreed it's an issue with the SPFx implementation. For anyone stumbling upon this, a workaround is to not use the ToggleVisibility action, but instead to use Action.Execute in combination with the $when attribute in the JSON template to show/hide the element based on a value stored in the card's state (e.g. a value of ${showTheThing}
that is initially false
). So, instead of setting a ToggleVisibility action on an element, use Action.Execute in combination with a verb used to identify that specific interaction. Then, for the Execute action, the onAction event handler in the SPFx ACE code is triggered. When that specific Action + verb occurs we then update the card's state corresponding to the $when condition, e.g. setting the showTheThing
to true
to conditionally show the element(s).
Target Application
Viva Connections Dashboard
Application Operating System
Windows
Schema Version
1.5
Problem Description
Setting an action of
Action.ToggleVisibility
in the Quick View JSON does not trigger theonAction
event in SPFx code.Expected Outcome
Expecting the
Action.ToggleVisibility
action to trigger anonAction
even in the same way thatAction.Submit
andAction.Execute
trigger the event.Actual Outcome
onAction
event is not triggered.Card JSON
Repro Steps
onAction
event.