How to remove quotes with no quoteentries?

During our recent migration from hybris 5.7 to 1808 version, I have found that there are few quotes that were migrated but not quote entries under them.

I have decided to remove those quotes from the hybris system. Here is the process I have followed:

  1. Write a flexible query to find the number of quotes:
SELECT {p:PK} FROM {Quote AS p}
SELECT {pr:order}
FROM {QuoteEntry AS pr}
ORDER BY {p:name} ASC, {p:code} ASC

2. Write a Groovy script to execute this query from hac.


flexibleSearchService = spring.getBean("flexibleSearchService")
modelService = spring.getBean("modelService")

query = "SELECT {p:pk} FROM {Quote AS p} WHERE {p:pk} NOT IN ({{SELECT {pr:order} FROM {QuoteEntry AS pr}}})"; {

3. Login to hac -> console -> scripting languages and use the above script.

4. Make sure to enable “Commit” and hit “Execute”

5. Check the results tab to find out the PKs that got removed from system.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s