Fluent Commerce Logo
Docs
Sign In

Create Return Order in ServicePoint

How-to Guide

Author:

Fluent Commerce staff

Changed on:

30 Oct 2023

Key Points

  • Step-by-step configuration guide to enable Returns functionality in ServicePoint.
  • The configurations include the following:
    • User Role assignments
    • Settings
    • workflows

Steps

Step arrow right iconSetup the following settings via GraphQL:

1mutation CreateSetting($retailerId:Int!) { returnOrchestrated: createSetting(input: { name: "RETURN_ORCHESTRATED", valueType: "BOOLEAN", value: "TRUE", context: "RETAILER", contextId: $retailerId}) { id name } defaultReturnDestinationLocation: createSetting(input: { name: "DEFAULT_RETURN_DESTINATION_LOCATION", valueType: "STRING", value: "{{rejectLocation}}",//needs to be set to the corresponding default return location context: "RETAILER", contextId: $retailerId}) { id name } returnOrderType: createSetting(input: { name: "RETURN_ORDER_TYPE", valueType: "STRING", value: "DEFAULT", context: "RETAILER", contextId: $retailerId}) { id name } returnOrchestratedAccount: createSetting(input: { name: "RETURN_ORCHESTRATED", valueType: "BOOLEAN", value: "TRUE", context: "ACCOUNT", contextId: 0}) { id name } }

Language: json

Name: Create these new settings: RETURN_ORCHESTRATED DEFAULT_RETURN_DESTINATION_LOCATION RETURN_ORDER_TYPE RETURN_ORCHESTRATED

Description:

[Warning: empty required content area]

Step arrow right iconSetup the following settings via REST API:

a. RETURN_REASON

PUT {{fluentApiHost}}/api/v4.1/settings/retailer/{{retailer_id}}/RETURN_REASON

1{ "setting": { "key": "RETURN_REASON", "type": "JSON", "value": [ { "label": "Wrong Size", "value": "WRONGSIZE" }, { "label": "Broken", "value": "BROKEN" } ] } }
2

Language: json

Name: RETURN _REASON Payload

Description:

[Warning: empty required content area]

b. RETURN_CONDITION

PUT {{fluentApiHost}}/api/v4.1/settings/retailer/{{retailer_id}}/RETURN_CONDITION

1{ "setting": { "key": "RETURN_CONDITION", "type": "JSON", "value": [ { "label": "Reusable", "value": "GOOD" }, { "label": "Destroy", "value": "BROKEN" } ] } }

Language: json

Name: RETURN_CONDITION Payload

Description:

[Warning: empty required content area]


Step arrow right iconCreate and assign the In-store Return Role

a. Role Creation

1mutation { createRole(input: {name: "INSTORE_RETURNS", permissions: [ {name: "ORDER_VIEW"}, {name: "CUSTOMER_VIEW"}, {name: "RETURN_VIEW"}, {name: "ORDERITEM_VIEW"}, {name: "PRODUCT_VIEW"}, {name: "VARIANTPRODUCT_VIEW"}, {name: "STANDARDPRODUCT_VIEW"}, {name: "GROUPPRODUCT_VIEW"}, {name: "CATEGORY_VIEW"} ] }) { name permissions { name } } }

Language: json

Name: The INSTORE_RETURNS Role Creation code

Description:

[Warning: empty required content area]

INSTORE_RETURNS Role Creation Expand source

b. Role Assignment

1mutation updateUser( $locationUserId:ID! $retailerId:ID! ){ updateUser(input:{ id:$locationUserId roles:[ { role:{ name:"INSTORE_RETURNS" } contexts:[ { contextId:$retailerId contextType:"RETAILER" }, { contextId:$locationUserId, contextType:"AGENT" } ] } ] }){ id } }

Language: json

Name: The INSTORE_RETURNS Role Assignment code

Description:

[Warning: empty required content area]


Step arrow right iconConfigure Order workflows for the returns

Workflows For returns there is some cross workflow communication occurring between the Order workflow and the Return Order workflow.

a. Order workflow The Order workflow requires 2 new rulesets (if not already present):

1{ "name": "ReturnOrder", "description": "ReturnOrder", "type": "ORDER", "subtype": "CC", "eventType": "NORMAL", "rules": [ { "name": "FLUENTRETAIL.base.ValidateReturnQty", "props": null }, { "name": "FLUENTRETAIL.base.CreateReturnOrderFromOrder", "props": null }, { "name": "FLUENTRETAIL.base.ChangeStateGQL", "props": { "status": "RETURN_CREATED" } } ], "triggers": [ { "status": "BOOKED" }, { "status": "PICK_PACK" }, { "status": "COMPLETE" }, { "status": "RETURN_CREATED" } ], "userActions": [ { "context": [ { "label": "Return", "type": "PRIMARY", "modules": [ "adminconsole" ], "confirm": false } ], "attributes": [ { "name": "returnItems", "label": "Items", "type": "RETURN_ITEMS", "source": "", "defaultValue": "", "mandatory": false }, { "name": "pickupLocation", "label": "Pickup Location", "type": "ADDRESS", "source": "", "defaultValue": "", "mandatory": false }, { "name": "lodgedLocation", "label": "Lodged Location", "type": "STRING", "source": "", "defaultValue": "", "mandatory": false }, { "name": "type", "label": "Return Type", "type": "STRING", "source": "", "options": { "active": [ { "name": "Default", "value": "DEFAULT" } ] }, "defaultValue": "", "mandatory": false } ] } ] }

Language: json

Name: Add the following ruleset to your Order workflow. This ruleset displays the user action "Return" button in the order screen.

Description:

[Warning: empty required content area]
1{ "name": "UpdateReturnableQty", "description": "UpdateReturnableQty", "type": "ORDER", "eventType": "NORMAL", "rules": [ { "name": "FLUENTRETAIL.base.UpdateOrderItemAttribute", "props": null } ], "triggers": [ { "status": "RETURN_CREATED" } ], "userActions": [] }

Language: json

Name: Include the ruleset UpdateReturnable Quantity in the order workflow. This ruleset keeps track of how much quantity has been returned per order line.

Description:

[Warning: empty required content area]


b. Return Workflow

1{ "retailerId": "{{retailer_id}}", "version": "1.0", "entityType": "RETURN_ORDER", "entitySubtype": "DEFAULT", "description": "Basic workflow template", "versionComment": "First version", "name": "RETURN_ORDER::DEFAULT", "rulesets": [ { "name": "CREATE", "description": "Create ReturnOrder", "type": "RETURN_ORDER", "subtype": "DEFAULT", "eventType": "NORMAL", "rules": [ { "name": "FLUENTRETAIL.base.ChangeStateGQL", "props": { "status": "BOOKED" } }, { "name": "FLUENTRETAIL.base.SendEventToReturns", "props": { "eventName": "FulfilReturn" } } ], "triggers": [ { "status": "CREATED" } ], "userActions": [] }, { "name": "FulfilReturn", "description": "ReturnOrder", "type": "RETURN_ORDER", "eventType": "NORMAL", "rules": [ { "name": "FLUENTRETAIL.base.CreateReturnFulfilment", "props": null }, { "name": "FLUENTRETAIL.base.ChangeStateGQL", "props": { "status": "RETURNED" } }, { "name": "FLUENTRETAIL.base.SendEventToUpdateOrderItemAttribute", "props": { "eventName": "UpdateReturnableQty" } } ], "triggers": [ { "status": "BOOKED" }, { "status": "CREATED" } ], "userActions": [] }, { "name": "CREATE", "description": "CREATE", "type": "RETURN_FULFILMENT", "subtype": "DEFAULT", "eventType": "NORMAL", "rules": [ { "name": "FLUENTRETAIL.base.ChangeStateGQL", "props": { "status": "COMPLETE" } } ], "triggers": [ { "status": "CREATED" } ], "userActions": [] } ], "statuses": [ { "name": "CREATED", "entityType": "RETURN_ORDER", "category": "BOOKING" }, { "name": "BOOKED", "entityType": "RETURN_ORDER", "category": "BOOKING" }, { "name": "RETURNED", "entityType": "RETURN_ORDER", "category": "BOOKING" }, { "name": "CREATED", "entityType": "RETURN_FULFILMENT", "category": "BOOKING" }, { "name": "COMPLETE", "entityType": "RETURN_FULFILMENT", "category": "BOOKING" }, { "name": "CREATED", "entityType": "RETURN_ORDER_FULFILMENT", "category": "BOOKING" }, { "name": "CREATED", "entityType": "ORDER", "category": "BOOKING" }, { "name": "BOOKED", "entityType": "ORDER", "category": "BOOKING" } ] }
2

Language: json

Name: ReturnOrder workflow PUT {{fluentApiHost}}/api/v4.1/workflow

Description:

[Warning: empty required content area]


Fluent Commerce staff

Fluent Commerce staff

Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo