Can someone remind me how to send a flag to multiple users with MEL_SEND_FLAG. I've done it before but can't remember the syntax.
If you want to send to multiple users I think the easiest way would be to make an array of usernames and loop through sending to each. The syntax from the help file is below:
MEL_SEND_FLAG
description Sends a new flag or care alert to a given user's desktop. type data symbol function syntax MEL_SEND_FLAG (Type, To, Priority, Due date, Subject, Message, Chart_tab, Expiration date) arguments
when to evaluate When inserted returns An error if the flag cannot be sent to a selected user. An error if the flag cannot be set to a given location (chart, appointment, registration) . comment Flags can only be sent concerning the patient with an update currently open. examples {MEL_SEND_FLAG("Flag","hwinston","Urgent","08/15/2007","Flu Vax due","Patient high risk for flu, schedule to come in for Flu vaccine","summary", "")} {MEL_SEND_FLAG("Flag", "hwinston", "Normal", str(._todaysdate), "Flu Vax due", "Patient should schedule to come in for Flu vaccine", "summary", "")} where used Chart: letter and handout templates, text components, chart notes, and quick text Encounter Form Editor: MEL expressions |
fn fnSendFlag()
{
local username = array("user1","user2","user3") // create array of user logins
//create a loop to send the flag to each user in the array
for i = 1, i <= size(username), i = i + 1 do
//this is the example mel_send_flag from the help file with
//the username array value inputted.. change other values as needed
MEL_SEND_FLAG("Flag", username[i], "Normal", str(._todaysdate), "Flu Vax due", "Patient should schedule to come in for Flu vaccine", "summary", "")
endfor
}
Here is what I have for the function:
fn fnSendFlag(){
local username = array("cliffords","roses123","anthonyp","luisanao") // create array of user logins
//create a loop to send the flag to each user in the array
for i = 1, i <= size(username), i = i + 1 do
//this is the example mel_send_flag from the help file with
//the username array value inputted.. change other values as needed
MEL_SEND_FLAG("Flag", username[i], "Urgent", str(._todaysdate), "--Dietitian Referral", "A patient that qualifies for a dietitian referral was just seen. Please schedule an appointment", "Orders", "")
MEL_ADD_ORDER("T", "Dietitian Referral", "Referral to Dietitian", "", "ICD-250.1", "Diabetes", "", "", "", "", "")
endfor
}
Here is what I have for the button:
{fnSendFlag()}
It sends to the first person in the array but not the rest.
Thank you Brad for all your help. The script was correct BUT all the usernames have to be correct 🙂
What's weird is... I looked up the loginnames in the SQL server and one was incorrect with what's in Active Directory. After changing it to the one listed in Active Directory, everything worked fine.