Quick question that I think I already know the answer to: Can we dynamically lock/restrict (red key) documents through MEL code? We have some forms that will need to be locked based on the data that's entered (42 CFR/SUDS stuff).
Alternatively, is there MEL code to check on the status of a document? Like if the form has SUDS info, the code can check if the document has been locked and throw an error message if it hasn't been?
Currently, our only solution is to just lock the entire encounter by default, regardless of how it's being used, but that's obviously not ideal.
You can limit input and display in forms by user or usertype. You could setup a visibility region so if a prohibited user opens the form it will appear blank. You could try something like this:
{!
fn limitByUser(fieldNum,value)
{
info = GETUSERINFO(USER.LOGINNAME)
infoArray = getfield(info,"^","")
//was a value provided?
if (value == "") then
return("Error. No value provided.")
else
""
endif
//was a field number provided provided?
if (fieldNum == "") then
check = infoArray[6]
else
check = infoArray[fieldNum]
endif
if match(check,1,value)>0 then
return "true"
else
return "false"
endif
}}
This call it like this:
{fn limitByUser("6","Physician")}
This would limit the region to users with the physician role only.
Brad
This isn't quite what I'm looking for, but thanks.
When you start an encounter, there are confidentiality types you can set for a document. If you select "Normal", the document is visible in the chart to any user. We have one set up for "Alcohol and Drug", and if that one is selected, only users who have permission to view "Alcohol and Drug" related documents can view them in the chart. To those users, the documents will have a red key next to them in the chart. Users without those permissions won't see any evidence that the document even exists in the chart.
I was hoping to find a way to use code to make this change. I don't think you can, but I figured if anyone did, they would be here!
I don't think you can limit specific documents per MEL. The code I showed above would give you some options so you could let all users see a document, but turn off some or all of a form by user or user type. But then again, you run into the problem of all users can see the flow sheet. So I'm not sure if there is a really complete way to manage this.