After Mappings hook

Use this hook to perform additional actions on the created XML, to make changes that cannot be achieved by changing the field mappings.

If the standard hook must be executed before the extension hook is executed, you can force the standard hook to execute anytime you prefer. This can be achieved by calling the message.super() function.

This example shows the (conditional) deletion of an element.

function extern long after.mapping.hook.com.infor.ln.businesscontext_tsmdm200_1(long i.message.node)
{
        |* Find the id2 element of tsmdm200 and remove it

        long    all.id2s, one.id2, node
        
        all.id2s = xmlFindMatch("?<entities>.<id2>", i.message.node)
        if all.id2s <> 0 then
                |* Now we have a node with an enumeration of all id2 nodes
                node = xmlGetFirstChild(all.id2s)
                while node <> 0
                        one.id2 = lval(xmlData$(node))
                        |* one.id2 now contains the xml node of an id2 element.
                        |* Belongs this id2 to LN table tsmdm200? Then delete it.
                        if xmlDataElement$(xmlGetParent(one.id2), "lnTable") = "tsmdm200" then
                                xmlDelete(one.id2)
                                break
                        endif
                        node = xmlGetRightSibling(node)
                endwhile
                xmlDelete(all.id2s)
        endif

	return(0)
}