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