Skip to main content

Muis - Send order

Muis - SendOrderToBackoffice This function sends an App4Sales order or quotation to the Muis backoffice. It validates the order data, maps...

Updated over a week ago

Muis - SendOrderToBackoffice

This function sends an App4Sales order or quotation to the Muis backoffice. It validates the order data, maps it to the Muis format, and handles the response from the Muis API.

Data Source Configuration

The connector communicates with the Muis API to send order and quotation data. The specific endpoint used depends on whether an order or a quotation is being sent.

Data Mapping Tables

Order Header

App4Sales Field

Source Field (API/Excel/DB)

Logic/Notes

ExternOrderNumber

Order.OrderNr

The App4Sales order number.

CustomerCode

Order.Customer.CustomerCode

The customer's code.

Name

Order.Customer.CustomerName

The customer's name.

Date

DateTime.Today

The current date.

DeliveryDate

Order.OrderDate

The order date from App4Sales.

PaymentCondition

Order.Customer.PaymentConditionCode

The customer's payment condition code.

OrderType

Order.OrderType.ValueToBackoffice

The order type's backoffice value. Defaults to "App4Sales" if not specified.

Address

MuisAddress.Address

The delivery address. Defaults to the first address if no delivery address is found.

Street

MuisAddress.Street

The delivery street.

StreetNumber

MuisAddress.StreetNumber

The delivery street number.

StreetNumberAddition

MuisAddress.StreetNumberAddition

The delivery street number addition.

CompleteDelivery

"N"

Hardcoded to "N".

PostalCode

MuisAddress.PostalCode

The delivery postal code.

City

MuisAddress.City

The delivery city.

Country

MuisAddress.Country

The delivery country.

DeliveryCondition

Order.Customer.DeliveryMethod

The customer's delivery method. Defaults to the "DefaultDeliveryCondition" setting if not specified.

Reference

Order.YourReference

The "YourReference" field from the order. Problematic characters for Muis are removed.

Remark

Order.Notes

The notes from the order. Problematic characters for Muis are removed.

SalesRep

Order.Salesrep / MuisCustomer.SalesRep

The sales rep from the order. If not available, the sales rep from the customer in Muis is used.

OrderMethod

settings.MuisOrderMethod

The value from the "Muis order method" setting.

ShippingMethod

settings.MuisShippingMethod

The value from the "Muis shipping method" setting.

Order Lines

App4Sales Field

Source Field (API/Excel/DB)

Logic/Notes

Date

DateTime.Today

The current date.

ItemCode

OrderLine.ItemCode

The item code from the order line.

Amount

OrderLine.Quantity

The quantity from the order line.

Discount

OrderLine.Discount

The discount from the order line. Defaults to 0 if not specified.

Price

OrderLine.Price

The price from the order line. Not sent if "DontSendPriceToBackoffice" setting is enabled.

DeliveryDate

Order.OrderDate

The order date from the order header.

ExternRemark

OrderLine.Instruction

The instruction from the order line.

Special Logic & Filters

  • The function first checks if the required settings 'Muis order method' and 'Muis shipping method' are configured. If not, it returns an error.

  • It validates that the order has a customer and that the customer exists in Muis.

  • It distinguishes between regular orders and quotations based on the order type's `ValueToBackoffice` field. If the value is "quotation" or "offerte", it's treated as a quotation.

Domain Specifics

Order Header Logic

The connector determines the sales representative by first checking the order. If no sales representative is assigned to the order, it falls back to the sales representative linked to the customer in Muis. The delivery address is determined by looking for an address with the type 'DEL'; if none is found, the first available address for the customer is used.

Line & Pricing Logic

Order lines can be sorted based on the item's `FreeSortField` if the 'Sort order by free sort field' setting is enabled. The connector can be configured to not send prices to the backoffice using the 'Dont send price to backoffice' setting.

Responses & Error Handling

If the order or quotation is created successfully in Muis, the connector updates the order in App4Sales with the order number returned by Muis. If an error occurs, the error message from Muis is returned to App4Sales.

Related Settings & Prerequisites

  • Muis order method: A required setting that specifies the order method to be used in Muis.

  • Muis shipping method: A required setting that specifies the shipping method to be used in Muis.

  • Default delivery condition: The default delivery condition to use if the customer has no delivery method specified.

  • Sort order by free sort field: If enabled, order lines will be sorted by the item's free sort field.

  • Dont send price to backoffice: If enabled, the price will not be sent to Muis.

Did this answer your question?