Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4620524
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:34:19+00:00 2026-05-22T02:34:19+00:00

my question is basically the same as @Bob Black’s Cannot access sitecore item field

  • 0

my question is basically the same as @Bob Black’s Cannot access sitecore item field via API but I agree with @techphoria414 that the accepted solution is not necessary and in my case does not work.

In my own words, I have a template Departure that I have been using for about a year now creating and updating items programmatically. I have added a new field Ship to the template. When I create a new item the field comes up as null when I try to access it using departure.Fields["Ship"]. If I step over the line causing the exception then after calling departure.Editing.EndEdit() I can then see the Ship field if I call departure.Fields.ToList(). If I add the template to a content item via the Sitecore GUI I can see the field and use it, and if I look at a content item which is based on the template I can see the new field too. So it is only when I access the template/item programmatically that it is null.

I have sitecore running on my local machine with a local sqlserver, and publish to my local machine.

Here is my code

String ship = "MSDisaster";

foreach (Language language in SiteLanguages)
{
    departure = departure.Database.GetItem(departure.ID, language);
    departure.Editing.BeginEdit();

    try
    {
        departure.Fields["StartDate"].Value = GetSitecoreDateString(xDep, "StartDate");
        departure.Fields["EndDate"].Value = GetSitecoreDateString(xDep, "EndDate");
        departure.Fields["Guaranteed"].Value = xDep.SelectSingleNode("./Guaranteed").InnerText;
        departure.Fields["Status"].Value = xDep.SelectSingleNode("./Status").InnerText;
        departure.Fields["Currency"].Value = ConvertLanguageToCurrency(language);
        departure.Fields["Market"].Value = ConvertLanguageToMarket(language);
        departure.Fields["TwinSharePrice"].Value = GetPrice(xDep, "twn", language);
        departure.Fields["SinglePrice"].Value = GetPrice(xDep, "sgl", language);

        if (!String.IsNullOrEmpty(ship))
            departures.Fields["Ship"].Value = ship;
    }
    catch (Exception ex)
    {
        departure.Editing.CancelEdit();
        log.Error(ex);
        throw ex;
    }
    departure.Editing.EndEdit();
}

So, how do I get the field be picked up?

Thanks,

James.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:34:20+00:00Added an answer on May 22, 2026 at 2:34 am

    Sorry Chris, StackOverflow, and the others who looked at my questions. It was a stupid typo. It’s even there in my question

        departure.Fields["SinglePrice"].Value = GetPrice(xDep, "sgl", language);
    
        if (!String.IsNullOrEmpty(ship))
           departures.Fields["Ship"].Value = ship;
    }
    

    departure is the item I am working on, departures is the collection it belongs to… doh.

    So what is the protocol here? Do I delete my question now because it isn’t really going to help anyone code better?

    James.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically the same as this question , but for VB6 . A customer's application
My question is basically the same as this one , but applied to the
This question is basically the same as Silverlight keydown event for games but there
This is basically the same question as Click items in select box, and then
I have basically the same problem outlined in this question, however I am using
Basically my question is the exact same one as this: Simple client/server, TCP/IP encrypting
I'm not really sure how to title this question but basically I have an
Basically the same as this question: How to make an infinitely long scroll view
I'm basically encountering the same problem as the poster in this question . My
Basically the same functionality as stackoverflow when posting a question, if you start writing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.