to get a personalized navigation.
to get a personalized navigation.
Needs to create customer groups and then linked to customers but can't find an API for this. Could someone provide any example or method related to this task?
Solved! Go to Solution.
The schema is now modified so that you can pass null for all fields that support suggesting value.
I'm still getting an error when I try to suggest a textNo.
{
"errors": [
{
"message": "A record with the same primary key already exists.",
"path": [
"useCompany",
"text_create",
"values/0"
],
"extensions": {
"data": {
"status": 3
}
}
}
],
"data": {
"useCompany": {
"text_create": {
"items": null
}
}
},
"extensions": {
"vbnxt-trace-id": "000000000000000001d1d2d89e53ddfe"
}
}
This is something else. Previously, you could not set a null, you were getting:
"Argument 'values' has invalid value. In field 'textNo': [Expected 'Long!', found null.]"
Now, you can. The fact that you get a runtime error is a completely different problem.
Business has multiple ways you can group a customer. Are you thinking CustomerPriceGroup1-3? Or Group1-6? The names for these groups are set in the text-table and you need to add a text with the textType, languageNo, textNo and text. There's no auto-incrementing the textNo unfortunately, so you'll have to grab them all and find the next number yourself.
You'll easily find all the correct text types at https://model.vbnxt.rocks/Associate. Below are the groupings on Associate and those with TxtTp are the ones you can add to the text table.
mutation createText($cid: Int, $textType: Long!, $textNo: Long!, $text: String!, $language: Int! = 1) {
useCompany(no: $cid) {
text_create(
values: {textType: $textType, languageNo: $language, text: $text, textNo: $textNo}
) {
items {
textNo
}
}
}
}
Unfortunately suggest for textNo does not work in this mutation. Maybe it should though, @Marius Bancila?
$textNo must be null for a suggest to occur. What are the values of the variables that you pass for the mutation?
The schema type of textNo is Long!, so null is not allowed.
{
"errors": [
{
"message": "Argument 'values' has invalid value. In field 'textNo': [Expected 'Long!', found null.]",
"locations": [
{
"line": 26,
"column": 7
}
],
"extensions": {
"code": "ARGUMENTS_OF_CORRECT_TYPE",
"codes": [
"ARGUMENTS_OF_CORRECT_TYPE"
],
"number": "5.6.1"
}
}
]
}
OK, then this is a problem. I will investigate what needs to be done here. It probably shouldn't be Long! but just Long. So we might need to update the schema.
Thank you.
The correct mutation when this is fixed will then be the following:
mutation createText($cid: Int, $textType: Long!, $text: String!, $language: Int! = 1) {
useCompany(no: $cid) {
text_create(
values: {textType: $textType, textNo: null, languageNo: $language, text: $text}
suggest: {textNo: true}
) {
items {
textNo
}
}
}
}
That should work, unless there is a different order of the fields that is required by the particular business logic here, and textNo can't be the last one provided. But if you ran it and it works then it's all good (for now).
Copyright © 2022 Visma.com. All rights reserved.