Shopware 6 Error: Provided language is not in list of available languages. What is the cause and how can i solve it? - shopware

While trying to save a new customer i get this error in my dev.log
Uncaught PHP Exception RuntimeException: "Provided language 2fbb5fe2e29a4d70aa5854ce7ce3e20b is not in list of available languages: " at /home/schcmjkg/staging/vendor/shopware/core/System/SalesChannel/Context/BaseContextFactory.php line 329 {"exception":"[object] (RuntimeException(code: 0): Provided language 2fbb5fe2e29a4d70aa5854ce7ce3e20b is not in list of available languages: at /home/schcmjkg/staging/vendor/shopware/core/System/SalesChannel/Context/BaseContextFactory.php:329)"} []
But the issue is that i have not changed the language at all and i cannot even change it because there are no translatable fields ->
While trying to save the admin panel tells me that it was unable to save the customer but the customer actually get saved. The event "customer.written" is never triggered, it is only triggered after editing the customer.
So what is the cause and how can i solve it? thank you very much.

I was able to reproduce this error. Seemingly "Deutsch" is your default language, which it reverts to since there are no translatable fields, as the tooltip states. I assume you're trying to save a customer assigned to a sales channel that doesn't include "Deutsch" in its languages. That's how I was able to reproduce it. You can get around that for now by additionally assigning "Deutsch" to the languages of the sales channel. There shouldn't be a language switch in the storefront as long as you don't define a domain using the language, so it shouldn't come with undesired side effects. At least then you should be able to save customer assigned to that sales channel without that exception being thrown. Eventually this undesirable behavior will be fixed though.

Related

Detect an Invalid User Attribute Field entry in OIM and send email notification based on the user type

I am required to create a Java Script but unable to figure on how to proceed as I don't have that much of coding idea in OIM, can someone assist(below I have mentioned the scenario)
Scenario:
In OIM User Attribute Page, there is a User Field: 'Job Code' now we have experienced that there are some issues we are facing.
From the trusted source we are getting the correct data but as soon as it reaches OIM for few users we are getting random incorrect value. Value should be numbers (123456) which is present in the Database too and valid but for few we are receiving values like E?401#q something like this.
We are required to place a check to find users who are having these invalid Job Code entry.
Once detected, we need to trigger a email to the concerned team based on the User Type (Employee or Contractor) for employee it should trigger an email to a respective team and for Contractor we have to trigger to a different team to take action.
So, I believe we have to place two conditions here, can someone assist.
If you believe it only happens during trusted source reconciliation, then you can create Post-Process Handler on User Create/Modify operation to check the value which was posted into the DB as a result of recon event.
From this handler you can do all the things you need to do: mailing, fixing, etc.
For notification purposes I'd recommend to use built-in NotificationService, though it might be bit daunting, if you have little experience in OIM development. As an alternative you can do java mailing.
If you are not sure about the moment, when this "spoiling" happens, you can create a scheduled task, to be executed periodically, which will check JobCode values, to report invalid ones.

Hybris - checkout - object no longer valid error

For some unknown reason, during the checkout flow a global message error appears saying Item no longer valid (was removed) - Object no longer valid
when we check its the item is a cart entry which is no longer valid
we found a similar issue raised in git hub. Below is the GitHub issue link,
https://github.com/SAP/spartacus/issues/5596
We wanted to know if any solution was discovered for this issue
We have below versions,
Hybris - 1905.7
Spartacus - 1.4.4
This is a known case with multi-dimensional products.
Generic variant product is dependent upon the Product as a partOf attribute. But in some scenarios when the GenericVariant product instance is modified without modifying the base product then sync deems that genericvariant instance as an orphaned one that should not be related to the product so it deletes the variant and recreates one.
Now in the checkout, the PK of the entry changes as the sync has created a new Online variant due to the above reason. Since the cart contains the entry of the earlier variant with another PK which could not be found, the error of "Object No Longer Valid" is thrown.
This is not traceable as the same product is available in the cart entry (but with a different PK)
The below approach of modifying the sync description through Backoffice-> System -> Multithreaded Synchronization should help to resolve this.
In the below screen, I have disabled sync of Product Variants [Variants] (The selected node). By default, it is ticked.
CX Jira References:
https://cxjira.sap.com/browse/ECP-3394
https://cxjira.sap.com/browse/ECP-5494
I believe this is also related or very similar to the backend, which throws the error type 'JaloObjectNoLongerValidError'
For Spartacus release 5.0, which should be coming somewhere in March 2022, we have fixed this issue by creating a backoff mechanism, which retries the request when the error is thrown.
An example of it's usage can be found in here.
Moreover, you can see the mechanism in action from this end to end test.

How can I set the shipcarrier to More on a sales order using SuiteScript in a RESTlet?

SuiteScript v1, but I'll switch to SS v2 if it's the only way to make it work.
I've tried:
salesOrder.setFieldText('shipcarrier', 'More');
salesOrder.setFieldValue('shipcarrier', 'noups');
salesOrder.setFieldValue('shipcarrier', 'nonups');
But UPS is always selected once the record is saved.
shipcarrier is a bit of an odd thing.
I'm not sure it is actually sticky - in some contexts it appears to be and in some it doesn't.
It appears to be pointless to set unless you are also setting shipmethod.
salesOrder.setFieldValue('shipcarrier', ffShipCarrier); //'ups' || 'nonups'
salesOrder.setFieldValue('shipmethod', ffShipMethod)
PS from cja: My conclusion/solution: Setting shipmode does nothing unless recordmode is dynamic and shipmethod is set at the same time. If both those conditions are met then the value shipmode will be updated.
NetSuite support have warned me against using this solution:
"With regards to your concern, I am able to set the Ship carrier field on the Sales Order record in the client script(nlapiSetFieldValue('shipcarrier', 'ups');) however I was unable to set the value of the field in the server side script. Upon further investigation, the field (ship carrier) isn't exposed in the Record browser hence the field isn't officially exposed for scripting needs. Please refer to the following Suiteanswer article for your reference.
"I am really glad that the solution worked for you perfectly. In order to explain further, I would say it is not advisable to write scripts using unexposed fields in the record browser. It may change in the future without any prior notification and can cause problem and NetSuite will not hold any kind of responsibility for the same.
"User groups contains simple solution to complex tips and tricks provided by the experienced customers. On the other hand, NetSuite Support are stickly adhering to the official documentation/processes to assist any of its customer. The solutions provided in the User groups are totally upto the consent of the customers and can be implemented at their own risk if not confirmed in the official documentation or NetSuite Support."
You need to use setFieldValue and pass the internal id of the "More" ship carrier.
nlapiSubmitField('salesorder', recordid, 'shipcarrier', 'nonups');

CRM 2011 javascript onchange event not working for system field in another organisation

I have some javascript code attached to the accounts entity. This code sets the requirement level of the primary contact attribute based on the value of a custom option set field showing various account types. This was developed on one server, where it worked, and so the solution was imported into another organisation where it now doesnt work.
It seems to be only on this field as i have changed the code to look at another field and that works fine. The error it gives is that the "Object doesn't support this property or method". Also what is strange is that the field doesn't appear in the list under the entity within the solution despite it being a system field.
The code i'm using is:
Xrm.Page.getAttribute("primarycontactid").setRequiredLevel("required");
Can anyone help me figure out what it's doing?
Thanks
EDIT: Found that the code is actually making the field required despite the error, but it's not displaying the * next to it. Also if I make the field required in it's settings then it does the same thing

Translate Drools-generated facts

First off: If I am totally wrong with my request, please close this and point me into the right direction.
I use Drools (with Guvnor-created rules) in a JSF application for the verification of a created object. Basically, the workflow is:
user creates an object
rules are fired to check this object
rules for which the check fails insert a new fact into the working memory with some message, explaining why the verification failed
the facts are extracted from the working memory and displayed in the JSF application
My question: What is the best way to translate these messages? Are there any "best practices" for such scenarios?
What do you mean? Translate to different languages? You can use a different properties file and resolve the right text based on those files, right? as in every application that you want to use internationalization (I18N).
Cheers
You can have a "user message" object with message ids and insert this as a fact. In the rule, set an appropriate message id. In the presentation layer, map the id to a message string in locale-specific string table.

Resources