javascriptjspliferayexpando

Liferay - Set Expando Field Value in a Javascript Function


I need to set a User Expando field value in a Javascript Function in liferay. It is possible to do?


Solution

  • You can use the json api like this way

    Liferay.Service(
      '/expandovalue/add-value',
      {
        companyId: 20154,
        className: 'com.liferay.portal.model.User',
        tableName: 'CUSTOM_FIELDS',
        columnName: 'test',
        classPK: 30924,
        data: 'test'
      },
      function(obj) {
        console.log(obj);
      }
    );
    

    where

    columnName is the name of your custom field

    classPK is the entity id in this case userId

    data the value of the custom field