Dynamic Property issue

tobias.gladh
Member since: 2007
 

Upgraded the site to R2 today wich went rather OK. Some issues had to solved but one that is really bugging me is a case with a dynamic property we use as an id i different trees of the page.

On one pagetype we have the ability to override this id setting with a property named exactly the same. But here comes the problem: the id is empty on every language different from the one the page initially was created on if the local property isn't set.

This issue didn't occured in R1 and I've tried to read about any change in this but can't find anything stating this.

#30803 Jun 22, 2009 17:01
  • Per Bjurström
    Member since: 1999
     

    Can you give me a 1,2,3 repro for your problem, I am not sure I understand exactly how you have configured the properties with "language specific" etc.

     

    #30812 Jun 23, 2009 9:59
  • tobias.gladh
    Member since: 2007
     

    We have a dynamic property called pId which helps us retrive data from our companydatabase. On one pagetype we have a local property also called pId so that we can retrive data for this page with a different criteria. This property is not set to be unique per language. If I now create a page based on this pagetype on english the page work just fine using the dynamic property. If I then create the swedish version of the page I get the error "ObjectReference not set as an instance of an object" pointing towards the code CurrentPage["pId"].ToString(). If I wrap the assignment of the variable with this line:

    string pId = IsValue("pId") ? CurrentPage["pId"].ToString() : string.Empty;

    it is empty. However if I set the property pId on the page all works just fine.

    FYI: The dynamic property is not set to be unique per language either

    As I said all worked just fine pre-update.

    #30815 Edited, Jun 23, 2009 10:36
  • Per Bjurström
    Member since: 1999
     
    CMS Version ? RTM, SP1 or SP2 ?
    #30820 Jun 23, 2009 11:21
  • tobias.gladh
    Member since: 2007
     
    Upgraded from CMS 5 R1 SP3 to CMS R2 SP1
    #30821 Jun 23, 2009 11:27
  • Per Bjurström
    Member since: 1999
     

    Thanks, I can reproduce the problem and I am reporting this as a bug. If the property is global for all languages and you are on a non-master language it does not verify that this property is not NULL before returning the value (thus skipping the dynamic property).

    An easy workaround is that if you get an NULL-value back from your current code you do the call for the dynamic property yourself like:

    if(String.IsNullOrEmpty(pId))
    {
    PropertyData dynProp = DynamicPropertyTree.Instance.FindDynamicProperty("pId", CurrentPage.Property); if (dynProp != null && !dynProp.IsNull) { pId = dynProp.ToString(); }
    }
    #30822 Jun 23, 2009 11:51