Web Script: org/alfresco/components/profile/userprofile.post
Generated from /share/service/script/org/alfresco/components/profile/userprofile.post on Jun 13, 2026 9:39:05 PM

Script Properties
Id:org/alfresco/components/profile/userprofile.post
Short Name:User Profile Edit
Description:User Profile Edit POST form submission processing
Authentication:none
Transaction:none
Method:POST
URL Template:/components/profile/userprofile
Format Style:any
Default Format:json
Negotiated Formats:[undefined]
Implementation:class org.alfresco.web.scripts.DeclarativeWebScript
Extensions:[undefined]

Store: classpath:alfresco/site-webscripts

File: org/alfresco/components/profile/userprofile.post.desc.xml
<webscript>
  <shortname>User Profile Edit</shortname>
  <description>User Profile Edit POST form submission processing</description>
  <format default="json" />
  <url>/components/profile/userprofile</url>
</webscript>
File: org/alfresco/components/profile/userprofile.post.json.ftl
{
   "success": ${success?string}
}
File: org/alfresco/components/profile/userprofile.post.json.js
/**
 * User Profile Component Update method
 * 
 * @method POST
 */
 
function main()
{
   var names = json.names();
   if (names.length() == 1)
   {
      // found special case avatar noderef set
      // this value is already persisted to the repo via the uploader
      // so we just need to mirror the value in the user object properties
      var field = names.get(0);
      if (field.indexOf("-photoref") != -1)
      {
         var ref = json.get(field);
         if (ref != null && ref.length() != 0)
         {
            user.properties["avatar"] = ref;
         }
      }
   }
   else
   {
      for (var i=0; i<names.length(); i++)
      {
         var field = names.get(i);
         
         // look and set simple text input values
         var index = field.indexOf("-input-");
         if (index != -1)
         {
            user.properties[field.substring(index + 7)] = json.get(field);
         }
         // apply person description content field
         else if (field.indexOf("-text-biography") != -1)
         {
            user.properties["persondescription"] = json.get(field);
         }
      }
      user.save();
   }
   model.success = true;
}

main();

Store: classpath:alfresco/webscripts

[No implementation files]