Forum Discussion

Rizil's avatar
Rizil
New Contributor II
21 days ago

Custom Validation Before Saving Cube View Data

Hi Community,

I have a dashboard that includes a Cube View and a button with the "Save Data for All Components" action. Users enter data directly in the Cube View and click the button to save.

I’d like to implement a custom validation step before the data is saved. Specifically, I need to calculate the sum of four specific accounts, and if the total is not zero, I want to prevent the save operation and show an error message to the user.

Is there a recommended way to intercept the save action and apply such a validation check? Any guidance or best practices would be appreciated.

Thanks in advance!

2 Replies

  • JackLacava's avatar
    JackLacava
    Community Manager

    Correction: I forgot about the Save Data Event Handler, that could be leveraged too. https://community.onestreamsoftware.com/discussions/Rules/can-i-test-a-manual-input-before-save-andor-calculate/1907

  • JackLacava's avatar
    JackLacava
    Community Manager

    That's what Confirmation Rules are for, in traditional OneStream: you let users submit what they want, then you run a rule on the resulting data (either with a Confirm step in workflows, or by running BRApi.DataQuality.Process.ExecuteConfirmation in a rule).

    You could approximate your requirements by having some sort of widget that signals the status (like a red light/green light), and setting its appearance with a Server Task triggered on save (you will probably need to refresh its container dashboard to see it change) that runs confirmation rules or your own checks. The data would be saved, but the user would know it is wrong. Having the check as a Confirmation Rule would also allow you to reuse it in other validation processes.

    If you want something more, you need to look at custom forms or the new Dynamic Grid.