How can I add a Product Custom Field to the Search in the Admin?
I could not find anything in the Shopware Doku, only for Custom Entitys
I don't think you can add custom fields in the search preferences of your profile yet. You can however add fields by altering the corresponding entry in the table user_config.
For the entry to exist in the database you'll have to first make some changes in the search preferences of your profile.
Then find the entry for the correct user id in user_config. The column value contains the search preferences as json.
Edit that json to your liking, for example to add a custom field of a product to the searchable fields:
[
// ...
{
// ...
"product": {
// ...
"customFields": {
"the_technical_name_of_a_custom_field": {
"_score": 500,
"_searchable": true
}
},
// ...
},
// ...
},
// ...
]
Related
I try to create a new list item, in general work fine, buy I have trouble with Person field.
On my list, I have two columns:
Employee -> Person type - it's for employee
EmployeeId -> Text field - it's like Employee ID from ex. AAD
EmployeeSuperior -> Person type - it's for employee superior
I need to create new item with filled only the Employee I got errors.
If request body is like:
{
"fields": {
"EmployeeLookupId": "6"
}
}
A new item is created by field EmployeeId is filled, but Employee is empty.
If request body is like:
{
"fields": {
"EmployeeLookupId": 6
}
}
I get error:
"message": "General exception while processing",
If request body is like:
{
"fields": {
"EmployeeSuperiorLookupId": "6"
}
}
A new item is created by field EmployeeSuperior correctly.
I think the EmployeeId field is confusing for MS Graph. But I cannot remove it, but I want to use MS Graph for adding new items.
Has anyone how write good request body?
I tried a few combinations of request body, on new list with the same fields but with new names. For my tests I'm usingĀ Graph Explorer, no test in other ways.
I am working on specify ACL fields for fields inside objects. I have the validator to check for permission to edit a specific field. For example, the schema looks like this:
"basic_info": {
"properties": {
"cadi_id": {
...
},
"analysis_keywords": {
...
},
"abstract": {
"type": "string",
"title": "Abstract",
"acl": {
"users": ["test#test.org", "test1#test.org"]
}
},
"ana_notes": {
...
},
"conclusion": {
...
}
},
"title": "Basic Information",
"type": "object",
"id": "basic_info",
"required": ["cadi_id"]
}
I have the abstract field with acl. It works fine when the user(not in acl) is editing the abstract field and the validation error is thrown when the user is not in acl.
The problem comes when user(not in acl) is editing other field like conclusion and have the same ValidationError.
When editing any field in basic_info, for example conclusion field, the whole basic_info object is processed in the validator beacuse it's the parent field and now user should be able to edit the conclusion field because there is no acl set. but it gives the ValidationError because we also receive the abstract (which is unchanged) in the basic_info and it goes to validate method and since the user is not in acl it gives ValidationError .
Please let me know what I am missing here to let the user(not in acl) to edit the non acl field?
I tried to get the previous value from the db and check if the controlled field is edited by user or not, but it doesn't seems efficient for this use case and I want to know if there is any native way to do the field level validation. I could not find anything in the docs.
I am trying to make a pretty simple mongoDB document to track searches by date in a node.js project. Here's what I'm shooting for:
{
"date": 1626930000000,
"searches": [
{
"search": "search 1",
"count": 2
},
{
"search": "search 2",
"count": 5
}
]
}
I want to update/add new searches to each date and increment the count for existing searches. Then on new dates do the same thing. Here is my current attempt using mongoose:
const query = { date: date, searches: { search: search } };
guideSearchesModel.findOneAndUpdate(query, {$addToSet: { searches: search ,$inc: { count: 1 }}}, { upsert: true, new: true }, callback);
But this is what gets added to the DB:
{
"_id": {
"$oid": "60f9eb370f12712140dd29db"
},
"date": 1626930000000,
"searches": {
"_id": {
"$oid": "60f9eb38c4ff591f50137726"
},
"search": "search 1"
}
Its missing the "count", and if I run it again it inserts a new document, doesn't update the one I want to based on the date.
Any ideas would be greatly appreciated.
Thanks!
The query {searches: {search: "search 1"}} is an exact document search, meaning it will match a document that contains a field named searches that contains an object with exactly 1 field named search with the value "search 1". i.e. it will not match those sample documents, and therefore it will always upsert.
To match fields in subdocuments, use dotted notation, like
{"searches.search": "search 1"}
Also note that the query part of that update matches both a date and the search object, which means if a document exists in the collection with the desired date, but doesn't contain the search in its array, a new document with the date will be inserted.
It looks like you want to conditionally update the document by appending the search to the array if it doesn't exist, and incrementing its count if it does. This will require you to use the aggregation pipeline form of the update command, like Update MongoDB field using value of another field.
How to display other value when I want to add new Prelection
But when I have to choose Event, there is Event Id. How to change it to name?
Could you give me an example, what should I do?
This is what you got asked by JHipster entity sub generator when you created Prelection entity and added a relationship to Event:
When you display this relationship with Angular, which field from 'Event' do you want to use? (id)
Just enter the field name from the related entity you want to use for presentation (by default it's "id").
For your existing entity Prelection, you can edit .jhipster/Prelection.json and change otherEntityField:
{
"relationshipName": "event",
"otherEntityName": "event",
"relationshipType": "many-to-one",
"relationshipValidateRules": [
"required"
],
"otherEntityField": "name"
},
and then re-generate your entity with yo jhipster:entity Prelection.
Does anyone know how to save a Person field using REST?
I have tried the following and it works:
{
"__metadata": { "type": "SP.Data.SomeListListItem" } ,
"MyPersonFieldId" : 1
}
But this only works if you know the ID. I don't have that! How can I get it? I have the key which is i.0#w|domain\userName.
I tried the following and it doesnt work either:
{
"__metadata": { "type": "SP.Data.SomeListListItem" } ,
"MyPersonField" : { "__metadata": { "type": "SP.Data.UserInfoItem" }, "Name": "i.0#w|domain\userName" }
}
Any ideas?? Thanks!
I haven't done this with a Person field, but I did do something similar with a managed metadata field. I basically had to pass in additional information as an object to create the value in the field.
See if passing in the ID of the user along with the name works. I'm about to try this myself as I have the same need.
{
"MyPersonField": { "Name": "i.0#w|domain\userName", "ID": 1 }
}
EDIT: Ok, updating this field is easier than I thought. I was able to perform the update by simply passing in the ID of the user to the Id field:
{
"MyPersonFieldId": 1
}
This means the user should already be in the site collection, so if the user doesn't exist the request will fail.
Use the below code to get Current User ID to save user under People and group column. People column name is Requestor. But to save user we have to specify column name as RequestorId
var userid = _spPageContextInfo.userId; // To get current user ID
var itemProperties={'Title':vTitle,'RequestorId':userid};
The thing is that User information is a lookup field thereby MyPersonField does not exist on your SharePoint list if you use an OData endpoint, I really don't know how to save data but same problem happened to me when I tried to read a user.
for example {server}/{api}/list/getbytitle('mylist')/items does not return MyPersonField instead return MyPersonFieldId.
But if we use:
{server}/{api}/list/getbytitle('mylist')/items/?$select=*,MyPersonField/Name&$expand=MyPersonField
We are able to work with MyPersonField lookup values.