#3289 - Unable to retrieve fields for some Modules...
The extract_vars template seems to work fine for all our Modules. For some Modules, I can embed the field codes in a Word template and they work fine. For others, I either get the field code back, or a blank. I have reduced the test to a single field code and the same applies.
Very frustrated indeed!
4 years ago
Hello,
I can understand your frustration and will try to assit you in making the templates if not easier, at least more consistent. The problem you are facing is that you are using (probably) Microsoft Word to create the templates. This is the best way to preview your template as close as posssible to the final version. However when you do, common actions like copy/paste, setting borders, using the spell checker or even just typing the text; Word will try and "assist" you by automatically adding formatting to the generated code (for your display). This code "breaks" the expected variable format ( [contacts.last_name] for exemple ) that you can find in the documentation or the extract vars template file.
Here are some tips to help you create templates and manage variables :
If you have any questions, i will be glad to assist you.
Kind regards, Synolia Support
4 years ago
Thanks for the quick reply.
So can I prove the codes work by using a plain text file? This would be very useful...
Kind regards,
Jonathan
4 years ago
Hello,
Use the plain text editor to create your variable. Usually when you type [ in Word it will automatically add a space after to make the text "normalized". And this behaviour breaks the variables. Write in your text editor the whole variable and when you paste it in Word it should keep the same format ( without the extra empty space after[ ). Also, try and paste it without any formatting (option of Word).
Hope this helps.
Kind regards, Synolia Support
4 years ago
Hello.
Thanks. I understand very clearly the principle of using a text editor to produce plain text, which is then pasted as unformatted text into the Word document.
My question was: is it possible to use a plain text file to retrieve field values, rather than using a Word file? If so, I could use VBA to extract the responses from the query and insert them into the final target document. I believe this would be easier than spending hours trying to persuade Word to not interfere with the formatting.
Is it possible to write SQL queries to query the database behind Sugar directly?
Thanks again.
4 years ago
Hello,
Unfortunately, you cannot use a plain text file as a template. The module uses the library OpenTBS for the generation of the documents and the way it is implemented it only works with Microsoft Word and Open Office document formats. If you just want the raw data, you can use a Excel sheet. to extract your data The module is compatible with .xlsx files. Once the file generated you can just copy/paste the values in your final document. The same rules apply though, be careful at the auto-formatting in Excel too.
If you have any questions, I'll be glad to be of assistance.
Kind regards, Synolia Support
4 years ago
Hello,
It is possible to access the database (or the data in general anyway) via SOAP or REST API calls. You can find more info here : SugarCRM Web Services
Kind regards, Synolia Support