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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

I need to insert a value to the subjectid field of Entity Incident

(0) ShareShare
ReportReport
Posted on by 20

caso.Attributes["subjectid"] = 832a6ee3-35df-eb11-bacb-000d3abc0713; //GUID



When I go to insert I get this error

Invalid value type for attribute: subjectid of entity: incident, Expected Type: lookup, Actual Type: System.Guid


Thanks in advance
 
I have the same question (0)
  • Suggested answer
    anteOjo Profile Picture
    20 on at
    I have already solved it ... I post it in case it serves someone

    try
                    {
                        Microsoft.Xrm.Sdk.Entity caso = new Microsoft.Xrm.Sdk.Entity("incident");
                        Microsoft.Xrm.Sdk.EntityReference contactId = new Microsoft.Xrm.Sdk.EntityReference("contact", queUsuario);
                        Microsoft.Xrm.Sdk.EntityReference accountId = new Microsoft.Xrm.Sdk.EntityReference("account", queCuenta);
                        Microsoft.Xrm.Sdk.EntityReference subjectId = new Microsoft.Xrm.Sdk.EntityReference("subject", tipologia);
    
                        caso.Attributes["title"] = asunto;
                        caso.Attributes["description"] = descripcion;
                        caso.Attributes["prioritycode"] = new OptionSetValue(urgencia);
                        caso.Attributes["subjectid"] = subjectId;
                        caso.Attributes["customerid"] = accountId;
                        caso.Attributes["primarycontactid"] = contactId;
                        Guid incidentId = service.Create(caso);
                    }
  • Community Member Profile Picture
    on at

    Hi,

    Glad your problem was solved!

    Regards,
    Leah Ju

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 57 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 34 Most Valuable Professional

#3
Scott Jackson UK Profile Picture

Scott Jackson UK 22

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans