How can we send notifications to user upon deleting Program object?
How can we send notifications to user upon deleting Program object? We cant subscribe a notification to a delete object event. Can you share the process how can we do this? any sample code
Hi,
You can use the Delete Event to trigger a custom EventPX.
In your JAVA script you can cast the event to IDeleteEventInfo in order to have the following methods that can help you to create a custom notification
String getNumber () throws APIException
Integer getSubclassId () throws APIException
boolean isSoftDeleteAction () throws APIExceptio
Hi Anvesh,
please find below a simple code to send a custom notification using EventPX and AgileSDK
public class DeleteNotifyPX implements IEventAction { @Override public EventActionResult doAction(IAgileSession session, INode node, IEventInfo event) { try { IDeleteEventInfo deleteEvent = (IDeleteEventInfo) event; String number = deleteEvent.getNumber(); IUser user1 = (IUser) session.getObject(IUser.OBJECT_TYPE, "userId1"); IUser user2 = (IUser) session.getObject(IUser.OBJECT_TYPE, "userId2"); IUser[] usersToBeNotified = new IUser[]{user1,user2}; session.sendMail(usersToBeNotified, "The Object "+number+" has been deleted"); return new EventActionResult(event, new ActionResult(ActionResult.STRING, "Notification sent")); } catch (Exception e) { return new EventActionResult(event,new ActionResult(ActionResult.EXCEPTION, e)); } } }
userid1 and userid2 are the login id of users that you want to notify when an object is deleted.
You can deploy the code as Process Extension (http://docs.oracle.com/cd/E28664_19/otn/pdf/integration/E28698_02.pdf) and
configure this PX as EventPX in the java client (http://docs.oracle.com/cd/E28664_19/otn/pdf/administration/E28674_01.pdf)