My IPeople

Community discussion for IPeople products and services
Welcome to My IPeople Sign in | Help
in
Home Blogs Forums

How to Send Emails from a CDS for CS Customers

Last post 03-10-2009, 2:28 PM by Brian. 0 replies.
Sort Posts: Previous Next
  •  03-10-2009, 2:28 PM 705

    How to Send Emails from a CDS for CS Customers

    You can send Emails from a CDS in CS but you must have the Meditech Parameters set up to use either SMTP or MAPI protocols.

    Here are the steps for sending an email if you have these parameters set up:

    1)    Create an NPR Report called MIS.USER.zcus.ip.email with any Report Title you like and Active set to Y.  Then File and Translate
        the Report.  You can name the report whatever you like, just make sure to make note of the name.

    2)    Create a Macro called email with the following code:

    "TO USER"^TO,
    "FROM USER"^FROM,
    IF{IF{@MIS.PARAM.mail.protocol^X="SMTP"^SMTP;X="MAPI"^MAPI}_.=.;
       IF{MAPI '@UNV.USER.mail.address.data[FROM];
          "Y"'=@MIS.USER.mail.send[FROM];
          '@MIS.USER.mail.address[FROM]};
       KILL(RCP),
       IF{IF{SMTP IF{"Y"=@MIS.USER.mail.receive[TO] %MIS.USER.mail.address[TO]}^X} @GET.SMTP.RECIPIENT;
          IF{MAPI @UNV.USER.mail.address.data[TO]} @GET.MAPI.RECIPIENT},
       +RCP[""]_.=.;
       IF{MAPI "";@MIS.USER.mail.address[FROM];FROM}^FROM,
       @ADD.HEADER.TO.MAIL,
       %Z.mail(^/MSG,"RAF",^RCP,"SUBJECT LINE","",FROM)^X_.=. @W.return("EMail sent!");
       @W.err("Could not send EMail:",X)};

    ADD.HEADER.TO.MAIL
    "LINE 1"_@Z.cr.lf^/MSG[1],
    "LINE 2"_@Z.cr.lf^/MSG[2],
    "LINE 3"_@Z.cr.lf^/MSG[3]

    GET.SMTP.RECIPIENT
    X^RCP[1]

    GET.MAPI.RECIPIENT
    M(@UNV.USER.mail.address.data[TO],RCP)

    3)    Replace with "TO USER" with the mnemonic of the user from your MIS USER Dictionary.  Replace with "FROM USER" with the mnemonic of the user from your MIS USER Dictionary.   Modify the code in the Local Macro ADD.HEADER.TO.MAIL to show whatever text you want in the email.

    4)    File and Translate the Macro.

    5)    Add an Attribute to your CDS Query that looks like this:

        FCL1=IF{@.response="Y" %MIS.USER.zcus.ip.email.M.email("")}

    So if the response to the Query is Y, then the Report Macro 'email' from the Report MIS.USER.zcus.email will be executed.  This Report Macro will create and send your email.

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems