How to throw an error when all fields are not populated in a DB and user clicks a button
I have this table in this dashboard where a user needs to enter in these mandatory fields in order to save this data into a "history log", which is a separate module. How can i make it so that if all three of these fields are not entered in, when the user clicks the save button, it will throw an error? Right now I have a boolean in a view where if all three fields are not blank, save the data in the history log. My issue right now is, is that if there is one field populated and i run the action, it will say sucessful and it will show green checks but say nothing updated. I want it to throw an error. Any ideas on how to do that?
I have an idea for this, see if it works for you. I don't know what each actions are doing but while copying the data to your 'History Log' Module try to capture the information in the list as property and then bring it to your History log module thru formula. So while copying you should link the code to destination and that is where our trick sits. Write a condition to the code line item (In destination) saying 'If isnotblank of all the 3 entries then give me the code else blank'. Hence if you try to run an action into the list with empty code, it will throw you an error saying "Error Parsing No values". May be in this way you can get the error. I am not a fan of creating Properties in the list but however in some exceptional cases like this you can go with it.
I hope you understand!! Let me know if you have any concerns.
Re: How to throw an error when all fields are not populated in a DB and user clicks a button
Happy to help. I've summarized my understanding of what you're looking to accomplish (keep me honest), outlined an approach I've used in the past for this, and have put together a quick example including some screenshots.
Let me know if we're not aligned on the desired outcome or if I've missed the mark on how to solve for it.
My understanding of what you're looking to accomplish...
You're looking to set up an Anaplan Process (comprised of one or more Actions) that will:
1. Check whether certain conditions are met for each record that will be imported from a source to a target
2. If the conditions are not met for *a particular* record, have that record not move from the source to the target.
3. If the conditions are not met for *any single* record, have the entire process throw a Red 'X' or Yellow '!' to indicate to the user that, at a Process level, something went wrong.
If this is correct, here's an approach I've used in the past for this...
To provide a visual cue to the user that something went wrong
In the module containing them items to which you are applying validation logic, create 2 new line items, the 1st of type Text and the 2nd of type Number
In the 1st, have a formula that uses IF-THEN-ELSE logic to check if all required fields are populated with valid values, if so, return a text value of "1", otherwise, return a text value of "Some text value." or "Uh oh, we have a problem." or something to that effect.
Create an action that imports from that module to itself, mapping the 1st line item above (of data format type 'Text') to the 2nd line item above (of data format type 'Number')
If all rows pass the validation, you will be importing a text value of "1" into a Number-formatted field for each row, which will be interpreted as the number 1. No issue here, green checkmarks all the way. However, if one row does not pass validation, you will be attempting to import a text value of "Some text value." into a Number-formatted field, and the action will fail.
If you add this action to the end of the process, it should trigger a failure or warning at a Process level, indicating to the user that something went wrong.
To prevent the invalid item (due to missing data / invalid data inputs) from being saved to the history module
You probably figured this one out, but this is as simple as adding a filter to the saved view that feeds data from your source module to your target module; the filter would look at a boolean that checks whether all fields are populated with valid values
And here's an example...
Data Entry Form module
Applies to a 10-item list called "New Items", enabling me to enter and save data for up to 10 items at a time
Has 3 fields in which I want to capture some value; the 1st and 3rd are required, whereas the 2nd is a boolean, so technically it's optional / valid to leave it unchecked as false
I plan to enter values into this form, press a "Save" button, and for any records with fields 1 and 3 populated, move those values into my History module
Applies to a list called "Historical Items"
It looks like I've saved 3 items into this module thus far
Has 3 fields, supporting the same values from the Data Entry Form module
Data Entry Form module with the addition of line items to support solution described above...
And I've gone ahead and entered some data into the first two rows.
Here's my saved view for the import data source that will feed into my history module when I press "Save"...
And here's my saved view for the import data source that will drive my process to show a failure if I have an incomplete row.
Here's how the latter action (triggering failure if we have any incomplete rows) looks when I'm setting up the action.
And here's how it looks when I run it as part of a larger process.
If you want end-users to see a detailed list of actions and what succeeded / failed, you can check this box at the bottom of the Process configuration dialog:
Let us know if that helps and if there's anything else we can do to assist.