Quantcast
Channel: Microsoft Dynamics CRM
Viewing all articles
Browse latest Browse all 137182

Forum Post: RE: Article entity creation from c# plugin (or workflow activity)

$
0
0

Hi,

thx Madu for your post. I was always trying to update description or content, but enough is to update only articlexml.

Example:

articleEntity.SubjectId = new EntityReference(Subject.EntityLogicalName, caseEntity.SubjectId.Id);

articleEntity.Title = caseEntity.Title;

articleEntity.KbArticleTemplateId = new EntityReference(KbArticleTemplate.EntityLogicalName, articleTemplate.Id);

articleEntity.Description = caseEntity.Description;

articleEntity.ArticleXml = "<articledata><section id='0'><content><![CDATA[" + caseEntity.Description + "]]></content></section></articledata>";

Guid articleEntityGuid = service.Create(articleEntity);

Using this approach 'kb article data' is updated with any content you need -> in fact article template contains sections (e.g.: question, answer, additional comments,..) and those sections are fullfilled with articlexml. 'Section id' represents index of section. For update of more sections, see sample below (if you will try to update sections, which does not exist in template, entity will not crash ;)

articleEntity.ArticleXml = "<articledata><section id='0'><content><![CDATA[" + caseEntity.Description + "]]></content></section><section id='1'><content><![CDATA[" + caseEntity.Description + "]]></content></section></articledata>";

Stan


Viewing all articles
Browse latest Browse all 137182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>