How to throw an error when all fields are not populated in a DB and user clicks a button

Occasional Contributor

How to throw an error when all fields are not populated in a DB and user clicks a button

Hi, 

 

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? Capture.PNGCapture1.PNG

 

 

Thanks!!

Amanda 

2 REPLIES 2
Certified Master Anaplanner

Re: How to throw an error when all fields are not populated in a DB and user clicks a button

HI @aabalos,

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.

Regards,
Kavin.

Message 2 of 3
Highlighted
Certified Master Anaplanner

Re: How to throw an error when all fields are not populated in a DB and user clicks a button

Hey Amanda,

 

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

  1. 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
  2. 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.
  3. 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')
  4. 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.
  5. 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

clipboard_image_0.png

clipboard_image_1.png

 

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

clipboard_image_2.png

clipboard_image_3.png

 

Data Entry Form module with the addition of line items to support solution described above...

 

clipboard_image_7.png

 

And I've gone ahead and entered some data into the first two rows.

clipboard_image_6.png

 

Here's my saved view for the import data source that will feed into my history module when I press "Save"...

clipboard_image_8.png

 

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.

clipboard_image_9.png

 

Here's how the latter action (triggering failure if we have any incomplete rows) looks when I'm setting up the action.

clipboard_image_10.png

clipboard_image_12.png

clipboard_image_13.png

 

And here's how it looks when I run it as part of a larger process.

clipboard_image_14.png

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:

Zoomed-in:

clipboard_image_17.png

Zoomed-out:

clipboard_image_15.png

 

Let us know if that helps and if there's anything else we can do to assist.

 

Cheers,

Kevin

Message 3 of 3