Skip to Content
Jan 14, 2021 at 08:22 AM

How to fetch the parameter type in an action in CAP

165 Views Last edit Jan 14, 2021 at 08:25 AM 2 rev

Hi Experts,

I am trying to get the defined custom type for a action in my custom handler to do some V4 to V2 data conversions before posting it to third party rest API.

Is there a way to get the type defined in the parameter of a action similar to how we fetch the return type for a function from the req object.



type objPayload{
 id: String(20);
 firstname: String(50);
 lastname: String(50);
 CreatedDateTime: DateTime;
 LastUpdatedDateTime: DateTime
action updateObject(param : objPayload) returns String;

In a function, I can simply read req._.returnType.elements to get the CDS Type for the function.

I tried cds object to see if it exposes anything for custom defined types but couldn;t find any relevant object like cds.entities for the same.


Best Regards,