Advertisement
EvaldoMaciel

displayFields

May 25th, 2020
1,514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function displayFields(form, customHTML) {
  2.     var numSolicitacao = getValue("WKNumProces");
  3.     var atividade = getValue("WKNumState");
  4.     var WKNumProces = getValue("WKNumProces");
  5.     var FORM_MODE = form.getFormMode();
  6.     var usuarioLogado = getValue("WKUser");
  7.     var fluigMobile = form.getMobile();
  8.  
  9.     var dadosUsario = consultaUsuario(usuarioLogado);
  10.  
  11.     var nomeUsuario = dadosUsario.nome;
  12.     var emailUsuario = dadosUsario.mail;
  13.  
  14.     form.setValue("numSolicitacao", numSolicitacao);
  15.     customHTML.append("\n<script>function getUser(){ return '" + getValue("WKUser") + "'; }</script>");
  16.     customHTML.append("\n<script>function getUserName(){ return '" + nomeUsuario + "'; }</script>");
  17.     customHTML.append("\n<script>function getUserMail(){ return '" + emailUsuario + "'; }</script>");
  18.  
  19.     // Trabalhando com campos personalizados
  20.     customHTML.append("\n<script>\n");
  21.     if (atividade == 0 || atividade == 4) {
  22.         customHTML.append('\n $("usuarioLogado").val(' + usuarioLogado + ');');
  23.         customHTML.append('');
  24.     }
  25.     customHTML.append("\n</script>\n");
  26.  
  27. }
  28.  
  29. function getData() {
  30.     var data = new Date();
  31.     var dia = data.getDate();
  32.     var mes = data.getMonth() + 1;
  33.     var ano = data.getFullYear();
  34.     dia = (dia <= 9 ? "0" + dia : dia);
  35.     mes = (mes <= 9 ? "0" + mes : mes);
  36.     var novaData = ano + "/" + mes + "/" + dia;
  37.     return novaData;
  38. }
  39.  
  40.  
  41. function consultaUsuario(usuario) {
  42.     var c1 = DatasetFactory.createConstraint("colleaguePK.colleagueId", usuario, usuario, ConstraintType.MUST);
  43.     retorno = DatasetFactory.getDataset('colleague', null, new Array(c1), null);
  44.  
  45.     for (var i = 0; i < retorno.rowsCount; i++) {
  46.         var nomeUsuario = retorno.getValue(i, "colleagueName");
  47.         var email = retorno.getValue(i, "mail");
  48.     }
  49.  
  50.     var newObject = new Object();
  51.     newObject.nome = nomeUsuario;
  52.     newObject.mail = email;
  53.     return newObject;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement