Please describe the expected behavior of the issue, starting from the first action.
- I am creating a custom function to host a HTTP POST request. The POST request uses the Create Object block to update data at the destination.
- The receiving API is set up to erase data if it receives a null data for a property. So this will erase the data in the description property.
- However, this will not erase the data in the description property.
I want to be able to use the custom function to update any data I want (eg. update the name only) without erasing the data in other properties).
The problem I am having is that when I leave a field blank in the custom function, it acts as a null value and erases my data at the API,
How should I set it up to reproduce the behavior where my data is not erased?
A field that is sent to the server with the
empty string property will overwrite data that is already in the table. If you want to avoid overwriting the data in the field, you need to leave the input description blank or do not pass it at it at all in the query.
In my example below, two fields in the Order table will be updated with the passed data: Monosnap.
In this case, I override only the data from one field `name’: Monosnap
Thank you Marina, so the question is how to do that in a custom function that sometimes contains a field and sometimes not. Is this the best way?
Yes, @Andreas_Marinopoulos you can use this logic.
Hey @Marina.Rudenko, it is not working for some reason.
Here’s what I am doing:
- I set a variable called
description = null on purpose
- I check that description = null and provide no value if that is the case.
- This still passes the value
"description": "" to the server, thus erasing the previous value.
AP id: 4A47197B-AE30-FA84-FF56-0071F4010900
How about changing the logic where you create a “blank” object that will be passed into the body of your HTTP request. And then checking if the description is not null, then adding the description property to that blank object?
Thanks @mark-piller, that worked. See below: