How to Disable an Event Subscriber via the SDK

In a Script PX Event Handler using the SDK API, is there a way to Disable/Enable a Event Subscriber? I am referring to the Event Subscribers node that is a child of “Event Management” in the Java client, not the Subscribers node that is a child of “Agile Content Services”.

The NodeConstants NODE_EVENTS documented in the SDK documentation seems to refer to ACS nodes. I would guess that if I could get the Event Subscribers node, I could use INode.setValue() to set the Enabled property, but please confirm.

Add Comment
2 Answer(s)

Hi Brian F,

Please refer the below code to Disable an Event Subscriber via SDK

IAdmin admin = session.getAdminInstance();
INode node = admin.getNode(“EventSubscribers”);

INode subnode = (INode) node.getChild(“test subscriber”);//Your event subscriber name
IProperty[] props = (IProperty[])subnode.getProperties();
for (int i = 0; i < props.length; i++)
{
String propname= props[i].getName();
System.out.println(“Name : ” + propname);
Object value = props[i].getValue();
System.out.println(“Value : ” + value);
if(propname.equalsIgnoreCase(“Enabled”))
{
props[i].setValue(“No”);
}
}
This would help you to disable subscriber .
let me know for any queries.

Thanks,
Kalyani

Agile User Answered on July 28, 2016.
Add Comment

Thanks Kalyani.  I’ll try that, and I appreciate the help.

Agile User Answered on July 28, 2016.

Hey @Brian I know its quite late but would you please tell me how did you enable/disable an event subscriber via code in agile ?

on May 17, 2021.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.