How to send Selected fields from CDT to API

Hi All,

I have the below rule which I'm passing in the process parameters of an API. I am casting the cdt and sending the whole cdt as of now. Is there a way I can send only few fields from the cdt? If so how do I modify the below rule? Please help. Thanks in Advance.

Rule: TYMP_RULE_cdt_parseCaseCreationInputs:

load(
local!data: a!fromJson_19r2(ri!autoCaseCreationInput),
cast(
'type!{urn:com:POT:types:TYMP}TYMP_fileDetails',
local!data
)
)

here ri!autoCaseCreationInput is of type Text. 

  Discussion posts and replies are publicly visible

Parents
  • The easiest way would be to only index the fields you want. For example, you can use the type constructor to insert directly the fields you want to use like this:

    load(
      local!data: a!fromJson_19r2(ri!autoCaseCreationInput),
      type!TYMP_fileDetails(
        field1: index(local!data, "field1", null),
        field2: index(local!data, "field2", null),
        ...
      )
    )

    It's a little tedious, but it would allow you to get exactly which fields you want. If local!data could contain an array of files, then you could use a!forEach() around the expression I defined above like this:

    load(
      local!data: a!fromJson_19r2(ri!autoCaseCreationInput),
      a!forEach(
        items: local!data,
        expression: type!TYMP_fileDetails(
          field1: index(fv!item, "field1", null),
          field2: index(fv!item, "field2", null),
          ...
        )
      )
    )

Reply
  • The easiest way would be to only index the fields you want. For example, you can use the type constructor to insert directly the fields you want to use like this:

    load(
      local!data: a!fromJson_19r2(ri!autoCaseCreationInput),
      type!TYMP_fileDetails(
        field1: index(local!data, "field1", null),
        field2: index(local!data, "field2", null),
        ...
      )
    )

    It's a little tedious, but it would allow you to get exactly which fields you want. If local!data could contain an array of files, then you could use a!forEach() around the expression I defined above like this:

    load(
      local!data: a!fromJson_19r2(ri!autoCaseCreationInput),
      a!forEach(
        items: local!data,
        expression: type!TYMP_fileDetails(
          field1: index(fv!item, "field1", null),
          field2: index(fv!item, "field2", null),
          ...
        )
      )
    )

Children