Uploaded image for project: 'Nuxeo Studio'
  1. Nuxeo Studio
  2. NXS-5043

${docUrl} generates an invalid URL in Document templates

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Not A Bug
    • Affects Version/s: 73.24.5
    • Fix Version/s: None

      Description

      Steps to reproduce:

      • Browse to CONFIGURATION > Templates > Document Templates
      • Create a new template which includes this URL
        <a style="color:#22aee8;text-decoration:underline;word-wrap:break-word !important;" href="${docUrl}">${doc.title}</a></p><br/>
        
      • Create an automation script that use the template, e.g.
            var blob = Render.Document(
                docs[i], {
                  /*required:true - type: string*/
                  'template': 'template:expirationReminder',
                  /*required:false - type: string*/
                  'filename': '',
                  /*required:false - type: string*/
                  'mimetype': 'text/html',
                  /*required:false - type: string*/
                  'type': 'ftl'
                });
              
              if(blob){
                var html = blob.getString();
                var creator = docs[i].getProperty("dc:creator");
                
                Console.log("\t Creator: " + creator);        
                
                var user = User.Query(
                  null, {
                    /*required:false - type: string*/
                    'username': creator
                  }
                );
        
                if(user && user.properties && user.properties.email){
                  Console.log("\t User e-mail: " + user.properties.email);        
                  
                  Notification.SendMail(docs[i], {
                    "from": "ecm.study@gmail.com",
                    "message": html,
                    "subject": "[Nuxeo] Expiration reminder: " + docs[i].title,
                    "HTML": true,
                    "to": user.properties.email
                  });          
                }
              }
        
      • Deploy your changes
      • Do the action that execute the automation script
      • The e-mail is sent
      • The link generated is invalid. It looks like this:
        https://lamborghini.cloud.nuxeo.com/ui/#!/doc/default/265db593-1ca7-4dfe-8d80-0dbfbaafaa7e
        

      If you click on the link you get a 404 error.

      Full document template used in the test:

      <html>
        <body>
          <div style="margin:0; padding:0; background-color:#e9ecef;font-family:Arial,sans-serif;" marginheight="0" marginwidth="0">
            <center>
              <table cellspacing="0" cellpadding="0" border="0" align="center" width="100%" height="100%" style="background-color:#e9ecef;border-collapse:collapse; font-family:Arial,sans-serif;margin:0; padding:0; min-height:100% ! important; width:100% ! important;border:none;">
                <tbody>
                  <tr>
                    <td align="center" valign="top" style="border-collapse:collapse;margin:0;padding:20px;border-top:0;min-height:100%!important;width:100%!important">
                      <table cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;border:none;width:100%">
                        <tbody>
                          <tr>
                            <td style="background-color:#f7f7f7;border-bottom:1px dashed #e9ecef;padding:8px 20px;">
                              <p style="font-weight:bold;font-size:15px;margin:0;color:#000;">Nuxeo</p>
                            </td>
                          </tr>
                          <tr>
                            <td style="background-color:#fff;padding:8px 20px;"><br/>
                              <p style="margin:0;font-size:14px;">This document will be removed in a week: <a style="color:#22aee8;text-decoration:underline;word-wrap:break-word !important;" href="${docUrl}">${doc.title}</a></p><br/>
                            </td>
                          </tr>
                          <tr>
                            <td style="background-color:#f7f7f7;border-top:1px dashed #e9ecef;text-align:center;padding:8px 20px;">
                              <div style="font-size:12px;color:#bbb;">
                              You received this notification because you are the creator of this document or on one of its parents.</div>
                            </td>
                          </tr>
                        </tbody>
                      </table>
                    </td>
                  </tr>
                </tbody>
              </table>
            </center>
          </div>
        </body>
      <html>
      

        Attachments

          Activity

            People

            • Assignee:
              jgarzonpena Joaquin Garzon Pena
              Reporter:
              jgarzonpena Joaquin Garzon Pena
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: