Transform to anyOf

I have a transform that maps the data from a canonical to a type that has a anyOf field, but this field doesn’t get populated.

This is how the field is defined in the type.

answer: anyof(decimal, string, int, boolean, double)

In the canonical this is my input.

value: string

And this is the transform.

answer: ~ expression '{"type": "String", "value":"value"}'

I have also tried:
answer: ~ expression ‘{“type”: “string”, “value”:“value”}’
answer: ~ expression “value”

and other few options, but the answer field doesn’t get populated.

I created a canonical record in the console and then run the transform, but this field is empty.

`a1 = CanonicalAnswer.make({
  "characteristic": "building_type",
  "facilityId": "ED5B1C11-63F5-4A0A-B7D3-69FBCF450E61",
  "value":"College/University"
})`
`var txm1 = CanonicalAnswer.transformCanonical([a1])`


{
  "type": "Answer",
  "question": {
    "id": "ent_question_building_type"
  },
  "id": "ED5B1C11-63F5-4A0A-B7D3-69FBCF450E61-ent_question_building_type",
  "meta": {
    "updated": "2019-07-09T17:09:22.505Z"
  },
  "source": {
    "id": "ED5B1C11-63F5-4A0A-B7D3-69FBCF450E61"
  },
  "userSelection": "answered"
}

@erick.alanis sorry that I have to ask you to do this… but can you try regular DI and see if it works, the code path for transformCanonical and regular transform is different and I am hoping it should work… if it doesn’t file a ticket and we could try to investigate to give you a workaround or better a fix. We are in the middle of refactoring this area and hoping to move to one way of transforming.

@erick.alanis I’m working on something similar and also getting errors. Any followup?

I missed this, I have to create a ticket for this to Platform. However, the workaround was to create a transform JS and doing make on a anyof field will work.