Hi All,

Today will discuss about the form methods event handler. Form methods have "Pre" and "Post" event handler.

It can be implemented, by right clicking on the Form method > Copy event handler method > Pre/Post event handler.

Let see with example: 

In one of the requirement, the standard form > Hierarchy, add the new element "Property agreement" to base enum "Hierarchy Type". Basing on the enum > Hierarchy Type, form caption need to be changed.

So in this case we are implementing the "Post event handler" > "init" method.

1. Go to the Form methods > expand the method node and right clicking on the Form method > Copy event handler method > Post event handler.

2. Create a new class and paste the copied event handler to it or if any existing class with the implemented event handler - that class can be used.

Below is the code snippet for  Post event handler "init" method:

///


/// Hierarchy form init method post event handler
///

///
[PostHandlerFor(formStr(Hierarchy), formMethodStr(Hierarchy, init))]
public static void Hierarchy_Post_init(XppPrePostArgs args)
{
            FormRun hierarchyForm = args.getThis();
            HierarchyType hierarchyType;

            if(hierarchyForm.args().parmEnumType() == enumNum(HierarchyType))
            {
                    hierarchyType = hierarchyForm.args().parmEnum();
                    if(hierarchyType ==HierarchyType::PropertyAgreement)
                    {
                            hierarchyForm.design().caption("Property agreement process");
                    }
             }
}

Thanks,

Naresh Kolli.