Create Multiple Articles for a Fulfillment
Author:
Fluent Commerce
Changed on:
30 Jan 2024
Key Points
- Create Multiple Articles for a Fulfillment
Steps
Prerequisites
Enable multiple articles for a location by setting the PACKAGING attribute on the location.
1 mutation UpdateLocation($updateLocationInput:UpdateLocationInput!) {
2 updateLocation(input:$updateLocationInput) {
3 id
4 }
5 }
Language: json
Name: Update location
Description:
[Warning: empty required content area]1{
2 "updateLocationInput": {
3 "id": "{{location_id}}",
4 "attributes": [
5 {
6 "name": "PACKAGING",
7 "type": "OBJECT",
8 "value": [
9 {
10 "name": "Satchel 1kg (A4)",
11 "depth": "350",
12 "width": "280",
13 "height": "40",
14 "maxWeight": "1"
15 },
16 {
17 "name": "Satchel 3kg (A3)",
18 "depth": "410",
19 "width": "325",
20 "height": "90",
21 "maxWeight": "3"
22 },
23 {
24 "name": "Satchel 5kg (A2)",
25 "depth": "580",
26 "width": "430",
27 "height": "80",
28 "maxWeight": "5"
29 },
30 {
31 "name": "Small Box",
32 "depth": "400",
33 "width": "200",
34 "height": "180",
35 "maxWeight": ""
36 },
37 {
38 "name": "Medium Box",
39 "depth": "405",
40 "width": "300",
41 "height": "220",
42 "maxWeight": ""
43 },
44 {
45 "name": "Large Box",
46 "depth": "500",
47 "width": "350",
48 "height": "440",
49 "maxWeight": ""
50 }
51 ]
52 }
53 ]
54 }
55}
Language: json
Name: Update Location Parameters
Description:
[Warning: empty required content area]NOTE: Ensure that the GLOBAL_INVENTORY_ENABLED setting is set to true on RETAILER level.
Step 1
When the Confirm Order button is clicked in ServicePoint a WaveDispatch event is triggered against the WAVE (LOCATION workflow) which contains the multi-article information: WaveDispatch
1{
2 "retailerId": "1",
3 "entityId": "183",
4 "name": "WaveDispatch",
5 "entityType": "WAVE",
6 "entityStatus": "PACK",
7 "attributes": {
8 "fulfilmentArticles": {
9 "218": [
10 {
11 "name": "Satchel 1kg (A4)",
12 "depth": "350",
13 "width": "280",
14 "height": "40",
15 "maxWeight": "1",
16 "weight": 1
17 },
18 {
19 "name": "Satchel 1kg (A4)",
20 "depth": "350",
21 "width": "280",
22 "height": "40",
23 "maxWeight": "1",
24 "weight": 1
25 }
26 ]
27 }
28 }
29}
Language: json
Name: Example
Description:
[Warning: empty required content area]Step 2
- In the Location workflow the WaveDispatch ruleset and corresponding rules will be executed. In the default workflow this ruleset changes the wave status and notifies the corresponding fulfilments with a WaveDispatchInitiated event (see rule SendEventForAllFulfilmentsFromWave). This rule currently does not forward any article attributes to the fulfilment.
In order to enable the multi-article creation the rule needs to be replaced to forward the article details as attributes set in the event.
NOTE: The SendEventWithAttributesForAllFulfilments rule is a V1 rule and should be migrated to a V2 rule. However, it only sends an event and does not perform any GQL actions.
1{
2 "name": "WaveDispatch",
3 "description": "Pack stage is complete. Now booking couriers.",
4 "type": "WAVE",
5 "eventType": "NORMAL",
6 "rules": [
7 {
8 "name": "FLUENTRETAIL.base.ChangeStateGQL",
9 "props": {
10 "status": "DISPATCH"
11 }
12 },
13 {
14 "name": "FLUENTRETAIL.base.SendEventWithAttributesForAllFulfilments",
15 "props": {
16 "eventName": "WaveDispatchInitiated"
17 }
18 }
19 ],
20 "triggers": [
21 {
22 "status": "PACK"
23 }
24 ],
25 "userActions": []
26}
Language: json
Name: WaveDispatch Ruleset
Description:
[Warning: empty required content area]Sample event sent to a fulfilment:
1{
2 "name": "WaveDispatchInitiated",
3 "accountId": "{{fluentAccountId}}",
4 "retailerId": "{{retailer_id}}",
5 "entityId": "214",
6 "entityRef": "6c9b60fb-33d8-4ba6-a823-37622c8b47cd",
7 "entityType": "FULFILMENT",
8 "entityStatus":"FULFILLED",
9 "rootEntityId": "255",
10 "rootEntityRef": "CC_571",
11 "attributes":{
12 "fulfilmentArticles":[
13 {"name":"Satchel 1kg (A4)", "depth":"350", "width":"280", "height":"40", "maxWeight":"1", "weight":"1"},
14 {"name":"Satchel 1kg (A4)", "depth":"350", "width":"280", "height":"40", "maxWeight":"1", "weight":"1"}
15 ]
16 }
17}
Language: json
Name: WaveDispatchInitiated Event
Description:
[Warning: empty required content area]Step 3
In the order workflow the rule CreateArticlesForFulfilment can be used to create the corresponding articles
1{
2 "name": "WaveDispatchInitiated",
3 "description": "Wave Dispatch initiated: this ruleset is to create articles as per user edition in Service Point Pack screen",
4 "type": "FULFILMENT",
5 "eventType": "NORMAL",
6 "rules": [
7 {
8 "name": "FLUENTRETAIL.base.CreateArticlesForFulfilment",
9 "props": {
10 }
11 }
12 ],
13 "triggers": [
14 {
15 "status": "FULFILLED"
16 },
17 {
18 "status": "PARTIALLY_FULFILLED"
19 }
20 ],
21 "userActions": []
22}
Language: json
Name: WaveDispatchInitiated Ruleset Expand source
Description:
[Warning: empty required content area]