TouchWorks Error when Prescribing Meds - 'documentElement' is null or not an object
TouchWorks encounters an error when you go to prescribe a medication. Before going any further, this issues is caused by ampersands in the Allergen Reaction dictionary – check to see if there are any entries in that dictionary (using SQL or searching in SA – make sure to Match on “Any part of field” in SA). If there aren’t any entries like this, this article does not apply to you. If there are entries like this, continue on…
If the error occurs using the following workflow, this article may be applicable to your issue:
1) Open a patient chart
2) Go to New Rx
3) Search for a medication (or just use the favorites)
4) Click the medication you would like to use
5) Error occurs
Go into the details of the error. If you see something like the attached screenshot you likely have this issue. Look for “'documentElement' is null or not an object” in the second text box and “<ITEM ID="Stack Info"><ID>Stack Info</ID><CallStack>DURCheckPAR called by onFavMe…” in the second to last text box.
This issue comes up as a result of the Allergen Reaction dictionary (Works.dbo.Allergen_Reaction_DE) has entries an ampersand (&) in the name, and those entries are tied to a medication allergy for the medication that is being prescribed.
Remove the ampersands from the Allergen Reaction dictionary. A way to automate this is write a sql script something along these lines. You will need to be careful about the casing – if the entries are all caps, the and should be “AND” where as with normal casing of the name the and should be “and”. For example, Anxiety & Tremor should go to Anxiety and Tremor, where as ANXIETY & TREMOR should go to ANXIETY AND TREMOR.
Here are some example SQL statements to use. Only use them if you understand what they do! You’ll need to review all the entries that you are updating to make sure the updates make sense!
UPDATE Allergen_Reaction_DE SET EntryName = replace(EntryName, '&', 'and') WHERE EntryName like '%&%' UPDATE Allergen_Reaction_DE SET EntryName = replace(EntryName, '&', 'AND') WHERE EntryName like '%&%'