1 <Moqui.basic.StatusFlowStatusflowid= "Zc3pldefault_product"Statustypeid= "Product"Description= "Default status flow for 3PL services across entire system."/>2 <Moqui.basic.StatusFlowItemStatusflowid= "Zc3pldefault_product"Statusid= "Productopen"isinitial= "Y"/>3 <Moqui.basic.StatusFlowItemStatusflowid= "Zc3pldefault_product"Statusid= "Productonshelf"/>4 <Moqui.basic.StatusFlowItemStatusflowid= "Zc3pldefault_product"Statusid= "Productoffshelf"/>5 <Moqui.basic.StatusFlowItemStatusflowid= "Zc3pldefault_product"Statusid= "productclosed"/>6 <moqui.basic.StatusFlowTransitionStatusflowid= "Zc3pldefault_product"Statusid= "Productopen"Tostatusid= "Productonshelf"Transitionname= "Process"/>7 <moqui.basic.StatusFlowTransitionStatusflowid= "Zc3pldefault_product"Statusid= "Productonshelf"Tostatusid= "Productoffshelf"Transitionname= "Process"/>8 <moqui.basic.StatusFlowTransitionStatusflowid= "Zc3pldefault_product"Statusid= "Productoffshelf"Tostatusid= "productclosed"Transitionname= "Process"/>
1 <Serviceverb= "Update"noun= "Productstatus">2 <in-parameters>3 <parametername= "ProductId"Required= "true"/>4 <parametername= "Statusid"Required= "true"/>5 <parametername= "Placeddate"type= "Timestamp"/>6 </in-parameters>7 <out-parameters><parametername= "Oldstatusid"/><parametername= "StatusChanged"type= "Boolean"/></out-parameters>8 <Actions>9 <Entity-findEntity-name= "Mantle.product.Product"List= "ProductList">Ten <econditionField-name= "ProductId" from= "ProductId"/></Entity-find> One <SetField= "Updatemap" from= "[Productid:productid, Statusid:statusid]"/> A <ifcondition= "Placeddate! = null"> - <Script>Updatemap.put (' placeddate ', placeddate)</Script> - </if> the <Service-callname= "Update#mantle.product.product"Out-map= "Context"In-map= "Updatemap"/> - </Actions> - </Service>
1 <Serviceverb= "Get"noun= "Productfieldchangeauditlog">2 <in-parameters>3 <parametername= "ProductId"/>4 <parametername= "FieldName"Default-value= "Statusid"/>5 </in-parameters>6 <out-parameters>7 <parametername= "Auditloglist"type= "List"><parametername= "Auditlog"type= "Map">8 <parametername= "Oldvaluetext"/><parametername= "Newvaluetext"/><parametername= "Changeddate"/><parametername= "Changebyuserid"/>9 </parameter></parameter>Ten </out-parameters> One <Actions> A <!--todo:do more authorization checking - - - <Entity-findEntity-name= "Moqui.entity.EntityAuditLog"List= "Auditloglist"> the <Econdition-objectField= "[changedentityname: ' Mantle.product.Product ', Changedfieldname:fieldname, Pkprimaryvalue:productid]"/> - <Select-fieldField-name= "Oldvaluetext"/> - <Select-fieldField-name= "Newvaluetext"/> - <Select-fieldField-name= "Changeddate"/> + <Select-fieldField-name= "Changedbyuserid"/> - </Entity-find> + </Actions> A </Service>
These are the service state changes and the method of changing the status record query.
In Moqui, if you want to use Autidlog to record the first enable_audit_log=true
1 <?XML version= "1.0" encoding= "UTF-8"?>2 <entitiesXmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"3 xsi:nonamespaceschemalocation= "Http://moqui.org/xsd/entity-definition-2.0.xsd">4 <extend-entityEntity-name= "Product" Package= "Mantle.product">5 <Fieldname= "Statusid"type= "id"Enable-audit-log= "true"/>6 </extend-entity>7 </entities>
The update mode is used to pass all primary keys or the non-primary key fields that you expect. If an entity has a STATUSID field and the incoming Statusid and field values are different, the service automatically returns the original value in the Oldstatusid out parameter, regardless of when the entity has a STATUSID field. The service will also return a Boolean statuschanged parameter, if the state and the original value of the database are not the same then the field is true and the inverse is false, The Entity Auto-Service performs an effective state change by checking the existence record of the matching moqui.basic.StatusFlowTransition. If there is no valid state change, then the service will return an error.
Work framework various use sorting---service status change data