 
					
				
		
12-02-2015 03:40 AM
<import resource="classpath:/alfresco/templates/org/alfresco/import/alfresco-util.js">
//Get current associated node refs
var nodeRef = AlfrescoUtil.param('nodeRef', null);
var result = remote.connect("alfresco").get('/node/get-associations?nodeRef=' + nodeRef);
//Print array of nodeRefs
model.test = jsonUtils.toJSONString(result);
model.jsonModel = {
    services: [
        "alfresco/dialogs/AlfDialogService",
        "alfresco/services/DocumentService",
        "alfresco/services/SiteService",
        "alfresco/services/CrudService"
    ],
    widgets: [
      {
          id: "SET_PAGE_TITLE",
          name: "alfresco/header/SetTitle",
          config: {
              title: "Manage Associations"
          }
      },
        {
           id: "MY_DOCUMENT_FINDER",
           name: "alfresco/forms/Form",
           config: {
               okButtonLabel: "Ok",
               okButtonPublishTopic: "FORM_CONTENTS",
               widgets: [
                  {
                      id: "MY_WIDGET",
                      name: "example/widgets/MyWidget"
                  }, 
                  {
                      name: "alfresco/forms/controls/DocumentPicker",
                      itemKey: "nodeRef",
                      config: {
                          label: "Associated documents",
                          name: "document"
                      }
                  }
               ]
           }
        }
    ]
};
define(["dojo/_base/declare",
        "dijit/_WidgetBase",
        "alfresco/core/Core"
    ],
    function(declare, _Widget, Core) {
        return declare([_Widget, Core], {
           url : Alfresco.constants.URL_CONTEXT + "proxy/alfresco/node/get-associations",
           nodeRef : Alfresco.util.getQueryStringParameter('nodeRef'),
           
           /**
           *  Construct
           */
           constructor: function example_widgets_MyWidget__constructor(args) {
              
              var _this = this; 
              
                        //Subscribe to OK button (see screen shot)
              this.subscribe(args.pubSubScope + "FORM_CONTENTS", function(args){
                 
                                //Temp save by get
                 $.getJSON(_this.url, { nodeRef: _this.nodeRef, assocRef: args.document.join(',') }, function(r){
                                    //Data Saved
                });
              });
           }
        });
});
 
					
				
		
12-02-2015 07:35 PM
    {
        id: "MY_DOCUMENT_FINDER",
   name: "alfresco/forms/Form",
   config: {
             publishOnReady : [{
                 publishTopic: "ALF_ITEMS_SELECTED",
                 publishPayload : {
                          //Not sure if this is even correct, or what object it's expecting here
                 }
             }]
               …
        }
                …
12-03-2015 08:42 AM
 
					
				
		
12-05-2015 04:08 PM
…
{
              id: "MY_DOCUMENT_FINDER",
              name: "alfresco/forms/Form",
              config: {
                  okButtonLabel: "Ok",
                  okButtonPublishTopic: "FORM_CONTENTS",
                  widgets: [
                     {
                         id: "MY_WIDGET",
                         name: "example/widgets/MyWidget"
                     }, 
                     {
                         name: "alfresco/forms/controls/DocumentPicker",
                         itemKey: "nodeRef",
                         config: {
                             label: "Associated documents: " +  metadata.name,
                             name: "document",
                             
                             //Not working :(
                             value: associations //Array of nodeRefs
                         }
                     }
                  ]
              }
           }
12-07-2015 09:05 AM
 
					
				
		
12-07-2015 10:14 PM
["workspace:\/\/SpacesStore\/5007099b-1aad-4ceb-99c5-a0f558593dc7", "workspace:\/\/SpacesStore\/c0008b93-d189-4e2d-a35d-bb9ba1e1b160"]
 value = [
{"name": "One.pdf", "nodeRef": "workspace:\/\/SpacesStore\/5007099b-1aad-4ceb-99c5-a0f558593dc7", "fileType": "pdf", "modified": "2015-08-22 19:46:34", "modifier": "admin", "size": "1014 KB", "sitetitle": "Something", "siteid": "something"}, 
{"name": "Two.pdf", "nodeRef": "workspace:\/\/SpacesStore\/c0008b93-d189-4e2d-a35d-bb9ba1e1b160", "fileType": "pdf", "modified": "2015-08-21 23:22:57", "modifier": "admin", "size": "1014 KB", "sitetitle": "Something", "siteid": "something"}]
12-08-2015 11:57 AM
 
					
				
				
			
		
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.