ISLetter.AddCCRecipient

Description

This function adds a CC recipient to the letter.

Syntax

object.AddCCRecipient()

Part Attribute Type Description
object Required
The object always implements the ISLetter interface

Return Value

ISLetterRecipient

Returns the added CC recipient.

Example

Add a CC recipient to the patient's letters and display some information about them.

sub main
  Dim aPatient
  Dim aLetters, aLetter
  Dim aMainRecipient
  Dim aNewCCProvider
  Dim aAlreadyExists
  Dim aCCRecipients, aCCRecipient
  Dim i
  Dim aMessage

  Set aPatient = Profile.SelectPatient
  set aLetters = aPatient.GetLetters (1) ' slcfWordRTF

  aMessage =_
    "The number of the letters of the selected format is " & aLetters.Count

  set aNewCCProvider = Profile.LoadProvider("ADMIN")
  for i = 0 to aLetters.Count - 1
    set aLetter = aLetters.Item(i)   
    
   aAlreadyExists = false 
   for each aCCRecipient in aLetter.CCRecipients
     if aCCRecipient.ProviderId = aNewCCProvider.Id then aAlreadyExists = true 
   next  
   
   if not aAlreadyExists then 
      set aCCRecipient = aLetter.AddCCRecipient
      aCCRecipient.ProviderId = aNewCCProvider.Id
    end if  
  next

  for i = 0 to aLetters.Count - 1
    set aLetter = aLetters.Item(i) 
    aMessage = aMessage & vbNewLine & "---------------" & vbNewLine &_
      "Letter Date: " & aLetter.Date & vbNewLine &_
      "Letter Subject: " & aLetter.Subject2 & vbNewLine  

    set aMainRecipient = aLetter.MainRecipient  
    if not aMainRecipient is nothing then                              
       aMessage = aMessage & vbNewLine &_
          "Main Recipient: " & vbNewLine & GetLetterRecipientInfo(aMainRecipient)      
    end if 

    aMessage = aMessage & vbNewLine & "CC Recipients: "   
    set aCCRecipients = aLetter.CCRecipients
    for each aCCRecipient in aCCRecipients
      aMessage = aMessage & vbNewLine & GetLetterRecipientInfo(aCCRecipient) 
    next  
  next

  Profile.MsgBox(aMessage)
end sub

function GetLetterRecipientInfo(aRecipient)
  Dim aProvider
  Dim aExtProvider
  Dim aPatient
  Dim aPOS
  Dim aInfo
  Dim aLetter

  aInfo = vbNewLine &_
    "  Recipient Type: " & aRecipient.RecipientType & vbNewLine &_
    "  Is Main: " & aRecipient.IsMainRecipient & vbNewLine
    
  if aRecipient.ProviderId > 0 then
    set aProvider = Profile.LoadProviderById(aRecipient.ProviderId) 
    aInfo = aInfo & "  Provider: " & aProvider.FullName & vbNewLine 
  end if
    
  if aRecipient.ExternalProviderID > 0 then 
    set aExtProvider = Profile.LoadExternalProviderById(aRecipient.ExternalProviderID)
    aInfo = aInfo & "  External Provider: " & aExtProvider.FullName & vbNewLine 
  end if 
    
  if aRecipient.PatientId > 0 then
    set aPatient = Profile.LoadPatient(aRecipient.PatientId)
    aInfo = aInfo & "  Patient: " & aPatient.SurnameFirstName & vbNewLine  
  end if
    
  if aRecipient.PosID > 0 then
    set aPOS = Profile.LoadProviderById(aRecipient.PosID) 
    aInfo = aInfo & "  Pos: " & aPOS.FullName & vbNewLine 
  end if

  GetLetterRecipientInfo = aInfo
end function
Note:

In Profile Client v8 on User Interface CC Recipients can be found and added in Clinical > Medical Record > Documents > Open saved document > Information and Recipients > Copies to or in Organisation > Work Centre > Communication > Letters > Open saved document > Information and Recipients > Copies to.

Version information

Added in v7.8.0