web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Entity field value

(0) ShareShare
ReportReport
Posted on by

Hi all i have a odd issue. I'm trying to get a value from a field in the quote form and then check agnist it but i can't seem to get it to work. any ideas

Here's my code. I trimmed it just to cut down space. I have highlighted in red where i think the issue is. I have a field that is a whole number called sb_900mhc

Entity CurrentQuoteEntity = new Entity("quote");
var id = context.PrimaryEntityId;
CurrentQuoteEntity = service.Retrieve("quote", id, new ColumnSet("quoteid"));
//CurrentQuote.Get<EntityReference>(executionContext).Id, attributes);
Guid quoteid = CurrentQuoteEntity.Id;
// Create New Price List
Entity newquote = new Entity("quote");
newquote.Id = CurrentQuoteEntity.Id;
// newquote["MH900"] = MH900.Get<string>(executionContext);
service.Update(newquote);
decimal qant = 0m;
string mh900str = MH900.Get<string>(executionContext);
string mh1050str = MH1050.Get<string>(executionContext);
string mh1200str = MH1200.Get<string>(executionContext);
string mh1350str = MH1350.Get<string>(executionContext);
string mh1500str = MH1500.Get<string>(executionContext);
string mh1800str = MH1800.Get<string>(executionContext);
string mh2100str = MH2100.Get<string>(executionContext);
string mh2400str = MH2400.Get<string>(executionContext);
string mh2700str = MH2700.Get<string>(executionContext);
string mh3000str = MH3000.Get<string>(executionContext);
int MHC900 =CurrentQuoteEntity.GetAttributeValue<int>("sb_900mhc");   
//return;
{

Entity newQuoteproductsEntity = new Entity("quotedetail");
QueryByAttribute queryun = new QueryByAttribute("uom");
queryun.AddAttributeValue("name", "Primary Unit");
var unittype = service.RetrieveMultiple(queryun).Entities.FirstOrDefault();   


//MH900
if (mh900str == "Yes")
{
goto add900;
}
else if (mh900str == "No")
{

goto test1050;
}


add900:
if (MHC900 == 1)
{
goto test1050;

}

does stuff which it should skip if MHC = 1

test1050:

Regards

Dan

*This post is locked for comments

I have the same question (0)
  • Verified answer
    ashlega Profile Picture
    34,477 on at

    Hi Dan,

     you have to add that attribute to the columns when retrievieng the entity:

    CurrentQuoteEntity = service.Retrieve("quote", id, new ColumnSet("quoteid", "sb_900mhc"));

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hey,

    Line CurrentQuoteEntity = service.Retrieve("quote", id, new ColumnSet("quoteid"));

    shows that you want to retrieve only quoteid field. If you want to get other fields like sb_900mhc you should change mentioned line to

    CurrentQuoteEntity = service.Retrieve("quote", id, new ColumnSet("quoteid", "sb_900mhc"));

  • Community Member Profile Picture
    on at

    Thank you i can't believe i missed something that simple

    Kind Regards

    Dan

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans