{"id":1111,"date":"2013-07-16T10:53:07","date_gmt":"2013-07-16T10:53:07","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=1111"},"modified":"2013-07-16T10:53:07","modified_gmt":"2013-07-16T10:53:07","slug":"close-custom-activity-entity","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=1111","title":{"rendered":"Close custom activity entity"},"content":{"rendered":"<p><a href=\"http:\/\/mahenderpal.files.wordpress.com\/2013\/07\/markascomplete.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-1112\" alt=\"Markascomplete\" src=\"http:\/\/mahenderpal.files.wordpress.com\/2013\/07\/markascomplete.png\" width=\"54\" height=\"65\" \/><\/a>Are you looking to close your custom entity using SDK, then this post is for you. We can close ms crm custom activity type entity like other entities using <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.crm.sdk.messages.setstaterequest.aspx\">SetStateRequest <\/a>message.\u00a0 You can use below code for the same<\/p>\n<p>&nbsp;<\/p>\n<p>public void CompleteTextMessage()<br \/>\n{<br \/>\nIOrganizationService _CrmService = GetCRMService(); \/\/a function to return ms crm service object<br \/>\nSetStateRequest _SetStateReq = new SetStateRequest();<br \/>\n\/\/provide entity details<br \/>\nSetStateReq.EntityMoniker = new EntityReference(&#8220;your custom entity logical name&#8221;, new Guid(&#8220;CustomEntityID&#8221;));<br \/>\n\/\/ Set the State and Status OptionSet Values to <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/gg328148.aspx\">completed.<\/a><br \/>\nSetStateReq.State = new OptionSetValue(1);<br \/>\nSetStateReq.Status = new OptionSetValue(2);<br \/>\n\/\/ call execute message by passing request object<br \/>\nSetStateResponse _SetStateResp = (SetStateResponse)_CrmService.Execute(SetStateReq);<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you looking to close your custom entity using SDK, then this post is for you. We can close ms crm custom activity type entity like other entities using SetStateRequest message.\u00a0 You can use below code for the same &nbsp; public void CompleteTextMessage() { IOrganizationService _CrmService = GetCRMService(); \/\/a function to return ms crm service object SetStateRequest _SetStateReq = new&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=1111\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[45,171],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1111"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1111"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1111\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}