My Products
Help
petwob
PARTNER

GraphQL field order in object

by petwob

I'm experiencing a problem with the api not respecting the order of fields when being send as object in a variable.

Example for adding an orderline, where I want to send the priceInCurrency. I'm putting this field last in the object, as I want to be sure to override Business price logic.

 

 

mutation create_order_lines(
	$cid: Int!
	$orderlines: [OrderLine_Insert_Input!]!
) {
	useCompany(no: $cid) {
		orderLine_create(values: $orderlines) {
			affectedRows
			items {
				orderNo
				lineNo
				productNo
				description
				transactionInformation1
				priceInCurrency
			}
		}
	}
}

 

variables:

 

{
	"cid": 1234567,
	"orderlines": [
		{
			"orderNo": 2714,
			"transactionDate": 20230630,
			"productNo": "131318113",
			"quantity": 1,
			"orgUnit2": 4,
			"transactionInformation1": "object",
			"description": "Support 2023",
			"taxAndAccountingGroup": 21,
			"priceInCurrency": 3300
		}
	]
}

 

response:

 

{
	"useCompany": {
		"orderLine_create": {
			"affectedRows": 1,
			"items": [
				{
					"orderNo": 2714,
					"lineNo": 6,
					"productNo": "131318113",
					"description": "Support 2023",
					"transactionInformation1": "object",
					"priceInCurrency": 0
				}
			]
		}
	}
}

 

 

when sending as value, this is not problem:

 

mutation create_order_lines(
	$cid: Int!
) {
	useCompany(no: $cid) {
		orderLine_create(values: [{
			orderNo: 2714,
			transactionDate: 20230630,
			productNo: "131318113",
			quantity: 1,
			orgUnit2: 4,
			transactionInformation1: "values",
			description: "Support 2023",
			taxAndAccountingGroup: 21,
			priceInCurrency: 3300
		}]) {
			affectedRows
			items {
				orderNo
				lineNo
				productNo
				description
				transactionInformation1
				priceInCurrency
			}
		}
	}
}

 

response:

 

{
	"useCompany": {
		"orderLine_create": {
			"affectedRows": 1,
			"items": [
				{
					"orderNo": 2714,
					"lineNo": 5,
					"productNo": "131318113",
					"description": "Support 2023",
					"transactionInformation1": "values",
					"priceInCurrency": 3300
				}
			]
		}
	}
}

 

 

 

0 REPLIES 0