cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Impex to change default value of itemtype set in items.xml

davidre
Discoverer
0 Likes
2,216

We are trying to change the default value of ImportImpexCronJob logtodatabase attribute via impex. The logtodatabase default value is set in CronJob and redeclared in ImportImpexCronJob *-items.xml.

We do not want to extend/subclass and redeclare the value.

We can update attributes via impex following the advice in this question (https://experts.hybris.com/questions/2379/view.html).

We can for example do the following:
UPDATE AttributeDescriptor;enclosingType(code)[unique=true];qualifier[unique=true];optional ;UserPasswordChangeAudit;passwordEncoding;true

However the following fails:
UPDATE AttributeDescriptor;enclosingType(code)[unique=true];qualifier[unique=true];attributeType(code);defaultValue ;ImpExImportCronJob;logToDatabase;true

From the log the update fails as: 2=ValueEntry('logToDatabase'=logToDatabase,unresolved=false,ignore=false), 3=ValueEntry('true'=null,unresolved=null,ignore=false)value "true"=null, unresolved=null, ignore=false

When I do an export I can see that logtodatabase has an attribute type of java.lang.Boolean but the defaultValue shows as a long encoded string!

So I have a couple of questions: Can I update the default value with impex? If so - how?

Thanks in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

If you see the AttributeDescriptorModel class then you will see that defaultValue is of type Object. It is nor a primitive type neither a reference to another model. And in impex there is no direct way to give an object's value to an attribute. Hence you may try by writing your own translator or using beanshell.

Former Member
0 Likes

Attached is a beanshell which I created for this purpose - Beanshell

NOTE: Any of these changes made to database directly, either by impex or through beanshell will be reverted when system will be updated unless you make the same changes in items.xml as well.