Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Sales updates!Learn about the key capabilities and features of Dynamics 365 Sales and experience some of the new features.
Download overview guide | Watch Sales video
2021 Release Wave 2Discover the latest updates and new features releasing from October 2021 through March 2022.
2021 release wave 2 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
How to create a post entity and link it to the timline of an opportunity?
When i try the following i get an error "The given key was not present in the dictionary". Am i setting the OptionSetValue wrong or something else?
The error provided is usually the marker that one of the fields that were expected was not passed at all.
Try to add the "text" field as well.
I think there is no field called "Type" in Post entity , so change it to "text" which is text field
because the error "The given key was not present in the dictionary" means that you use some attribute (Logical Name) which is not present in your entity
There is a parameter type (e.g. "idea", "news" and so on) and a parameter source (values like "manual" or "automatic").
I forgot to set a text but there seems to be an default emtpy string for that. Turns out a few rows above i had something like
OP["fc_aiprog"] = Convert.ToDouble(OP["fc_aiprog"]);
to recieve the old value of an field which will be updated. But in this case that specific opportunity did not have any value till now.
That caused the "The given key was not present in the dictionary".
The post ist created fine now like this:
Entity timelinePost = new Entity("post");
timelinePost["regardingobjectid"] = new EntityReference("opportunity",OP.Id);
timelinePost["text"] = "Neuer AI-Prog: " + prognosisdata.fc_aiprog + "% (Plugin)";
OptionSetValue sourceVal = new OptionSetValue(1);
timelinePost["source"] = sourceVal; // Manual or Automatic
OptionSetValue postType = new OptionSetValue(7);
timelinePost["type"] = postType; // type of post i.e idea or news etc
Thanks to everybody for your support!
Business Applications communities