public static MapdeletePerson(DispatchContext dctx, Map context) {
MapresultMap = ServiceUtil.returnSuccess();
String id = (String) context.get("id");
try {
GenericValue personGV = delegator.findOne("Person", UtilMisc.toMap("id", id), false);
if (personGV != null && !personGV.isEmpty()) {
personGV.remove();
}
} catch (GenericEntityException e) {
return ServiceUtil.returnError("Failed. " +e.getMessage());
}
return resultMap;
}
Showing posts with label remove(). Show all posts
Showing posts with label remove(). Show all posts
Deleting a Record in OFBiz using Java
This is an example on how to delete a record in OFBiz using Java. I am assuming that the you have created the service of this method in you service.xml.
Labels:
delegator,
DispatchContext,
findOne,
GenericEntityException,
GenericValue,
Java,
Map,
OFBiz,
remove(),
ServiceUtil
Subscribe to:
Posts (Atom)

