Using a web request - is it possible to map response directly as references to existing Enums or Object Classes?

I’m working on mapping a large list of properties from an API call to an existing object in Appfarm. The existing object has some properties which are enums/objects. Is there a way of directly linking a string in the API response to an existing enum or object? My current workaround is to make runtime properties of all these and then recalculate in a separate action step. It would be nice to be able to make a javascript function on a property in the mapping - to set the correct property directly in the property mapping.

Regarding the enum: Let’s say you receive a fixed set of order statuses “open”, “in_progress” or “finished” as values in the JSON when receiving orders from an external system:
If you create this Enum in the Global Data Model as a “String” type and add Open, In Progress, and Finished entries with values “open”, “in_progress” and “finished” as entries: You may map the response directly.

Using the Result Parser, the function parameter rawResponseData contains the raw respons. If thw following is returned from the web request:

{ 
    "CompanyName": "Appfarm",
    "OrgNo": "123456789",
    "ResponsiblePersonEmployeeNo": "999999"
}

…then rawReponseData is an Object with 3 properties.

If I want to tweak the value of Appfarm before I do result mapping, then the result parser may be:

rawResponsData.CompanyName = "Appfarm AS"
return rawResponseData

→ The value of CompanyName in the result mapping is then “Appfarm AS”

Using this concept, you may e.g. add a new property to rawResponseData, before returning it. The result parser will then be:

let respPerson = persons.filter(x => x.employeeNo == rawResponseData.ResponsiblePersonEmployeeNo)
rawResponsData.ResponsiblePersonID = respPerson[0]._id
return rawResponseData

In the above example, I have added the persons datasource as a function parameter, containing all possible employees. When rawResponseData is returned, it now contains a property ResponsiblePersonID which can be used in the Result Mapping directly into the reference to the responsible person