Bulk update to run only when all the editable fields are not empty

  • Goal: The main goal is to only run the bulk update of the ChangesetArray if the editable fields (I have two in the table) are not empty. The idea is that when clicking on the button that is triggering the Bulk update, if the user only filled in one of the two editable fields of a respective line, it appears an error message saying that he/she needs to fill in the missing field and does not trigger the bulk update. Otherwise the same button, if all the fields were properly filled in, should trigger the bulk update.

  • Steps: Currently I've tried to create a JS query has follows:
    image
    but when adding it to the button's event handler it does not work, because I already have there and event handler to show a modalframe.
    I've also tried to add the JS script here but it doesn't work.
    image

Hey @HelderSantos,

The approach I would take is using the "Advanced" section of your bulk update query and do the following:

1- Have a JS query that returns true if user hasn't filled in one of the two editable fields
2- Refer to the JS query result in the "Disable query" option within the advanced section of the query, and add the error message, "e.g. Revision status cannot be empty for any record".

If you have several messages depending on the fields that have not been filled, then you could actually return both true/false value and the message you want to display within your JSQ query (depending the logic and rules you define) and reference both of them that your query's advance settings. This way you can dynamically inform the user which fields are empty and change the message that the query shows.

If the disable message from your query doesn't fit your user case, you can program your modal in the same way, you can use the "Only run when" and add your JS true/false value there so it will only open the model when true.

1 Like