daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Dec 17th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import ABSL as absl;
  2. import AP.FO.BusinessPartner.Global as BusinessGlobal;
  3. import AP.PlatinumEngineering as Platinum;
  4. import DocumentServices.Global as Document;
  5. import AP.Common.GDT as GDT;
  6.  
  7. var customer = Customer.Retrieve(this.CustomerID);
  8.  
  9. if (customer.IsSet()){
  10.     var currentCommon = customer.CurrentCommon;
  11.     var dateNow = Context.GetCurrentSystemDate();
  12.     //VERIFICAR SE É A DATA DE HOJE
  13.     if((this.CustomerLastActivationDate == dateNow) && !this.CustomerLastActivationDate.IsInitial()){
  14.         //VERIFICAR SE ESTÁ ATIVO MANUAL
  15.         if(!this.CustomerInactive){
  16.             //VERIFICAR SE ESTÁ ATIVO NO C4C
  17.             if(this.Status == "2"){
  18.                 //VERIFICAR SE O EMAIL ESTÁ CADASTRADO
  19.                 if(!this.CustomertEmail.content.IsInitial()){
  20.                     // PEGANDO PARAMETROS GERAIS
  21.                     var queryParams = BusinessObject::CommonParameters.QueryByElements;
  22.                     var params = queryParams.ExecuteDataOnly().GetFirst();
  23.                     var bodyInicial = params.SurveyBodyEmail;
  24.                     var headerInicial = params.SurveyHeaderEmail;
  25.                     //VERIFICAR SE TEM HEADER E BODY INICIAIS
  26.                     if(!bodyInicial.IsInitial() && !headerInicial.IsInitial()){
  27.                    
  28.                         var emailTo = this.CustomertEmail.content;
  29.                         var Receipients : EmailRecepientDataTable;
  30.                         var EmailReceipient : EmailRecepientData;
  31.                         var EmailFrom : GDT:EmailURI;
  32.                         var SentFromURL : XPEString;
  33.                         var Body : XPEStringTab;
  34.                         var Subject : XPEString;
  35.                         //Parametros gerais
  36.  
  37.                         var body = bodyInicial.content.Replace("#CUSTOMER#", this.CustomertName);
  38.                         Body.XPEString.Add(body);
  39.                         SentFromURL = SentFromURL.Concatenate("Este e-mail foi enviado por: ").Concatenate(Context.GetSystemURL());
  40.                         Body.XPEString.Add(SentFromURL);
  41.  
  42.                         //quem mandou
  43.                         EmailFrom.content = "naoresponder@fh.com.br";
  44.                         EmailReceipient.EmailRecepientTypeCode = "TO";
  45.  
  46.                         //EmailReceipient.EmailUri.content = emailTo;
  47.                         //destinatario
  48.                         EmailReceipient.EmailUri.content = "djalma.dissenha@fh.com.br";
  49.                         Receipients.EmailData.Add(EmailReceipient);
  50.                         var subject = headerInicial.content;
  51.                         Subject = subject; //Needs to be this type of data
  52.                         Mail.SendWithAttachment(Subject, Body, EmailFrom, Receipients, false);
  53.                         var t = "t2";
  54.                     }
  55.                 }
  56.             }
  57.         }
  58.     }
  59. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top