legacy-knowledge-base
Publicado Sep. 25, 2010

PATCH request is not working for custom fields

written-by

Pooja Bhambani

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

Issue

  • Steps to reproduce:

    1. Start up Liferay, change the password to 'a'
    2. Go to Control Panel >Configuration > Custom Fields
    3. Select Organization.
    4. Tap the + icon to add a new Custom Field.
    5. Select Input Field, and type "Testcustom" to the Field Name, save it.
    6. Add a new organization using the headless-admin:

    curl -X 'PUT' \
    'http://localhost:8080/o/headless-admin-user/v1.0/organizations/by-external-reference-code/testerc' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "customFields": [
    {
    "customValue": {
    "data": "Test value"
    },
    "name": "Testcustom"
    }
    ],
    "name": "test org"
    }' \
    -u 'test@liferay.com:a'
    :warning: The new organization is visible on the UI, and inside it you can see the custom field with the value "Test value"

    Note: The new organization is visible on the UI, and inside it you can see the custom field with the value "Test value"
    7. Now update the the custom field with a PATCH request:

    curl -X 'PATCH' \
    'http://localhost:8080/o/headless-admin-user/v1.0/organizations/by-external-reference-code/testerc' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{
    "customFields": [
    {
    "customValue": {
    "data": "New value"
    },
    "name": "Testcustom"
    }
    ]
    }' \
    -u 'test@liferay.com:a'
    The Custom field's value has not changed, it is still "Test value" instead of "New value"

    Actual Behavior: The Custom field's value has not changed, it is still "Test value" instead of "New value"
    Expected Behavior: The custom field's value should change to "New value"

Environment

  • Liferay DXP 7.4

Resolution

  • The observed behavior is a known Liferay DXP bug which has been addressed in Liferay DXP 7.4 Update 66.

Additional Information

did-this-article-resolve-your-issue

legacy-knowledge-base