hybris FlexibleSearchService can't find a product that actually exists - search

I'm trying to add a product to my cart, like this:
cartFacade.addToCart("M300044", 2);
And it fails with: Product with code 'M300044' not found!
When I debug the code, I find that this query is executed by FlexibleSearchService.search(query):
SELECT {c:pk} FROM {Product AS c} WHERE {c:code}='M300044'
If I execute this query on my hybris Admin console, I do get a Product as a result.
Why can't FlexibleSearchService find it though? Is it something to do with setting a catalog version somewhere?

In this case it was because I was doing this from a Test class, so hybris couldn´t find the product because there was no data whatsoever in the junit tenant.
So I had to create the data in the setup method of my Test class, which is executed before the actual test method is called.

You need to make sure one more thing that you have set the session user = admin , because if there is a restriction applied on u r product then your test case won't work

I believe this is a SYNCHRONIZATION issue.
STAGED Product Version is not aligned with Online.
You have two options.
HMC > System > Facet Search > indexer wizard.
Product Cockpit.

Check available stock for product in hmc. May this help you

initialize Junit tenant so by checking import sample data yes so that data which you have in production will be available for testing.

you need to make full SOLR indexing for the products from hmc before they can appear in front end store or using hypris APIs
hope that help

Related

Is there a simple example on how to add an entity extension for customers with field in the admin of shopware 6?

I want to add an entity extension to a customer in shopware 6. I was able to do so with the examples in the documentation of shopware on the PHP side and now I wonder how to display and modify this new "field" in the shopware 6 backend.
I searched a lot and also tried to find a simple plugin where I could get some inspiration from, but unfortunately I'm not able to find.
So again the question 😊 Is there any simple example on how to add an entity extension for customers with field in the admin of shopware 6? Or an example plugin, where I can see how it could be done?
What you're (likely) trying to achieve would be the combination of multiple separate tasks.
If you want to store data in the database you'd need a new custom entity
If you want to associate the new entity with the customer you'll need the entity extension
You'll need to add a new field in the administration
I've linked to examples respectively, but you'll probably need to take the time and invest in studying the documentation regardless.
I also created an example plugin that combines all these steps and adds a new entity with a height field as association to the customer and displays the field in the administration. You can find the repository here.
Not sure if you considered this, but depending on what you are trying to accomplish, the simplest way is probably adding a custom field (this can be done progamatically or even via the admin panel).
The drawback is, that those fields' values are stored as JSON and it has drawbacks when you try to search through them.

Hybris backoffice searching of order table

How the order report data is being searched in back office. Want to know (how) in which location/java file, the queries with order report filter parameters is getting fired on order table?
Are they being fetched via Flexible search queries or is there any other way to search also?
I don't now exact class but I can give trick for finding it. Add custom interceptor for order item. Run project in debug mode. Add break point to interceptor. When code stop on your breakpoint, check call stack for metod, class, etc.

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');

IBM Maximo: Start Center and Multiple Tables

I am trying to help a colleague out. I created a query in IBM Maximo 7.6, it is in the work orders table but I added a sub query that pulls from the workflow table and filters for anything in Work Flow.
My question is: On the start center, is there anyway to modify the results set so that we can pull fields from work order and work flow? I have work number, status, and vehicle. Basically, is it possible to bring in what inbox the work order is in, on the results set, in graphical form. So, put together a bar graph based on the inbox?
Any direction would be great, thank you!
First, you need to make sure there is a Relationship on the WORKORDER object in Database Configuration that will find the workflow record you want to see info from for a given work order. Once you've done that, these instructions show you, step by step, how to create Report Object Structure (ROS) (an Object Structure "Consumed By" Reporting), how to grant access to the ROS, and then how to use the ROS in a Result Set portlet to access data in related objects.

How can i provide role based security to notes in MS CRM 2011

I am working on Notes in MS CRM 2011.
I have many roles over many entities.
I want role based security to notes for any entity records.
let me explain what i want:
Suppose i have an entity namely E1.
Role R1 and R2 has read and write access to E1.
But i want that user having role R2 can only upload and view notes for any record of entity E1.
Hope now my requirement is clear to all of you.
Please suggest me how can i achieve it using MS CRM 2011.
I can think of two ways to do this.
You can create a plugin on create/update of the annotation(note) and check if the note is related to entity E1 and check the roles of the user making the change and see if they only have the R2 role. If that is the case you can throw an InvalidPluginExecutionException with a message like 'You do not have permissions to edit/create these records'.
You can try using role based forms or JS to hide the notes area for R1 users.
You probably want to use a combination of #1 & #2. The users can still access the notes via advanced find and thus will be able to edit those notes. The plugin will prevent that fringe case as well.
*Edit
There are a couple more things that you might be able to deal with the advanced find records. You can remove the annotation entity from advanced find via the unsupported method described here.
Otherwise there is one more thing you can do if you want to prevent those results showing up at all, and you want to stay supported. You can write a plugin on Post-RetrieveMultiple of the annotation entity to strip out the results directly from the return result. There are a couple downsides to this though.
You are executing your plug-in every time the retrieve multiple is called on the entity. So this code will need to be as efficient as possible since that delay will be noticeable by the end user whenever they retrieve these records.
Things like advanced find will display odd results. For example if your paging is set to 50 records and you strip out 10, they will only see 40 records on their page and the total record count will include the records you are stripping out.
Through roles i don't know a way to do that, because you configure the access to notes generic, so applies to all entities. You have to access with Javascript navigating in DOM. Check a example:
document.getElementById("notescontrol").contentWindow.document.getElementById("NotesTable")
You can check this with the help of a develeper tool in your browser.

Resources