2

I have a function that localizes a Component (if needed) before updating its content. I'm randomly getting errors when, after this call, I try to update the content, getting a 'It is not possible to check-out a shared item' error. Taking a look at the logs, I see that component was not localized. The only reason is because this item.BluePrintInfo.IsLocalized is lying.

Here my code...

```

ComponentData item = (ComponentData)client.Read(tridionItemUri.ToString(), new ReadOptions());
    if (!(bool)item.BluePrintInfo.IsLocalized)
    {

        client.Localize(tridionItemUri.ToString(), new ReadOptions());
        Logger.Info(new TridionItemLog() { Message = "Component localized", Tcm = tridionItemUri.ToString() }.ToString());
    }

```

If I go to SDL Web and manually localize the Component, then I can update with no problem.

So my question is. Could this BluePrintInfo be cached or not realtime info? Should I use another way to check whether my Component is localized?

Thanks in advance.

BTW: It's SDL Web 8.5 SP1

  • 1
    When you say 'randomly', does that mean that it only happens for certain components or if, for example, you ran it 100 times on the same component then IsLocalized could give different answers each time? – Jonathan Williams Jan 16 at 13:22
  • Yes, only for certain components. Never the same component with different IsLocalized value. And randomly also for the schema of those components. They are not based in some specific schema that always fail. Tx. – Xavier Casals Jan 16 at 13:54
  • 1
    I'd recommend reproducing that with a simple console app, and submitting to Customer Support - if it can be reproduced, it is most certainly a defect. - never mind, just saw the discussion on @JonathanWilliams' answer. – Nuno Linhares Jan 16 at 14:28
2

With regards to your question of "Could this BluePrintInfo be cached or not realtime info?", the answer is 'No'. If there was a level of caching then this would need to be configured when multiple Content Manager servers are load balanced, and this is not the case.

I've just run the following test to verify this also (using the Core Service):

  1. Create a new component in 300 level
  2. Check `IsLocalized' in 300 = False
  3. Check `IsLocalized' in 400 = False
  4. Localise the component at 400
  5. Check `IsLocalized' in 400 = True
  6. Check `IsLocalized' in 700 = False
  7. Promote component from 300 to 200
  8. Check `IsLocalized' in 300 = False
  9. Check `IsLocalized' in 400 = True
  10. Check `IsLocalized' in 700 = False

This all seemed to be as expected and didn't show any signs of caching.

I see that IsLocalised is a nullable boolean. I wonder under what circumstances it is null? Maybe an SDL insider can answer that, as the CHM documentation doesn't give any info.

I also tried creating a new component and saving it but not checking it in. This created a v0.1 of the component, but this too seemed to have the correct IsLocalized value in the child publications (even when localised in the child publications).

If this error is consistently repeatable then I think you should raise it as a bug with SDL Support.


Update:

Are you re-reading the component (i.e. the value of item) after the localisation has taken place? If not, then you may want to tweak your code to the following:

item = Client.Localize(item.Id, new ReadOptions()) as ComponentData;

That will update the item object with the newly localised version of the component.

| improve this answer | |
  • Thank you for your time on doing this test. That nullable bool should mean something. And maybe my code is failing there. I cannot raise a bug with SDL yet as I cannot see or understand under what circunstances this is failing. I don't want to report a bug when there is a 99% that the bug it's in my code ;) Let's see if somebody tell us what the 'null' value is. Thanks again – Xavier Casals Jan 16 at 14:06
  • No problem. I've added a small update to my answer. – Jonathan Williams Jan 16 at 14:15
  • 2
    In general, all properties of Core Service Data Objects are nullable, because objects can be partially loaded. This happens in particular when you are getting a list of objects. When retrieving an object through the Read method, it should be fully loaded, so no properties should be null. – Rick Pannekoek Jan 16 at 14:45
  • That's really useful to know. Thanks Rick. 👍 – Jonathan Williams Jan 16 at 14:57
  • Hi. Answering to your update. I will reload the component data when localizing, that seams to be a good practice to ensure I have the latest info, but that don't solve my main issue. My real problem is that tridion says it is actually localized, so I skip (out of the 'if then') the Localize call. I have to make an effort and find a pattern in this error. But remember Murphy laws, this is only happening in a client production environment, not in dev and not in my own environment... Thank you. – Xavier Casals Jan 19 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.