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.

This example shows the addition of an element, that is not available in the context message type elements..

function extern long after.mapping.hook.com.infor.ln.businesscontext_1(long i.message.node)
{
         |* Add element addition_1 (item group description) to the tcmcs023 entity

        long    all.tables, one.table, node
        
        all.tables = xmlFindMatch("?<entities>.<lnTable>", i.message.node)
        if all.tables <> 0 then
                |* Now we have a node with an enumeration of all lnTable nodes
                node = xmlGetFirstChild(all.tables)
                while node <> 0
                        one.table = lval(xmlData$(node))
                        |* one.table now contains the xml node of an lnTable element.
                        |* Is this LN table tcmcs023? If yes, add the element to its parent
                        if xmlData$(one.table) = "tcmcs023" then
                                xmlNewDataElement("addition_1", tcmcs023.dsca, xmlGetParent(one.table))
                                break
                        endif
                        node = xmlGetRightSibling(node)
                endwhile
                xmlDelete(all.tables)
        endif
        
	return(0)
}