How i get image from a record in the table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2022 10:36 AM
Hello. How i get image from a record in the table?
The problem is: get "current.image_field" to "delivery" to use in the business rule, to generate pdf, like this:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var html = current.html_template;
var tablename = 'x_577462_limpdocsf_tb7_3';
var targetTableSysId = current.getValue('sys_id');
var print_pdf = current.getDisplayValue('emitir_pdf');
var ano_numero_protocolo = current.getValue('ano_numero_protocolo') ;
var imagem = current.getDisplayValue('imagem'); //here is the question!
var data_atualizacao = current.sys_updated_on;
var numero_nota = current.getDisplayValue('ano_numero_protocolo');
var fileName = 'Nota n²' + numero_nota + data_atualizacao;
var a = html.replace('x_ano_numero_protocolo', ano_numero_protocolo);
var b = a.replace('x_emitir_pdf', print_pdf);
var c = b.replace('x_imagem', imagem);//here goes to put image
var v = new sn_pdfgeneratorutils.PDFGenerationAPI;
var result = v.convertToPDF(c, tablename, targetTableSysId, fileName);
current.update();
})(current, previous);
"var imagem = current.getDisplayValue('imagem');" not work.
So, what is the other way? Exist something like current.getImage('field') ?
Resolved, by other way.
Created field html, and get current, and after replace
var sys_id_imagem = current.imagem_html;
.
.
.
var c = b.replace('x_imagem', sys_id_imagem);
- Labels:
-
Command Line Interface
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2022 01:05 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2022 03:11 PM
Is there a variable named "imagem" on the form? current.getValue() will retrieve the sys_id of the image in the sys_attachment table if there is a variable named "imagem" on the form. If the image is an attachment to the form, it would not.