| 
 è possibile indicare fra i destinatari dell'alert anche: 
- un cliente/fornitore
 - una risorsa dell'organizzazione del cliente/fornitore avente un determinato ruolo
 
 
Per indicare fra i destinatari un cliente/fornitore inserire la parola chiave CONTO, per indicare fra i destinatari la risorsa avente un determinato ruolo all'interno dell'organizzazione di un cliente/fornitore, inserire la parola chiave CONTO seguita da / e dal codice del ruolo. Per esempio: 
davide;gian;roby;CONTO;CONTO/RACQ;CONTO/PROD; 
- 3 operatori interni: Roby, Gian, Davide (indirizzo e-mail dalla organizzazione interna della azienda)
 - 1 cliente/fornitore (indirizzo e-mail dalla loro anagrafica)
 - 2 risorse del cliente/fornitore (RACQ responsabile acquisti, PROD responsabile produzione, indirizzi e-mail dalla organizzazione del cliente/fornitore)
 
 
La risoluzione della parola chiave CONTO, avverrà nel codice al momento del riempimento del recordset disconnesso dynMsgoutParam che adesso contiene un nuovo parametro strConto di tipo stringa. Se il parametro non è settato assumerà il valore di default = 0 (nessun conto), altrimenti bisognerà assegnare il codice del conto voluto. Per esempio se il cliente/fornitore fosse il cliente "Rossi Gilbo", avente conto "4010001" la riga di codice dovrebbe essere scritta così: dynMsgoutParam("strConto") = "4010001". 
NB: se si indica un CONTO e manca il codice cliente non viene inviato nulla. Il CONTO è utilizzato solo per e-mail, non popup. Se è indicato CONTO/ruolo ma non sono presenti ruoli nell'anagrafica del cliente uguale a quello impostato, oppure non c'è nessun ruolo con indirizzo e-mail impostato viene inviato il messaggio all'indirizzo e-mail generico del cliente. Se sono presenti più operatori appartenenti al ruolo a cui inviare l'e-mail nell'anagrafica del cliente viene inviata l'e-mail a tutti. 
E' possibile rendere l'oggetto dell'e-mail parametrico mediante i marcatori [#RAGSOC], [#CONTO] e [#DATA] che Business sostituisce rispettivamente con ragione sociale, conto del cliente/fornitore indicato nel parametro strConto del datatable degli alert da generare e data esecuzione dell'alert. 
Esempio 1 Creazione di un alert .NET con script .NET su procedura
 
Creare ad esempio l'alert sotto 99998 
 
 
creare la procedura 99998, con la spunta di procedura .NET 
 
 
e compilarla come segue 
 
 
   Function ProvaAlert(ByRef oApp As CLE__APP, ByVal strCodditt As String, _
                      ByRef dttMsgOutParam As DataTable) As Boolean
    Try
      dttMsgOutParam.rows.add(dttMsgOutParam.newrow())
      If strCodditt.trim <> "" Then
        dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!codditt = strCodditt
      Else
        dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!codditt = oApp.Ditta
      End If
      dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!strMsg = "Testo di prova email"
      'serve solo se deve essere mandata una e-mail al cliente
      dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!strConto = "4010001"
      dttMsgOutParam.AcceptChanges()
      Return True
    Catch ex As Exception
      Throw (New NTSException(GestError(ex, Me, "", oApp.InfoError, "", False)))
      Return False
    End Try
  End Function 
Esempio 1bis Creazione di un alert .NET con script .NET su procedura
 
Sempre inerente all'esempio sopra, volendo mandare una mail non ad un cliente specifico, ma a diversi la procedura da realizzare sarà: 
   Function ProvaAlert(ByRef oApp As CLE__APP, ByVal strCodditt As String, _
                    ByRef dttMsgOutParam As DataTable) As Boolean
    Try
    Dim strSQL As String = ""
    Dim dttTmp As New DataTable
    Dim oCldBase As New CLD__BASE
    Dim strMsg As String = ""
    Dim i As Integer = 0
    strSQL = "SELECT * FROM anagra WHERE an_tipo='C' and (not (an_email is null))"
    'MsgBox(strSQL)
    oCldBase.Init(oApp)
    dttTmp = oCldBase.OpenRecordset(strSQL, NTSInformatica.CLE__APP.DBTIPO.DBAZI)
    If dttTmp.Rows.Count > 0 Then
      'ho trovato dei clienti
      For i = 0 To dttTmp.Rows.Count - 1
        dttMsgOutParam.rows.add(dttMsgOutParam.newrow())
        If strCodditt.trim <> "" Then
          dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!codditt = strCodditt
        Else
          dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!codditt = oApp.Ditta
        End If
        dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!strMsg = "Visita il nostro sito."
        dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!strConto = dttTmp.Rows(i)!an_conto
        dttMsgOutParam.AcceptChanges()
      Next
    End If
    Return True
    Catch ex As Exception
      Throw (New NTSException(GestError(ex, Me, "", oApp.InfoError, "", False)))
      Return False
    End Try
  End Function 
Esempio 2 Creazione di un alert .NET con script .NET su file script esterno
 
Creare ad esempio l'alert sotto 99999 
 
 
creare la procedura 99999 
 
 
e compilarla come segue 
 
 
 FILE:BE__PROVAALERTNET.NTS
FUNCTION:ProvaAlert 
Il codice sotto va poi inserito all'interno del file di script BE__PROVAALERTNET.NTS, da copiare nella Bus\Script del server. 
 <nts>
 <reference assembly="BD__BASE.dll" /> 
<scriptCode><![CDATA[ 
Imports Microsoft.VisualBasic
 Imports System
 Imports System.Collections.Generic
 Imports System.Data
 Imports NTSInformatica.CLN__STD
 Imports NTSInformatica
 Imports NTSInformatica.CLD__BASE 
Public Class BE__PROVAALERTNETVBS 
     Implements INT__SCRIPT 
  Public Function Exec(ByVal strCommand As String, ByRef oApp As Object, ByRef oIn As Object, _
                        ByRef oParam As Object) As Object Implements INT__SCRIPT.Exec
     Try
       If strCommand.ToUpper = "PROVAALERT" Then
         Return ProvaAlert(CType(oApp, CLE__APP), CType(oIn, String), CType(oParam, DataTable))
       End If
       Return True
     Catch ex As Exception
       Throw (New NTSException(GestError(ex, Me, "", oApp.InfoError, "", False)))
       Return False
     End Try
   End Function 
  Function ProvaAlert(ByRef oApp As CLE__APP, ByVal strCodditt As String, _
                       ByRef dttMsgOutParam As DataTable) As Boolean
     Try
       dttMsgOutParam.rows.add(dttMsgOutParam.newrow())
       If strCodditt.trim <> "" Then
         dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!codditt = strCodditt
       Else
         dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!codditt = oApp.Ditta
       End If
       dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!strMsg = "Testo di prova email"
       'serve solo se deve essere mandata una e-mail al cliente
       dttMsgOutParam.rows(dttMsgOutParam.rows.count - 1)!strConto = "4010001"
       dttMsgOutParam.AcceptChanges()
       Return True
     Catch ex As Exception
       Throw (New NTSException(GestError(ex, Me, "", oApp.InfoError, "", False)))
       Return False
     End Try
   End Function 
End Class]]> 
</scriptCode>
 </nts> 
Per provare gli script crati e possibile farlo tramite l'apposito programma di esecuzione alert: 
 
 
 
 
 
 
al momento dell'effettivo invio potrebbe comparire la finestra sotto da confermare 
 
 
a questo punto le due e-mail sono inviate 
 
 
 |