condition to check if type is a CDT

Certified Associate Developer

Hello community,

I wonder if it is possible to check with in a if condition if a passed value of any type is a CDT.
I want to make a generic expression rule to convert a body from JSON to CDT with two rule inputs.
1 body of type text.
2 any type, but only CDT's so no integer, string etc.

So I want the to JSON function only to execute when the ruleinput is a CDT, if not I want to return a custom error message text string.
Are the CDT in a specific reserved numeric range so I can use that, or is there another approach?

Kind Regard,

Erik

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to erikb0001

    Got it. I was a bit on a wrong path here.

    I do not know of a way of how to check whether a value is a CDT in general.

    What do you want to achieve in general?

    When I do serious integrations, I create an expression fetching the data from a specific endpoint so I know which structure to expect. In case the API is stable, I just make the integration object to return a dictionary and not the JSON string. Then I cast it to the type I expect.

    In case the API is not stable, I make the integration to return the JSON string and use a plugin to validate whether it is valid JSON. Then turn it into a dictionary and cast it.

Children