Get Custom Field Options from a C# endpoint

Hi,
I am trying to fetch a few options for a custom field from a C# endpoint.
I know that the response expected is an array of key-value pairs which should have tile & value.

The problem is that it seems that monday can not parse the return string as 1) it is include in quotes as it comes from a C# end point and 2) it contains escaped characters in order to includes quotes.

I don’t get any error in my recipe but the list is always empty.

I have tried with various combinations for escapes characters but I haven’t found a working solution .

Just as an example this is one the return string the endpoint returns in one of my tries.

“"[{\"title\":\"to_upper_case\",\"value\":\"TO_UPPER_CASE\"},{\"title\":\"to_lower_case\",\"value\":\"TO_LOWER_CASE\"}]"”

Any help will be really appreciated.
Thanks in advance.

Hi @janadel!

How are you trying to fetch these options?

I am giving a remote options url to my custom field which corresponds to a c# endpoint.

hi @janadel

Monday is not returning a string, the endpoint should return the array in the form (as an example (NodeJS):

var returnArray = [{ title: "Option 1", value: "opt_1" }];

Hi,
It is a typo, I meant to write the returning string.
My code is
string options = @“[{”“title”“:”“to_upper_case”“,”“value”“:”“TO_UPPER_CASE”“},{”“title”“:”“to_lower_case”“,”“value”“:”“TO_LOWER_CASE”“}]”;
return Request.CreateResponse(HttpStatusCode.OK, options)
I have also tried with with the escaped quote \" instead of ".

Thanks

Not much experience with C#
Why are you returning a string? You should return an array.

1 Like

Thanks for your suggestion. It perfectly worked.
We prefer to return strings instead of the objects believing that we have better control but we don’t.

1 Like

This is why I love our community! Glad y’all found a solution together.