AnsweredAssumed Answered

Unexpected behaviour with window.open in record.js

Question asked by Axel Flores on Jul 6, 2015
Latest reply on Jul 31, 2015 by Norbert Groene
Hello everybody,

I've added a custom functionality that try to download some pdfs templates,that were created on the pdfs manager.
To do this i created a new button on the record.php file and modified the record.js file where i include the logic.
In this case the js file execute the window.open(url) function, which i use to download the pdf.

The record.js generate a url, like the following: 
https://demo.sugarondemand.com/*****/seed1/EnvDevMntr/index.php?action=sugarpdf&module=Contr_mntr_Contratos&sugarpdf=pdfmanager&record=e9cc561e-de89-b962-2183-559ab7895d75&pdf_template_id=undefined&data-action=download

I've seen an unexpected behaviour, sometime i get the pdf correctly, but some others the action doesn't download the pdf and open a new record view of the current record.

Does anyone have an idea what might be going?
I hope someone can help me to review this issue.

Thanks and regards.

Outcomes