I'm designing the Fulfillment States that we need to report to CRM system during the order execution, in this process I created the external fulfillment states that I expect to receive from the external fulfillment system in each order component specification function type. After that I created the Fulfillment State Map to set the Mapped State that I need to report to CRM and the Composition Ruleset at the order and item level.
But actually I have several questions about the fulfillment states work:
-Where can I see the external fulfillment state and mapped state in the Control Data\Order Item Structure, and where can I see the Order State resulting from the Order Composition Ruleset?
-How can I update the external fulfillment state during the function execution? Do I Need to implement an automatic task to execute an order update during ths process or is something automatic ?
-How should I send the Mapped State to CRM ? Do I use an event or an automatic task in the process for this purpose or is there an automatic way to do it?
If you are not, by default, the fulfillment states are in the following location --
a) external fulfillment state -- /ControlData/Functions/<Function>/orderItem/ExternalFulfillmentState
b) composite fulfillment state (i.e. output of FS composition) -- /ControlData/OrderItem/OrderItemFulfillmentState for order items, and /ControlData/OrderFulfillmentState for overall order.
Note that mapped fulfillment states are not persisted.
These defaults are configurable by creating FulfillmentStateModule.xquery file, and have XML catalog include the file. In fact, this is how O2A cartridges override these defaults; the fulfillment states are stored in /OrderLifeCycleManagement area.
Yes, you can update the external fulfillment state during function execution -- in your automation of the function, simply return the external fulfillment state in your xquery automator.
To send composite fulfillment state to CRM, yes, you need to create a Data Changed Event Notification -- set it to trigger by Composite Fulfillment State change.
Thank's for your explanation, now is really more clear for me, I'm going to review the FulfillmentStateModule.xquery in O2A Cartridges.
To create a Data Changed Event Notification I'm going to include a Notification in the Order Component and two nodes in DataChanged tab:
/ControlData/OrderItem/OrderItemFulfillmentState and /ControlData/OrderFulfillmentState is that correct?
I'm updating /ControlData/Functions/<Function>/orderItem/ExternalFulfillmentState during the order execution but the /ControlData/OrderItem/OrderItemFulfillmentState for order items, and /ControlData/OrderFulfillmentState for overall order aren't updated.
I'm only using Fulfillment State Map, Order Item Composition Rule Set and Order Composition Rule Set components but i don't include any xquery to this purpose. Aditionally in the Product Specification I set my Fulfillment State Map as the Default State Map.
Do I need any aditional configuration or resource ?
I can't think of anything you would be missing. You don't have to have that FulfillmentStateModule.xqy, so you're fine there.
The only advice I can think of, is try to create some very trivial map and composite rules with minimal order items in your test order, to see if the problem is really not able to trigger, rather than problems with the rules themselves.
First of all, thank's for your answers and valuable help, I think the problem is that the order is not be able to trigger the fulfillment state map.
I created a very trivial map and composite rules as you advice me but the I had the same result, when I updated the External Fulfillment State during the order execution the Order Item Fulfillment State and the Order Fulfillment State remain empty.
I'm sharing with you a document with several screenshots about the configuration that I implemented and the behavior when the order is executing in the following link:
I hope that you can review the file and give me some suggestions.
I really appreciate the help you quite can give me about it and I want to thank you care during this time.
So you are using O2A? As I said, O2A has made quite a few tweaks to using Fulfillment State. You can't be expecting the fulfillment states in those paths.
First, check if you have FulfillmentStateModule.xquery in your workspace. This is the configuration file that alters many FS things including paths. As I said, the External Fulfillment States in O2A are stored in /OrderLifeCycleManagement. The Composite FS paths are changed as well.
If you are using O2A, it is highly recommended that you follow its OrderLifeCycleManagement framework (which utilizes FSM in its own way).
I didn't use the O2A Cartridges but I created the same structure starting from the beggining and using only the components that I need. That's the reason that I said I only used components and i don't included any xquery file to this purpose.
The only XQuery file that I use is the one that I update the ControlData\<FUNCTION>\ExternalFulfillmentState during the order execution.