In the previous post, we have seen implementing User defined functions using get API.
Let’s check how to use the trash
API to put unwanted data in a trash using the User Defined Function.
Example
We will again use the StudentInformation
type from the previous post.
Here is a trashStudentInfo
function to put a record of a Student in trash. It uses the trash
API to trash the details.
type Mutation {
trashStudentInfo( type: HypiMutationType! arcql: String! ): Int! @tan(type:Groovy, inline: """return trash(type, arcql)""")
}
*** Use hypi.id
of the StudentInformation
object as one of the UDF parameters.
Let’s execute the function.
mutation {
trashStudentInfo(type:StudentInformation,arcql: "hypi.id='01FQNKWHFY409AG458YCQ36RV9'")
}
#result
{
"data": {
"trashStudentInfo": 1
}
}