cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Extension Field with External Hook in SAP Service Cloud Version 2

druiz
Explorer
0 Kudos
782

Hello everyone,

I am working on updating an extension field called zWebSite in SAP, where I want to store the website obtained from the Organizational Unit entity using ExtenalHook PreHook. To achieve this, I developed a small application in SAP BTP. However, I am encountering an issue with the following error:

Custom logic error: FAILED_PRECONDITION: Error raised from the external system with HTTP Status Code: 500 "Request failed with status code 422".

druiz_1-1726463697785.png

My code(JS):

druiz_2-1726463794430.png

I am wondering about the correct structure for the update. Specifically, I would like to know:

Is it necessary to send the entire currentImage data in the update request, or is it sufficient to only send the extension field zWebSite?

druiz_0-1726463602361.png

I appreciate any help or suggestions you can provide.

Thank you!

Accepted Solutions (0)

Answers (1)

Answers (1)

fmartucci
Explorer
0 Kudos

Is it necessary to send the entire currentImage data in the update request, or is it sufficient to only send the extension field zWebSite?

The response to the external hook can be seen as an http PATCH, so you send only the fields you want to update.

So, in your case, if you only want to update "zWebSite", the payload of the response will be an application/json like this:

 

{

    "data": {

        "zWebSite": "its_value"

    }

}

 

 

Reference: https://help.sap.com/docs/CX_NG_SALES/ea5ff8b9460a43cb8765a3c07d3421fe/75a98757fa2d4117b35d81aa07f04...

druiz
Explorer
0 Kudos

Thank you for your input!
I also thought the PATCH method would be ideal for this case. However, after reviewing the official SAP documentation, specifically at this link, it seems that only the POST method is supported for external hooks in SAP Sales Cloud V2. While PATCH would indeed allow us to update just the specific field like "zWebSite," as per the documentation, we need to use POST for sending the full payload, including other relevant fields if necessary. Let me know if you have any additional insights or if you found a way to make PATCH work in this context.

druiz_0-1727381563169.png

Thanks again for your feedback!