How to implement User Defined Functions using delete API

In the previous post, we have seen implementing User defined functions using untrash API.
Let’s check how to use the delete API to delete unwanted data permanently using the User Defined Function.

Example

We will again use the StudentInformation type from the previous post.
Here is a deleteStudentInfo function to delete a Student record. It uses the delete API to delete the details.

type Mutation {
   deleteStudentInfo(type: HypiMutationType! arcql: String! clearArrayReferences: Boolean = false ): Int! @tan(type:Groovy, inline: """return delete(type, arcql, clearArrayReferences)""")
}

Let’s execute the function!

mutation {
  deleteStudentInfo(type:StudentInformation,arcql: "hypi.id='01FQNKWHFY409AG458YCQ36RV9'")
}
#result
{
  "data": {
    "deleteStudentInfo": 1
  }
}