by synolia

Create personalized MS Office or Open Office letters and documents from any Sugar module with one click. Define and create templates for any module and generate Office documents on any record and its related records. Great for mail merges and more!

Includes a 30 day guarantee
Try it Now

#3289 - Unable to retrieve fields for some Modules...

Closed Bug? created by JonathanGroves 2 years ago

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!

  1. synolia member avatar

    synolia Provider Affiliate

    2 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 :

    • Disable spell checker
    • Disable any formatting options from your editor
    • Instead of typing the variables, copy them from a notepad (or similar plain text editor) and paste them to your document, in full ( [contacts.last_name] for exemple )
    • Always set formatting on the whole variable ( this means from the [ character to the ] included), when changing font size, bold, italic, etc

    If you have any questions, i will be glad to assist you.

    Kind regards,
    Synolia Support

    • JonathanGroves member avatar

      JonathanGroves

      2 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

    • synolia member avatar

      synolia Provider Affiliate

      2 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

  2. JonathanGroves member avatar

    JonathanGroves

    2 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.

    • synolia member avatar

      synolia Provider Affiliate

      2 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

    • synolia member avatar

      synolia Provider Affiliate

      2 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

This case is public. Please leave out any sensitive information such as URLs, passwords, etc.
Saving Comment Saving Comment...

Keep up to date on the latest additions

We'll send you an email every month with handpicked add-ons, reviews, tricks and tips. Don't worry, we hate spam as much as you do.