cancel
Showing results for 
Search instead for 
Did you mean: 

Error: could not translate value expression 'session.catalogversions'

pavan-yvs-1
Explorer
0 Kudos
1,845

Hi,

While a custom Cronjob runs, we are getting an error - Error: could not translate value expression 'session.catalogversions'
There are many active search restrictions in the application, whereas this issue is caused by a particular searchRestriction that has below details

Restricted type: DiscountRow
Applies on: CustomerGroup
Filter: ({item:product} IS NOT NULL OR{item:catalogVersion} IS NULL OR {item:catalogVersion} IN (?session.catalogversions))

We are migrating from 2011 to 2205, We have other environments with same code and the restriction in 2011 version, where we do not face this issue. It only occurs in 2205 version.

Session user is admin in RUN AS tab of my cronjob. So since this restriction is on customergroup, it should not be applicable to admin in my understanding.

Any thoughts how can I resolve this without disabling the searchrestriction?

Thanks in advance!

View Entire Topic
pavan-yvs-1
Explorer

I found the issue.
In 2205 they introduced a new property
cronjob.ctx.filtered.attributes.in.impex.import.mode=disableRestrictions,disableRestrictionGroupInheritance,use.fast.algorithms,import.mode,disable.attribute.check,disable.interceptor.beans,disable.interceptor.types,disable.UniqueAttributesValidator.for.types,currentCronJob,currentJob,core.types.creation.initial,save.from.service.layer,ctx.enable.fs.on.read-replica,impex.creation

Till 2105, we do not have this property and in cronjob context disableRestrictions attribute is always set to true and restrictions are not applying on cronjobs.

After they introduced this property, the attribute is not set to cronjob context and it takes it as false by default, and the restrictions are not disabled for cronjobs.

Now I have overridden this property in core project.properties as below (removed disableRestriction)
cronjob.ctx.filtered.attributes.in.impex.import.mode=disableRestrictionGroupInheritance,use.fast.algorithms,import.mode,disable.attribute.check,disable.interceptor.beans,disable.interceptor.types,disable.UniqueAttributesValidator.for.types,currentCronJob,currentJob,core.types.creation.initial,save.from.service.layer,ctx.enable.fs.on.read-replica,impex.creation