SAP Hybris Impex - Set product in catalog to unapproved - sap-commerce-cloud

I'm looking to mark several thousand products in a Hybris catalog to unapproved in the Approval status field. The following Impex file will update the status to approved but I can't figure out what to change to get mark these as unapproved. I've placed the following text between the ;; with no change - unapproved false 0 'unapproved' 'false'.[![Screen snip - SAP Hybris product approval status field][1]][1]
$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Online'])[unique=true,default=$productCatalog:Online]
$approved=approvalstatus(code)[default='approved']
INSERT_UPDATE AviallProduct;code[unique=true];$catalogVersion;$approved
;BUS70M222AT99=M1;;
[1]: https://i.stack.imgur.com/rNQ2b.png

You can simply use :
$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Online'])[unique=true,default=$productCatalog:Online]
$unapproved=approvalstatus(code)[default='unapproved']
INSERT_UPDATE AviallProduct;code[unique=true];$catalogVersion;$unapproved
;BUS70M222AT99=M1;;
Or :
$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Online'])[unique=true,default=$productCatalog:Online]
$approved=approvalstatus(code)[default='approved']
INSERT_UPDATE AviallProduct;code[unique=true];$catalogVersion;$approved
;BUS70M222AT99=M1;;unapproved

Related

flexi search inside the impex

I want to write an impex to disable an account with an particular user-id which contains the particular email id.
let's say if email xyz#abc.com is associated with the user id xyx then xyz account should be soft disabled (loginDisabled should be true).
For getting the xyz user-id i gonna run the flexi search :
select {emp.uid} as empid from { Employee as emp} where {emp.email} = 'xyz#abc.com'
this will return me the user-ids containing the email as xyz#abc.com
and to disable a account i can run the impex as :
UPDATE Employee; UID[unique = true]; groups;loginDisabled[default=true];
xyz;;true
Now i want that both the Felxi serach and impex should be combined and the flexisearch should return the userid and impex part should disable the account, i have tried below impex but it didn't did anything:
UPDATE Employee; UID[unique = true]; groups;loginDisabled[default=true]
"#% impex.exportItemsFlexibleSearch(""select {emp.uid} as empid from { Employee as emp} where {emp.email} = 'xyz#abc.com'"");"
Thanks in advance for the help.
I tried running
UPDATE Employee;PK[unique=True];groups(uid);loginDisabled[default=true] "#% impex.exportItemsFlexibleSearch("" SELECT {emp.pk} FROM { Employee AS emp} WHERE {emp.email} = 'xyz#abc.com' "");"
But no luck the impex is running without any issue but does not reflect the changes in backoffice
I would suggest using a groovy script instead of flexible search.
The impex.exportItemsFlexibleSearch is, as the name say used for export only, so you are not be able to use it in import. If you want to use impex, then you should export first using impex.exportItemsFlexibleSearch, change the value in the csv, then re-import it again.
I'm sorry I misunderstood the question. I thought you were trying to export the data.
This is how you disable the log-in using impex:
UPDATE Employee;uid[unique=true];loginDisabled[default=true]
;xyz#abc.com;

Can not see mystore catalog on WCMS/catalog (hybris)

I created b2b store. I changed mystoreinitialdata/impex store names to my store name.
# -----------------------------------------------------------------------
# [y] hybris Platform
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
#
# This software is the confidential and proprietary information of SAP
# ("Confidential Information"). You shall not disclose such Confidential
# Information and shall use it only in accordance with the terms of the
# license agreement you entered into with SAP.
# -----------------------------------------------------------------------
# ImpEx for Points of Service
# Macros / Replacement Parameter definitions
$storeUid=mystore
$productCatalog=mystoreProductCatalog
$catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Staged'])[unique=true,default=$productCatalog:Staged]
$storeImage=storeImage(qualifier, $catalogVersion)
INSERT_UPDATE OpeningSchedule;code[unique=true];
INSERT_UPDATE WeekdayOpeningDay;openingSchedule(code)[unique=true];dayOfWeek(code)[unique=true];openingTime[dateformat=hh:mm];closingTime[dateformat=hh:mm];
INSERT_UPDATE SpecialOpeningDay;openingSchedule(code)[unique=true];date[unique=true,dateformat=dd.MM.yyyy];closed;openingTime[dateformat=hh:mm];closingTime[dateformat=hh:mm]
INSERT_UPDATE Address;&addrID;streetname;streetnumber;postalcode[unique=true];town[unique=true];country(isocode);region(isocode);phone1;owner(PointOfService.name)[unique=true]
INSERT_UPDATE StoreLocatorFeature;code[unique=true]
INSERT_UPDATE PointOfService;name[unique=true];type(code);address(&addrID);latitude;longitude;geocodeTimestamp[dateformat=dd-MM-yyyy];$storeImage;openingSchedule(code);basestore(uid)[default=$storeUid];features(code)
UPDATE PointOfService;name[unique=true];features(code);
INSERT_UPDATE PoS2WarehouseRel;source(name)[unique=true];target(code)[unique=true]
impexes like that.
Then i made ant initialize and when i go to backoffice/catalog/catalogs
i dont see my store. (which is mystore)
i see default ones apparel, powertools etc just like before.
What should i do, java side things?
this is content catalog/catalogimpex
# -----------------------------------------------------------------------
# [y] hybris Platform
#
# Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
#
# This software is the confidential and proprietary information of SAP
# ("Confidential Information"). You shall not disclose such Confidential
# Information and shall use it only in accordance with the terms of the
# license agreement you entered into with SAP.
# -----------------------------------------------------------------------
#
# Import the Content Catalog
#
$contentCatalog=mystoreContentCatalog
$languages=ja,en,de,zh
# Content catalog for CMS contents
INSERT_UPDATE ContentCatalog;id[unique=true]
;$contentCatalog
# Catalog versions for content catalogs
INSERT_UPDATE CatalogVersion;catalog(id)[unique=true];version[unique=true];active;languages(isoCode)
;$contentCatalog;Staged;false;$languages
;$contentCatalog;Online;true;$languages
The impex you sent actually does not change a single item. Impex uses a header where you define the operation (INSERT, INSERT_UPDATE, UPDATE, REMOVE), what data type you want to change and the attributes you want to change. In the next lines there need to be one or more lines of csv data.
Consider this example:
UPDATE PointOfService;name[unique=true];features(code);
;myPointOfService;feature1,feature2;
This impex script changes the point of service identified by its name (myPointOfService) and sets the attribute features to the two features identified by the feature codes feature1 and feature2. First line is the header and second line is the data. Since your script only contains headers, there will be no change.
If you want to create a catalog consider changing the following files:
/mystoreinitialdata/resources/mystoreinitialdata/import/coredata/contentCatalogs/catalogName/catalog.impex
/mystoreinitialdata/resources/mystoreinitialdata/import/coredata/productCatalogs/catalogName/catalog.impex

Set (content) approval status in workflow [Sharepoint 2013]

I have a custom list with approved and not-approved items.
Now I created a workflow that changes the value of one of the fields.
Problem is: After running that workflow, the Approval Status of this item is automatically set to "Pending". But I don't want to change this status.
I tried to switch on/off the checkbox "Automatically update the workflow status to the current stage name" but no effect.
I also tried to set the variable inside the work flow:
Set Variable: ApprovStatus to CurrentElement:Approval Status
then Update item in CurrentElement
then Set Workflow Status to Variable: ApprovStatus
Go to End of Workflow
How can I keep the current Approval Status (or set it to the value that it was before)?
When a item is (manually) approved, will it also work then?
I got it!
Solution was to use a Sharepoint 2010 workflow instead of 2013:
Set Variable: AprSt to Current Element:Approval Status
Update item in Current Element
If Variable: AprSt not equals 0;#Approved
Set content approval status to Pending with comments
Else
Set content approval status to Approved with comments
Now it works.

Hybris: Display Custom Promotion only in Product Cockpit

I have created a custom promotion in hybris by overriding the default ProductPercentageDiscountPromotion. But I was wondering how to display the new custom promotion only and not the old original one on Product Cockpit.
I found there are two files
1. wizardConfig_PromotionUserRestrction.xml
2. editorArea_Category.xml
These files contain a property "AbstractPromotionRestriction.promotion" which has its parameter entry "excludeCreateTypes" that contains the list of Promotions to exclude eg:
value="ProductBundlePromotion,ProductOneToOnePerfectPartnerPromotion..."
When I write the ProductPercentageDiscountPromotion name in this list and initialize the Hybris system from Admin console, then this old promotion is not visible in Product Cockpit. But I cannot initialize, since it will erase all the project data. I have to update the Hybris system to do this, but it's not working. Any ideas?
PS: I don't have authority to post this question on Hybris Forum.
Many thanks!
Updates in the cockpit xml files (like configuration for editor area, wizard, etc) are successfully applied after:
run an update in /hac + set the check-box for product cockpit during that;
reset user settings in cockpit menu.

SharePoint document approval workflow, modified and approved by fields

I working on a SharePoint document approval process and here is the scenario: A document is uploaded in the document library, and approval process is initiated. A task is created and assigned to a group (Active directory group) where only one group member can complete the task. What is required is the modified by and approved by fields to display the name of the user who completed the task and not the group name that the task is assigned to.
1) I have tried the out of the box workflow, and if displays system account as the user who completed the task.
2) I have tried SPD approval workflow, and it displays the group name assigned to.
3) I have tried VS sequential workflow :
With VS workflow, I’m able to set the correct user to the two fields (modified by and approved by) and as the last step I need to set the approval content status as follows:
item.ModerationInformation.Status = SPModerationStatusType.Approved; (if approved)
But this runs with system account permission and not the current user, so it resets the field approved by back to system account, and if I swap the sequence of my steps and set the content status first then update the fields last, obviously I’m doing a modification on the item so the content status changes back to draft.
Is there a way I can run this item.ModerationInformation.Status = SPModerationStatusType.Approved; under the current user? Or any way I can achieve my goal?
I would suggest leaving the system columns alone and creating a completely different set of columns for your purposes.
So Create the columns: "Item Modified By", "Item Approved By"
Then write the current user to these fields.
Lastly, remove the system generated "Modified By" and "Approved By" from the default view and replace them with your "Item Modified By" and "Item Approved By" columns.

Resources