Bug reports Found a bug? Post it here please.
Version 6.x > Bug reports > Macro expressions not exported properly View modes: 
User avatar
Member
Member
DahlinDev - 8/6/2012 3:12:50 PM
   
Macro expressions not exported properly
I have a page that uses Macros in a few different webparts.

When I export this object and import it into a new environment it is like the macro stops working.

I have to edit the webpart and then find the section using the macro click on the little triangle "edit value" then in here save it or enter it in here if it doesn't populate and save it.

Once I re-save it, it works fine.

User avatar
Member
Member
DahlinDev - 8/6/2012 3:17:51 PM
   
RE:Macro expressions not exported properly
I just went to re-save one macro that wasn't working and the value was this when I went to edit it:

DocumentID != {%CurrentDocument.DocumentID %}

I have no idea where there "|(user)dahlindev|(hash)f2c71936597eea6f50f961a7094993459af24e51cf154f75b41032875f810dc0" got inserted from.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/7/2012 12:21:32 AM
   
RE:Macro expressions not exported properly
Hi,

It is due to the macro security.

The macro is signed with the user's hash and this is different on each environment - therefore you need to re-save it so a new hash code is generated for given macro.

Best regards,
Juraj Ondrus

User avatar
Member
Member
DahlinDev - 8/9/2012 3:25:19 PM
   
RE:Macro expressions not exported properly
Hmm, is there a work-around to this? Perhaps having the same user import the object that saved the object in the other environment?

This seems to really defaut the purpose of the ability to migrate an object if I have to go into that object and re-save multiple fields in order for it to work.


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 8/9/2012 6:02:33 PM
   
RE:Macro expressions not exported properly
Hi,

have you tried to add @ at the end of macro as described in the link Juraj provided you?

Best regards,
Ivana Tomanickova

User avatar
Member
Member
DahlinDev - 8/14/2012 11:33:58 AM
   
RE:Macro expressions not exported properly
This worked, thank you!

User avatar
Member
Member
kiat-earth9 - 4/9/2013 4:47:59 AM
   
RE:Macro expressions not exported properly
Is there an UI or something that can allow me to disable the user security thing other than adding @ at the end of the macro ?

What happens to people with more than 100 macros ? I have to manually add a @ at the end of each macro?

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 4/19/2013 10:37:32 AM
   
RE:Macro expressions not exported properly
Hi,

You could maybe allow simple macros only - see DevGuide - web.config parameters - CMSAllowOnlySimpleMacros key.
If true, only simple macros (i.e. those which do not need a security check) are allowed. All others will not be resolved. If true, CMSTextBox does not add security.
The default value is false.

Otherwise, you'll need to handle it either manually, or using some API (or DB script)...depending on the scale and number of places where it would need updating.

Regards,
Zdenek