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 :
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
 
  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
11manish Profile Picture

11manish 44 Super User 2026 Season 2

#2
Travis South Profile Picture

Travis South 41

#3
Ayesha Wajahat Profile Picture

Ayesha Wajahat 18

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans