<?xml version="1.0" encoding="UTF-8"?>
<a:service trace="true" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc">
    <a:init-procedure>
        <a:batch-apply sourcepath="/parameter">
            <p:switch test="@current_parameter/@_status">
                <p:case value="insert">
                    <a:model-insert model="sys.SYS1090.sys_business_flexfields"/>
                </p:case> 
                <p:case value="update">
                    <a:model-update updatepassedfieldonly="true" model="sys.SYS1090.sys_business_flexfields"/>
                    <a:model-query model="sys.SYS1090.sys_dynamic_forms" fetchAll="true" rootPath="forms"/>
                    <a:batch-apply sourcepath="/model/forms">
	                    <p:method-invoke className="leaf.application.features.cstm.CustomSourceCode" methodName="formConfigConvertToCust">
				            <p:arguments>
				                <p:argument path="instance" type="uncertain.ocm.IObjectRegistry"/>
				                <p:argument type="java.lang.Long" value="${@current_parameter/@form_id}"/>
				            </p:arguments>
				        </p:method-invoke>
			    	</a:batch-apply>
			    	<a:model-query model="sys.SYS1090.sys_dynamic_grids" fetchAll="true" rootPath="columns"/>
                    <a:batch-apply sourcepath="/model/columns">
                        <p:method-invoke className="leaf.application.features.cstm.CustomSourceCode" methodName="gridConfigConvertToCust">
                            <p:arguments>
                                <p:argument path="instance" type="uncertain.ocm.IObjectRegistry"/>
                                <p:argument type="java.lang.Long" value="${@current_parameter/@grid_id}"/>
                            </p:arguments>
                        </p:method-invoke>
                    </a:batch-apply>
                </p:case>
                <p:case value="delete">
                    <a:model-delete model="sys.SYS1090.sys_business_flexfields"/>
                </p:case>
            </p:switch>
        </a:batch-apply>
    </a:init-procedure>
    <a:service-output output="/parameter"/>
</a:service>