Hi,
What is the expected behavior of deleteAllRecords() if there are no records in the foundset to delete?.. Should I get a java.lang.NullPointerException error?.
I have the following, I can easily check for records before deleting, but am curious why the same code in version 5.2 gave no error but since upgrading to 7.3 I have a Error…
That way, you are only deleting records if there are any, and if they explicitly match your search criteria.
A couple of other observations:
Using “===” instead of “==” ensures and exact match and avoids javascript coercion (tries to convert it into a suitable type). In JavaScript world, coercion is considered a sort of evil and can produce unexpected results. Maybe not necessary when checking a uuid, but consider that if(false == 0), if(true == 1) and if(1 == “1”) are all true because of coercion, but if(false === 0), if(true === 1) and if(1 === “1”) are all false. Just a good habit to get into and avoid unexpected results in the future.
Always end your statements with the “;”, otherwise Javascript will use automatic insertion where it guesses the semi-colon should go. Again, you can get unexpected results that are hard to track down. Good habits avoid headaches.
More tips in my tutorials at my website if you are interested.