Delete a record inside onsucess Write

Hi!!


We are making a web api where within the onsucess of writeEntity goes a deleteEntity , the problem is that Appian generates this 500 error:

"Not to Valid Web API Response. Received: [Lcom.appiancorp.core.data.Record;@1f71aca."


Its like the response of the webApi is not complete o its waiting something.

Any solution?

Regards,Rebeca

  Discussion posts and replies are publicly visible

Parents
  • Hi, it was the brackets added in the deleteEntity inside the onsucess part, without these brackets works well.

    I share you the code structure anyway:

    The code is:

    a!writeToDataStoreEntity(
    dataStoreEntity: cons!TABLE,
    valueToStore: local!Datosguarda,
    onSuccess: 
    with(
    a!deleteFromDataStoreEntities(
    dataToDelete: {
    a!entityDataIdentifiers(
    entity: cons!TABLE2,
    identifiers: local!idToDelete
    )
    },
    deletionComment: loggedInUser() & " deleted id " & local!idToDelete,
    onSuccess: a!httpResponse(
    statusCode: 200

    ),
    onError: a!httpResponse(
    statusCode: 500,
    headers: {
    a!httpHeader(
    name: "Content-Type",
    value: "application/json"
    )
    },
    body: a!toJson(

    error:"There was an error writing to the data store"
    }
    )
    )
    )
    ),
    onError: a!httpResponse(
    statusCode: 500,
    headers: {
    a!httpHeader(
    name: "Content-Type",
    value: "application/json"
    )
    },
    body: a!toJson(
    { 
    error:"There was an error writing to the data store"
    }
    )
    )
    )

Reply
  • Hi, it was the brackets added in the deleteEntity inside the onsucess part, without these brackets works well.

    I share you the code structure anyway:

    The code is:

    a!writeToDataStoreEntity(
    dataStoreEntity: cons!TABLE,
    valueToStore: local!Datosguarda,
    onSuccess: 
    with(
    a!deleteFromDataStoreEntities(
    dataToDelete: {
    a!entityDataIdentifiers(
    entity: cons!TABLE2,
    identifiers: local!idToDelete
    )
    },
    deletionComment: loggedInUser() & " deleted id " & local!idToDelete,
    onSuccess: a!httpResponse(
    statusCode: 200

    ),
    onError: a!httpResponse(
    statusCode: 500,
    headers: {
    a!httpHeader(
    name: "Content-Type",
    value: "application/json"
    )
    },
    body: a!toJson(

    error:"There was an error writing to the data store"
    }
    )
    )
    )
    ),
    onError: a!httpResponse(
    statusCode: 500,
    headers: {
    a!httpHeader(
    name: "Content-Type",
    value: "application/json"
    )
    },
    body: a!toJson(
    { 
    error:"There was an error writing to the data store"
    }
    )
    )
    )

Children
No Data