on 2018 Jan 25 8:25 AM
Hi, SOLVED: I have defined the following relation
<relation code="Product2TextBlocks" localized="false">
<deployment table="prod2textblocks" typecode="20087"/>
<sourceElement type="Product" qualifier="products" cardinality="many"/>
<targetElement type="TextBlock" qualifier="textBlocks" cardinality="many"/>
</relation>
and after importing products and textblocks separately (via impex), our customer imports the relation between them separately, e.g.:
INSERT_UPDATE Product2TextBlocks;source(catalogVersion(catalog(id[default=masterCatalog]),version[default=Staged]),code)[unique=true,allownull=true];target(catalogVersion(catalog(id[default=masterCatalog]),version[default=Staged]),code)[unique=true,allownull=true]
;1097052;134272560
Upon this relation-import, I need to add some logic which copies the value of a string field within textblock to the product item.
Is there any way to intercept this import? Normal PrepareInterceptors do not work, since the relation has no model (see also https://answers.sap.com/questions/12756513/how-to-intercept-a-relation-after-changing-model.html The suggested solution in there is not a way I like to go: "you can create your own Category2ProductRel table, assign a jalo class to it in items.xml and add a so that it generates a Category2ProductRelModel and then do an insert update")
Then, I tried using an AfterSaveListener, but printing out the event's PK typecode doesn't show my relation's typecode 20087 (afterSaveEvent.getPk().getTypeCode() for each afterSaveEvent).
Any help would be highly appreciated. Thx, Joachim
UPDATE UPDATE: The AfterSaveListener approach works, problem was that the relation was already imported before, so the Listener didn't save the record again (really stupid mistake). Removing it beforehand via Backoffice and re-importing via Impex successfully triggered the Listener on the relation's typecode.
Request clarification before answering.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.