Search code examples
javascriptalfrescofreemarkeralfresco-sharealfresco-webscripts

How can i display content atributes using .ftl? Alfresco


I want to get attributes of a content using an ftl. Does anyone have an example or idea of ​​how to do it. thank you

Content Props Workflow Form


Solution

  • Get name (or other properties) of content using javascript - Alfresco

    var title;
    var unitPrice;
    
     Alfresco.util.Ajax.jsonGet(
         {
            url: Alfresco.constants.PROXY_URI_RELATIVE + "api/metadata?nodeRef=" + nodeRefContext + "&shortQNames=true" ,
            successCallback:
            {
               fn: function(response)
               {
                  if (response.json)
                  {
                     title=response.json.properties["cm:title"];
                     alert(title);
                     unitPrice=response.json.properties["art:unitPrice"];
                     alert(unitPrice);
                  }
               },
               scope: this
           },
       failureCallback:
           {
               fn: function(response)
               {
                  Alfresco.util.PopupManager.displayPrompt(
                  {
                     failureMessage: this.msg("message.failure")
                  });
               },
               scope: this
            }
         });
    

    reference link Get filename of workflow with javascript