Skip to main content
Employee - Guide
Apr 7, 2025 6:02 PM UTC
Solved

Components' Dynamic state for dynamic dashboard

Hello,

I am trying to get my dynamically created buttons to execute a server task.

I can create all the buttons I need in my dynamic dashboard, but as soon as I try to get them to execute a dashboard business rule, I get an error message :

I have checked my services, and Everything gets validated.

My WsDynamiccomponentCollection is as follow :

Dim currentcomps As WsDynamiccomponentCollection = api.GetDynamicComponentsForDynamicDashboard(si, workspace, dynamicDashboardEx, string.empty, Nothing, tristatebool.TrueValue, wsdynamicitemstatetype.EntireObject)

I am also using the functions SaveDynamicDashboardState and SaveDynamicComponentState :

api.SaveDynamicDashboardState(si,dyncomp2,dynamicDashboardEx,wsdynamicitemstatetype.EntireObject)
                            api.SaveDynamicComponentState(si,dynamicDashboardEx.DynamicDashboard,dyncompex2,wsdynamicitemstatetype.EntireObject)

(dyncomp2 and dyncomp2ex being the button I am creating).

--> It seems that it creates a list of dashboard and/or components in a new table called "wsDynamicItemState", but that's it. The ID code that I have in the error message exist in the table, under the "itemID" column:

Any insights on how to resolve this issue, as well as this "component state", are welcome :)

Regards,

 

 

sameburnAnswer
Employee - Advisor
Apr 9, 2025 5:02 PM UTC

Hi Sergey 

You do not appear to be passing your repeatArgsList into the api that creates the ComponentCollection?

e.g. this is the method.

GetDynamicComponentsRepeatedForDynamicDashboard(SessionInfo si, DashboardWorkspace workspace, WsDynamicDashboardEx dynamicDashboardEx, List<WsDynamicComponentRepeatArgs> repeatArgsList, TriStateBool convertStoredComponentsToDynamic, WsDynamicItemStateType dynamicItemStateType)

The example you shared is the default when you create a new DynamicDashboardsService and it expects nothing to be returned (excuse C# below but principles are the same)

Try passing in your repeatArgsList and TriStateBool.Unknown (instead of Nothing) and hopefully it works... or at least you get a new error 😄

BR

Sam

e.g. 

WsDynamicComponentCollection componentCollection = api.GetDynamicComponentsRepeatedForDynamicDashboard(si, workspace, dynamicDashboardEx, repeatArgsList, TriStateBool.Unknown, WsDynamicItemStateType.Unknown);

 

2 replies

Contributor
Apr 7, 2025 6:35 PM UTC

In your assembly have you created a service rule with Source Code Type = Dashboard Service?  I am not an expert but I think you would need the file to have this source code type for the assembly to call up the dashboard component. 

Regards

sameburnEmployee - AdvisorAnswer
Employee - Advisor
Apr 9, 2025 5:02 PM UTC

Hi Sergey 

You do not appear to be passing your repeatArgsList into the api that creates the ComponentCollection?

e.g. this is the method.

GetDynamicComponentsRepeatedForDynamicDashboard(SessionInfo si, DashboardWorkspace workspace, WsDynamicDashboardEx dynamicDashboardEx, List<WsDynamicComponentRepeatArgs> repeatArgsList, TriStateBool convertStoredComponentsToDynamic, WsDynamicItemStateType dynamicItemStateType)

The example you shared is the default when you create a new DynamicDashboardsService and it expects nothing to be returned (excuse C# below but principles are the same)

Try passing in your repeatArgsList and TriStateBool.Unknown (instead of Nothing) and hopefully it works... or at least you get a new error 😄

BR

Sam

e.g. 

WsDynamicComponentCollection componentCollection = api.GetDynamicComponentsRepeatedForDynamicDashboard(si, workspace, dynamicDashboardEx, repeatArgsList, TriStateBool.Unknown, WsDynamicItemStateType.Unknown);