-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76cd281
commit f21d6a6
Showing
2 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<html> | ||
<head> | ||
<title>Fluig</title> | ||
<link href="${SERVER_URL}/globalmailsender/resources/global.css" type="text/css" rel="stylesheet" /> | ||
</head> | ||
<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"> | ||
<div align="left"> | ||
<table cellspacing="0" cellpadding="0" border="0"> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<img src="${SERVER_URL}/portal/resources/images/logo.png"> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
<br /> | ||
<div align="left"> | ||
<table cellspacing="0" cellpadding="0" border="0"> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<p class="DescrMsgForum">Olá! <b>${NOME_SOLICITANTE}</b></p> | ||
<p class="DescrMsgForum">A sua solicitação <b>${NUMERO_SOLIC}</b> para <b>cadastrar</b> o cliente <b>${COD_CLIENTE} - ${DESCR_CLIENTE}</b> foi concluída.</p> | ||
<p class="DescrMsgForum">Clique <a href="${SERVER_URL}/portal/p/${CODIGO_EMPRESA}/pageworkflowview?app_ecm_workflowview_detailsProcessInstanceID=${NUMERO_SOLIC}" class="LinkAcao">aqui</a> para acessar a solicitação.</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<p class="DescrMsgForum">Atenciosamente,<br>Equipe Fluig.</p> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> </td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<br /> | ||
</div> | ||
|
||
<#if anexos??> | ||
<div align="left"> | ||
<table cellspacing="0" cellpadding="0"> | ||
<thead> | ||
<tr> | ||
<th class="DescrMsgForum">Anexos</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<#list anexos as anexo> | ||
<tr> | ||
<td> | ||
<a href="${anexo.link}" class="LinkAcao">${anexo.description}</a> | ||
</td> | ||
</tr> | ||
</#list> | ||
</tbody> | ||
</table> | ||
</div> | ||
</#if> | ||
</body> | ||
</html> |
51 changes: 51 additions & 0 deletions
51
workflow/scripts/protheus_cadastro_clientes.enviarEmail.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
function enviarEmail() { | ||
/* Documentação de email personalizado | ||
* https://tdn.totvs.com/pages/releaseview.action?pageId=183730587 | ||
*/ | ||
|
||
try{ | ||
var empresa = fluigAPI.getSecurityService().getCurrentTenantId(); | ||
var server = fluigAPI.getPageService().getServerURL(); | ||
var usuario = hAPI.getCardValue("txt_solicitante"); | ||
var num_solic = getValue("WKNumProces"); | ||
var template = "TPL_WF_CADASTRO_CLIENTE"; | ||
var remetente = "treinamento.aluno"; | ||
var cod_cliente = hAPI.getCardValue("txt_cod_cliente"); | ||
var descr_cliente = hAPI.getCardValue("txt_nome_cliente"); | ||
|
||
var assunto = "Solicitação "+ num_solic + " - Criação do centro de custo - " + cod_cliente + " " + descr_cliente; | ||
|
||
var parametros = new java.util.HashMap(); | ||
|
||
parametros.put("SERVER_URL", server); | ||
parametros.put("NOME_SOLICITANTE", usuario); | ||
parametros.put("NUMERO_SOLIC", num_solic); | ||
parametros.put("subject", assunto); | ||
|
||
parametros.put("COD_CLIENTE", cod_cliente); | ||
parametros.put("DESCR_CLIENTE", descr_cliente); | ||
parametros.put("CODIGO_EMPRESA", empresa); | ||
|
||
var docs = hAPI.listAttachments(); | ||
// Se existir Anexo | ||
if(docs.size() > 0){ | ||
var anexos = new java.util.ArrayList(); | ||
for (var i = 0; i < docs.size(); i++) { | ||
var doc = docs.get(i); | ||
var anexo = new java.util.HashMap(); | ||
anexo.put("link", fluigAPI.getDocumentService().getDownloadURL(doc.getDocumentId())); | ||
anexo.put("description", doc.getDocumentDescription()); | ||
anexos.add(anexo); | ||
} | ||
|
||
parametros.put("anexos", anexos); | ||
} | ||
|
||
var destinatarios = new java.util.ArrayList(); | ||
destinatarios.add(hAPI.getCardValue("txt_solic_email")); | ||
|
||
notifier.notify(remetente, template, parametros, destinatarios, "text/html"); | ||
}catch(e){ | ||
log.error("Erro ao enviar email: " + e); | ||
} | ||
} |