Excel Import of custom mandatory field doesn't work [Hybris 6.7.0] - sap-commerce-cloud

I'm using Hybris version 6.7.0 and I stuck with the following problem:
When I trying to perform importing products from excel file. It gives me the following error ->
I've checked the excel file and there is, of course, field "Subscription Term*", it is mandatory that's why there is an asterisk there. Good to mention that this field is custom, so I write custom translator to it and exporting part works fine, but in importing part when I did debugging I found strange fact:
This WorkbookMandatoryColumnsValidator validator calls the method findColumnIndex(typeSystemSheet, sheet, this.prepareSelectedAttribute(mandatoryField)); from DefaultExcelTemplateService this method returns -1 and the validation does not passed. I dig into this method and there is such line of code:
String attributeDisplayName = this.findAttributeDisplayNameInTypeSystemSheet(typeSystemSheet, selectedAttribute); which returns "Subscription Term" string as you can see without an asterisk.
I've checked the other mandatory fields e.g. "Catalog version*^" it returns with 2 symbols after it.
The thing is that "Subscription Term" and "Subscription Term*" after string equality operation returns false and the validation fails as you can see here:
attributeDisplayName.equals(this.getCellValue(headerRow.getCell(i))).
Of course the second value is taken from the excel file where the asterisk sign presents.
If I remove an asterisk from excel file then I receive: Unknown attributes of type ISku error in WorkbookTypeCodeAndSelectedAttributeValidator validator:
The asterisk should be presented in excel file, I've just checked what would be...
It doesn't help me at all to understand what really happens.
I can't understand one thing: What is the source of "Subscription Term" string? Why without an asterisk? Is it predefined constant somewhere?
From debug I couldn't figure out from which source that string comes from.

I do not know for sure but I expect that string( i.e Subscription Term) to come from a localization file based on backoffice current session language ( e.g {extensionName}-locales_en.properties if the current language is en).
Try to search after "Subscription Term" in all properties files.
Maybe, if the attribute is mandatory(i.e optional="false" in items.xml) then Hybris will add to its name an "*" when performing the import.

Check whether you provided read and write permission to that attribute for that user.
Check with admin user before doing that. If there is no issue with admin user, then only permission issue with the user.

Related

How to change a numeric ID into a sentence in Graylog using pipelines?

I am trying to "beautify" the data I receive from some windows logs on Graylog. My idea is to change the windows log ID from a number to the actual definition for that ID. For example: I receive a log with ID 4625, I want to show in my widget "An account failed to log on".
To do that, I am using a pipeline and a lookup table, which reads the IDs and the respective definitions in natural language from a .csv that I've uploaded on the server.
This is the rule that I wrote for my pipeline, that doesn't seem to work:
rule "eventid_windows_rule"
when
has_field("winlogbeat_winlog_event_id")
then
let winlogbeat_winlog_italiano = lookup("winlogbeat_winlog_event_id", to_string($message.winlogbeat_winlog_event_id));
set_field("winlogbeat_winlog_italiano", winlogbeat_winlog_italiano);
end
I think my problem is specifically in this rule, because Graylog allows to test the lookup tables, and if I manually write an ID, the lookup table finds the respective description.
I solved the issue myself, this is the correct code for the rule:
rule "eventid_windows_rule"
when
has_field("winlogbeat_winlog_event_id")
then
let winlogbeat_winlog_italiano = lookup("eventid_widget_windows_lookup", $message.winlogbeat_winlog_event_id);
set_field("winlogbeat_winlog_italiano", winlogbeat_winlog_italiano);
end
This rule checks if the log has the field "winlogbeat_winlog_event_id", then it generates the new field "winlogbeat_winlog_italiano", associates the numeric value of "winlogbeat_winlog_event_id" with the description in natural language thanks to the .csv that I've created, then puts the description in the field "winlogbeat_winlog_italiano".

Netsuite - Transfer Inventory error

I have been using NetSuite for only a short time, and already hate it. I am sorry if this is a stupid question, but I haven't been able to find an answer so far, either in the Netsuite docs, StackOverflow or other websites. In fact, the answers I found have resulted in an error.
My company requires a script to transfer inventory based on an EDI input file. Reading the file is no problem, even parsing it is working. However, actually inserting the data is proving problematic.
I have been able to insert normal records, but Inventory Transfer records are giving me problems.
From Stack Overflow I found and adapted some code into the following:
var xfer = nlapiCreateRecord("inventorytransfer");
xfer.setFieldValue("trandate", FormatDate("20160101"));
xfer.setFieldValue("location", 9);
xfer.setFieldValue("transferlocation", 9);
nlapiSelectNewLineItem('invt');
nlapiSetLineItemValue("invt","invtid",1, 189);
nlapiSetLineItemValue("invt","adjustqtyby", 1, "5");
nlapiCommitLineItem('invt');
var id = nlapiSubmitRecord(xfer);
The FormatDate function just exchanges the date from the text file into a system date NetSuite can understand.
However, when I run this code I get the following error:
USER_ERROR: You must enter at least one line item for this transaction.
I thought inserting the line item was the reason to use nlapiSelectNewLineItem, but I guess not. Also nlapiCreateNewLineItem doesn't seem to exist.
The values I am inserting are all just test data, as I'm testing this in the debugger. Location 9 exists, as does item 189.
My full script finds these id's based on string values from the text files. But since this is the section that doesn't work I have set it apart to test.
Can anyone help with this?
You did not specify the type of script you are using, but, looks like you are not setting the fields on the record object, but, setting the value on current record. Below, is the suggested code.
Also, there is no sublist named invt, it should be inventory. Also, there is no field as such invtid, I think most probably you want to setup item, the field Id should be item. You might want to refer SuiteScript Record Browser as well for a help on correct Ids
var xfer = nlapiCreateRecord("inventorytransfer");
xfer.setFieldValue("trandate", FormatDate("20160101"));
xfer.setFieldValue("location", 9);
xfer.setFieldValue("transferlocation", 9);
xfer.selectNewLineItem('inventory');
xfer.setCurrentLineItemValue("inventory", "item", 189);
xfer.setCurrentLineItemValue("inventory","adjustqtyby", "5");
xfer.commitLineItem('inventory');
var id = nlapiSubmitRecord(xfer);
If you are using Bin/Lot Numbered Items, please see help topic "Sample Scripts for Advanced Bin / Numbered Inventory Management"

exclude a certain path from all user searches

Unfortunately we have a special folder named "_archive" in our repository everywhere.
This folder has its purpose. But: When searching for content/documents we want to exclude it and every content beneath "_archive".
So, what i want is to exclude the path and its member from all user searches. Syntax is easy with fts:
your_query AND -PATH:"//cm:_archive//*"
to test:
https://www.docdroid.net/RmKj9gB/search-test.pdf.html
take the pdf, put it into your repo twice:
/some_random_path/search-test.pdf
/some_random_path/_archive/search-test.pdf
In node-browser everything works as expected:
TEXT:"HODOR" AND -PATH:"//cm:_archive//*"
= 1 result
TEXT:"HODOR"
= 2 results
So, my idea was to edit search.get.config.xml and add the exclusion to the list of properties:
<search>
<default-operator>AND</default-operator>
<default-query-template>%(cm:name cm:title cm:description ia:whatEvent
ia:descriptionEvent lnk:title lnk:description TEXT TAG) AND -PATH:"//cm:_archive//*"
</default-query-template>
</search>
But it does not work as intended! As soon as i am using 'text:' or 'name:' in the search field, the exclusion seems to be ignored.
What other option do i have? Basically just want to add the exclusion to the base query after the default query template is used.
Version is Alfresco Community 5.0.d
thanks!
I guess you're mistaken what query templates are meant for. Take a look at the Wiki.
So what you're basically doing is programmatically saying I've got a keyword and I want to match the keywords to the following metadata fields.
Default it will match cm:name cm:title cm:description etc. This can be changed to a custom field or in other cases to ALL.
So putting an extra AND or here of whatever won't work, cause this isn't the actual query which will be built. I can go on more about the query templates, but that won't do you any good.
In your case you'll need to modify the search.get webscript of Alfresco and the method called function getSearchResults(params) in search.lib.js (which get's imported).
Somewhere in at the end of the method it will do the following:
ftsQuery = '(' + ftsQuery + ') AND -TYPE:"cm:thumbnail" AND -TYPE:"cm:failedThumbnail" AND -TYPE:"cm:rating" AND -TYPE:"st:site"' + ' AND -ASPECT:"st:siteContainer" AND -ASPECT:"sys:hidden" AND -cm:creator:system AND -QNAME:comment\\-*';
Just add your path to query to it and that will do.

Search formula not working on Linux machine

I have a strange behavior: an agent called via an AJAX request should search documents to display in a calendar. For that reason I compute a search formula and then run the search method of my database in Lotusscript. This is the formula:
form="mholiday" | form="mserviceevent" | (form="mereignis" & co_status!="9") & #texttotime(#text(startdatetime)) >= [29.09.2014] & #texttotime(#text(enddatetime)) =< [10.11.2014]
Everything's fine on Domino on Windows but fails with "formula error" on a Linux machine. Am I missing something?
If I omit the term with the dates everything is fine, so this is the part that causes the error.
Try it with #ToTime() and #Date() instead. That might help to get away from local settings' influence on server:
... & #ToTime(startdatetime) >= #Date(2014; 9; 29) & ...
#ToTime() doesn't convert the field if it's a date time value already.
#Date doesn't depend on local settings whereas [29.09.2014] probably does.
I don't think it's a Linux problem, I think it's a data problem. It sounds like either a date format problem or a problem with the UNK table, used by full text search.
If the first document created on that server that had a field called "startdatetime" had a text value, then any search expects "startdatetime" to be a text value, even if there is another field in the database called startdatetime that is a date or the startdatetime field is subsequently changed to be a date. To confirm this, you can use the search bar and select the field. The operators it offers will confirm if it's expecting a date or a text value. See this answer for details on how to resolve "Query is not understandable" - Full text searching where field types have changed.
Alternatively, it may be a problem with the date format, as Knut says. In which case a test for 9/9/2014 would work but 29/9/2014 wouldn't.

Writing an impex to change the HMC Login attribute to enabled for all employees

I have the current problem that many of my employees in Hybris have the HMC login attribute set to inherit from group, which means that they can't log in to the HMC. This was due to that I used an impex script that set new users to this a while ago. I try now to write an impex script that updates all employees to have HMC access instead. I found the <ignore> tag to be interesting on the Wiki which states that "There is a special value that makes the ImpEx skip the entry and leave the item value at the one it currently is." (https://wiki.hybris.com/display/release4/ImpEx+Syntax). So when I am trying to use the following script:
UPDATE Employee;UID[unique=true];password;description;name;groups(uid);sessionLanguage(isocode);sessionCurrency(isocode);hmcLoginDisabled[default=false]
;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>
I think it should ignore all current values and set hmcLoginDisabled to false. But HAC gives me the following output:
UPDATE Employee;UID[unique=true];password;description;name;groups(uid);sessionLanguage(isocode);sessionCurrency(isocode);hmcLoginDisabled[default=false]
,,no existing item found for update;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>;<ignore>
27.03.2014 15:26:38: ERROR: line 3 at main script: Can not resolve any more lines ... Aborting further passes (at pass 2). Finally could not import 1 lines!
27.03.2014 15:26:38: ERROR: line 3 at main script: Can not resolve any more lines ... Aborting further passes (at pass 2). Finally could not import 1 lines!
Anyone that has any idea on how to write an impex script to solve this?
Just considered Nevins post and came up with this final solution that actually worked:
UPDATE Employee[batchmode=true];itemtype(code)[unique=true];hmcLoginDisabled[default=false]
;Employee
You can just leave the fields blank if you don't want to update the value.

Resources