How to add custom field in site?

cancel
Showing results for 
Search instead for 
Did you mean: 
vinutha
Member II

How to add custom field in site?

Hi

I need to add one extra field in create site form.Can anyone help me out please.

Regards

Vinutha M P

9 Replies
angelborroy
Alfresco Employee

Re: How to add custom field in site?

If you are using Alfresco 5.2, you can follow this instructions:

https://community.alfresco.com/community/ecm/blog/2016/11/23/create-and-edit-site-customization 

Hyland Developer Evangelist
vinutha
Member II

Re: How to add custom field in site?

Hi

Thanks for the reply, Using the above link i can add the extra field in create site but unable to store.Can you please help me out.

Regards

Vinutha M P

angelborroy
Alfresco Employee

Re: How to add custom field in site?

vinutha
Member II

Re: How to add custom field in site?

Hi

We have disable legacy mode and used aikau form,but it is not displaying in site edit form with value, only field is visible.I can only store.Kindly help for displaying.
 
Regards
Vinutha M P
vinutha
Member II

Re: How to add custom field in site?

Hi

We have disable legacy mode and used aikau form,but it is not displaying in site edit form with value, only field is visible.I can only store.Kindly help for displaying.
 
var siteService = widgetUtils.findObject(model.jsonModel, "id", "SITE_SERVICE");
if (siteService && siteService.config)
{
siteService.config.widgetsForEditSiteDialog = [
{
  id: "EDIT_SITE_FIELD_DEPTID",
  name: "alfresco/forms/controls/TextBox",
  targetPosition: "START",
  config: {
fieldId: "DEPTID",
label: "DeptId",
name: "DeptId",
description: "DeptId is the uniqueid for each site in DMS"
  }
},
               {
                    id : "EDIT_SITE_FIELD_TITLE",
                    name : "alfresco/forms/controls/TextBox",
                    config : {
                         fieldId : "TITLE",
                         label : "create-site.dialog.name.label",
                         name : "title",
                         requirementConfig : {
                              initialValue : true
                         },
                         validationConfig : [ {
                              validation : "maxLength",
                              length : 256,
                              errorMessage : "create-site.dialog.name.maxLength"
                         }, {
                              scopeValidation : true,
                              warnOnly : true,
                              validation : "validationTopic",
                              validationTopic : "ALF_VALIDATE_SITE_IDENTIFIER",
                              validationValueProperty : "title",
                              negate : true,
                              validateInitialValue : false,
                              validationResultProperty : "response.used",
                              errorMessage : "create-site-dialog.title.already.used"
                         } ]
                    }
               },
               {
                    id : "EDIT_SITE_FIELD_DESCRIPTION",
                    name : "alfresco/forms/controls/TextArea",
                    config : {
                         fieldId : "DESCRIPTION",
                         label : "create-site.dialog.description.label",
                         name : "description",
                         validationConfig : [ {
                              validation : "maxLength",
                              length : 512,
                              errorMessage : "create-site.dialog.description.maxLength"
                         } ]
                    }
               },
               {
                    id : "EDIT_SITE_FIELD_VISIBILITY",
                    name : "alfresco/forms/controls/RadioButtons",
                    config : {
                         fieldId : "VISIBILITY",
                         label : "create-site.dialog.visibility.label",
                         name : "visibility",
                         optionsConfig : {
                              fixed : [
                                        {
                                             label : "create-site.dialog.visibility.public",
                                             description : "create-site.dialog.visibility.public.description",
                                             value : "PUBLIC"
                                        },
{
                                             label : "create-site.dialog.visibility.moderated",
                                             description : "create-site.dialog.visibility.moderated.description",
                                             value : "MODERATED"
                                        },
                                        {
                                             label : "create-site.dialog.visibility.private",
                                             description : "create-site.dialog.visibility.private.description",
                                             value : "PRIVATE"
                                        }
                                         ]
                         }
                    }
               } ];
  siteService.config.widgetsForCreateSiteDialogOverrides = [{
  id: "CREATE_SITE_FIELD_DEPTID",
  name: "alfresco/forms/controls/TextBox",
  targetPosition: "START",
  config: {
fieldId: "DEPTID",
label: "DeptId",
name: "DeptId",
description: "DeptId is the uniqueid for each site in DMS"
  }
]; 
}
Regards
Vinutha M P
angelborroy
Alfresco Employee

Re: How to add custom field in site?

Probably you need to adapt /modules/edit-site Web Script also.

Hyland Developer Evangelist
vinutha
Member II

Re: How to add custom field in site?

Hi

If  it is a legacy mode, then i would have used the below code edit-site.get.js
model.deptId = site.getCustomProperty("{http://www.alfresco.org/model/sitecustomproperty/1.0}solId");
edit-site.get.ftl
${ deptId  .value}
But what about aikau format, how to get the value and display in edit form..
Since i'm new to alfresco kindly help.
Regards
Vinutha M P
vinutha
Member II

Re: How to add custom field in site?

Hi
I did this in share/modules/edit-site.js 
var site = siteService.getSite("site-four");
var customProperty = site.getCustomProperty("{http://www.alfresco.org/model/sitecustomproperty/1.0} deptId ");
this.widgets. deptId = customProperty.value;

But still i'm facing the same issue, could not display the value.
Kindly help onTemplateLoaded function.
Regards
Vinutha M P
vinutha
Member II

Re: How to add custom field in site?

Hi

i did changes in edit-site.min.js also for testing i'm using site-four in getSite method

var site = siteService.getSite("site-four");
var customProperty = site.getCustomProperty("{http://www.alfresco.org/model/sitecustomproperty/1.0} deptId ");
this.widgets. deptId = customProperty.value;

But still i'm facing the same issue, could not display the value.
Kindly help onTemplateLoaded function.
Regards
Vinutha M P