我们有一个新设置的CRM 2015内部部署环境; 我们正在努力摆弄社会关怀框架.
我们只是想InfluenceScore使用Web服务调用在我们的自定义应用程序中更新社交个人资料记录的参数,但它似乎对该字段没有影响.奇怪的是,它没有抛出任何异常,服务电话根本不会抱怨.一切似乎都很正常,除了字段没有更新.
以下是我们代码的相关部分;
// Retrieving the social profile record with all it's columns
Entity socialProfile = GetSocialProfileByName(socialProfileName);
double score = 0;
string scoreField = "influencescore";
// If socialProfile contains our attribute, set it appropriately, otherwise add the attribute
if(socialProfile.Contains(scoreField))
{
score = socialProfile.GetAttributeValue<float?>(scoreField).GetValueOrDefault(0) + 10; // Add 10 to the existing score.
socialProfile[scoreField] = score;
}
else
{
socialProfile.Attributes.Add(scoreField, 10);
}
// Update the record.
service.Update(socialProfile);
Run Code Online (Sandbox Code Playgroud)
InfluenceScore …我们在CRM 2016 SP1中遇到了奇怪的行为.当我们在完整网址的帮助下打开一些实体然后转到自定义网页资源页面(通过网站地图(网络资源,网址等)添加)时,我们的功能区突然消失.请在下面观看GIF.
你有任何想法如何解决它?
UPDATE
引入的GIF的结果状态如下:
更新2
站点地图自定义部件(SubArea,ID ="nav_pipeline"):
<SiteMap IntroducedVersion="7.0.0.0">
<Area Id="SFA" ResourceId="Area_Sales" DescriptionResourceId="Sales_Description" Icon="/_imgs/sales_24x24.gif" ShowGroups="true" IntroducedVersion="7.0.0.0">
<Group Id="MyWork" ResourceId="Group_MyWork" DescriptionResourceId="My_Work_Description" ToolTipResourseId="My_Work_ToolTip" IntroducedVersion="7.0.0.0">
<SubArea Id="nav_dashboards" ResourceId="Homepage_Dashboards" DescriptionResourceId="Dashboards_Description" ToolTipResourseId="Dashboards_ToolTip" Icon="/_imgs/area/18_home.gif" Url="/workplace/home_dashboards.aspx" GetStartedPanePath="Dashboards_Web_User_Visor.html" GetStartedPanePathAdmin="Dashboards_Web_Admin_Visor.html" GetStartedPanePathOutlook="Dashboards_Outlook_User_Visor.html" GetStartedPanePathAdminOutlook="Dashboards_Outlook_Admin_Visor.html" DefaultDashboard="2701de60-8f2a-48a4-8262-4a35ca7441fa" IntroducedVersion="7.0.0.0" />
<SubArea Id="nav_personalwall" ResourceId="Whats_New_Label" DescriptionResourceId="Whats_New_Description" ToolTipResourseId="Whats_New_ToolTip" Icon="$webresource:msdyn_/Images/Wall_16.png" OutlookShortcutIcon="$webresource:msdyn_/Images/Wall_16.png" AvailableOffline="false" Url="$webresource:msdyn_/PersonalWall.htm?data=HideUserProfile%3D0" GetStartedPanePath="Dashboards_Web_User_Visor.html" GetStartedPanePathAdmin="Dashboards_Web_Admin_Visor.html" GetStartedPanePathOutlook="Dashboards_Outlook_User_Visor.html" GetStartedPanePathAdminOutlook="Dashboards_Outlook_Admin_Visor.html" IntroducedVersion="7.0.0.0">
<Privilege Entity="post" Privilege="Read" />
</SubArea>
<SubArea Id="nav_activities" DescriptionResourceId="Activities_SubArea_Description" ToolTipResourseId="Activities_SubArea_ToolTip" Url="/_root/homepage.aspx?etc=4200" Entity="activitypointer" GetStartedPanePath="Activities_Web_User_Visor.html" GetStartedPanePathAdmin="Activities_Web_Admin_Visor.html" GetStartedPanePathOutlook="Activities_Outlook_User_Visor.html" GetStartedPanePathAdminOutlook="Activities_Outlook_Admin_Visor.html" IntroducedVersion="7.0.0.0" />
<SubArea Icon="$webresource:msdyn_/Images/likeIcon.png" Id="nav_pipeline" Url="$webresource:msdyn_/FirstRunContent.1033.htm" Description="Pipeline View" Title="Pipeline" AvailableOffline="false" PassParams="false" Client="Web" /> …Run Code Online (Sandbox Code Playgroud) 我知道从CRM外部执行批量更新时,ExecuteMultipleRequest是一个巨大的性能助推器.我不知道的是从CRM插件中调用它是否有益.
我目前的理解是,使用ExecuteMultipleRequest获得的主要性能是实际的SOAP消息传递成本.因此(用于更新5000条记录)而不是发送5000条单独的Soap消息(每条消息必须被序列化,验证,传输等),所有这些都必须发送到服务器,您只能发送一条包含5000条记录的消息.但是当从插件调用时,您已经在服务器上,因此不必进行SOAP调用,因此使用它没有任何好处.
我还没有看到其他一些潜在的好处吗?
我正在使用CRM2016
我创建了一个测试实体来复制问题
我没有对它进行任何定制.我用默认字段和表单创建了一个新记录.然后我尝试访问webapi
http://localhost/CRMDataBase/api/data/v8.0/new_test(bgcs0249-0a06-e611-941a-003002djlnc)
Run Code Online (Sandbox Code Playgroud)
它运作良好并带来了记录.然后我删除了记录并为它创建了一个业务流程,只需一个阶段和一个步骤
我激活它并添加了一个新的测试记录,并试图访问webapi网址,它抛出了以下错误
{"error":{"code":"","message":"属性'stageid'属于无法识别的EdmPropertyKind.实体new_test具有重复的导航属性名称.所有属性名称(Navigation和Structural属性)必须是唯一的实体","innererror":{"message":"属性'stageid'属于无法识别的EdmPropertyKind.实体new_test具有重复的导航属性名称.所有属性名称(Navigation和Structural属性)在实体","类型中必须是唯一的":" Microsoft.Crm.CrmHttpException " "堆栈跟踪":"在Microsoft.Crm.Extensibility.OData.CrmODataEntityTypeSerializer.CreateSelectExpandNode(entityInstanceContext entityInstanceContext个)\ r \n在System.Web.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(对象图,ODataWriter作家,ODataSerializerContext writeContext个)\ r \n
在System.Web.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable的枚举,IEdmTypeReference的FeedType,ODataWriter作家,ODataSerializerContext writeContext个)\ r \n在 Microsoft.Crm.Extensibility.OData.CrmODataFeedSerializer.WriteObject(对象图,类型类型,ODataMessageWriter messageWriter,ODataSerializerContext writeContext个)\ r \n在System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(类型类型,对象的值,流writeStream, HttpContent内容,HttpContentHeaders contentHeaders)\ r \n在System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type,Object value,Stream writeStream,HttpContent content,TransportContext transportContext,CancellationToken cancellationToken)\ r \n ---结束抛出异常的前一个位置的堆栈跟踪---\r \n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \n \n在System.Web.Http.WebHost.HttpControllerHandler.d__1b.MoveNext()","internalexception":{"message":"属性'stageid'是一个无法识别的EdmPropertyKind.","type":"Microsoft.ODa ta.Core.ODataException " "堆栈跟踪":"在Microsoft.OData.Core.UriParser.Parsers.SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(PathSegmentToken tokenIn,IEdmModel模型,IEdmStructuredType edmType,ODataUriResolver分解器)\ r \在Microsoft.OData.Coreñ. UriParser.Visitors.SelectPropertyVisitor.ProcessTokenAsPath(NonSystemToken tokenIn个)\ r \n在Microsoft.OData.Core.UriParser.Visitors.SelectPropertyVisitor.Visit(NonSystemToken tokenIn个)\ r \n在Microsoft.OData.Core.UriParser.Parsers.SelectBinder.绑定(SelectToken tokenIn个)\ r \n在Microsoft.OData.Core.UriParser.Parsers.SelectExpandBinder.Bind(ExpandToken tokenIn个)\ r \n在Microsoft.OData.Core.UriParser.Parsers.SelectExpandSemanticBinder.Bind(IEdmStructuredType的ElementType,IEdmNavigationSource在Microsoft.Crm.Extensibility.OData.CrmODataE的Microsoft.OData.Core.UriParser.ODataQueryOptionParser.ParseSelectAndExpand()\ r \n中的navigationSource,ExpandToken expandToken,SelectToken selectToken,ODataUriParserConfiguration配置)\ r \n ntityTypeSerializer.CreateSelectExpandNode(EntityInstanceContext entityInstanceContext)"}}}}
如果我删除所有记录 - >停用业务流程 - >添加新数据然后检查webapi,它运行正常.但是,当我激活业务流程并添加新数据时,我收到上述错误PS:我没有对业务流程和实体进行任何编码/定制.但我仍然得到这个错误
可以做些什么来解决这个问题?
dynamics-crm dynamics-crm-2011 dynamics-crm-2013 dynamics-crm-2015 dynamics-crm-2016
我对收到错误xrm.saveChanges()如果我做UpdateObject而ADDOBJECT工作正常,initally我认为这是因为上下文在此线程讨论收到错误- Dynamics CRM中保存实体的变化 ,但我尝试了所有的选项这里讨论HTTPS ://msdn.microsoft.com/en-us/library/gg695783.aspx但没有任何帮助.
我的代码是`
using (var xrm = new XrmServiceContext("Xrm"))
{
WriteExampleContacts(xrm);
//Create a new contact called Allison Brown.
var allisonBrown = new Xrm.Contact
{
FirstName = "Allison",
LastName = "Brown",
Address1_Line1 = "23 Market St.",
Address1_City = "Sammamish",
Address1_StateOrProvince = "MT",
Address1_PostalCode = "99999",
Telephone1 = "12345678",
EMailAddress1 = "allison.brown@example.com"
};
xrm.AddObject(allisonBrown);
xrm.SaveChanges();
WriteExampleContacts(xrm);
//Update the e-mail address of Allison Brown and link her to the account Contoso. …Run Code Online (Sandbox Code Playgroud) MS CRM 2015允许您指定实体之间关系的属性映射.例如,对于下面显示的"contact_customer_accounts"关系,它定义了在通过帐户的"相关联系人"视图添加新联系人时,应将来自帐户的哪些属性复制到联系人.
但是,当我更改此类映射(并发布所有自定义项)时,它不会作为我的解决方案的一部分导出(或者就此而言是默认解决方案).当我在映射中的这种更改之前和之后比较customizations.xml文件时,它们(对于相关部分)完全相同 - 这些信息似乎不是导出的一部分?
我还找到了定制解决方案文件架构,它似乎也没有提到有关属性映射的任何内容.
我认为这些信息应该是解决方案输出的一部分 - 有人知道为什么不是吗?
更新:我在我的组织中导入了我的解决方案(包括帐户和联系人)并已发布.然后从"contact_customer_accounts"关系中删除一半映射并再次发布.最后导入相同的解决方案并再次发布:删除的映射没有返回.
所以我认为解决方案不包含映射信息是安全的.
我无法从 CRM 插件访问外部数据库。我收到的错误是:
"Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxx' failed."
Run Code Online (Sandbox Code Playgroud)
该代码在“单元测试”中本地运行良好。我确保将插件隔离模式设置为“无”。我尝试向这篇文章寻求帮助,并尝试了它建议的所有内容,但没有成功。
这是我当前使用的代码:
var conn = new SqlConnection(@"Server=MyServer\Instance;DataBase=MyDB;User Id=MyUser;Password=MyPassword;Integrated Security=false;");
conn.Open();
Run Code Online (Sandbox Code Playgroud)
我还尝试了此连接字符串并授予 NT AUTHORITY\NETWORK SERVICE 用户对数据库的访问权限。
var conn = new SqlConnection(@"Data Source=MyDS\Instance;Initial Catalog=MyDB;Integrated Security=SSPI;");
conn.Open();
Run Code Online (Sandbox Code Playgroud)
我使用的是 Dynamics CRM 2015 On-Premise。
更新:我在没有调试的时候发现它可以工作,但是当我尝试通过插件注册工具调试它时出现错误。知道为什么会发生这种情况吗?
我正在为 Dynamics CRM(2015 和 CRM Online)的自定义 C# 插件注册插件。
当您使用 Visual Studio CRM Explorer 创建新插件时,您会看到标准的“创建插件”对话框:
在“管道阶段”下,有三个选项:
选择Post-Operation此处会将此代码添加到 XML 注册文件中:
<Plugin Description="..." FriendlyName="PostContactCreate" Name="Cacheron.PostContactCreate" Id="00000000-0000-0000-0000-000000000000" TypeName="Cacheron.PostContactCreate">
<Steps>
<clear />
<Step CustomConfiguration="" Name="PostContactCreate" Description="Post-Operation of Contact Create" Id="00000000-0000-0000-0000-000000000000" MessageName="Create" Mode="Synchronous" PrimaryEntityName="contact" Rank="1" SecureConfiguration="" Stage="PostOutsideTransaction" SupportedDeployment="ServerOnly">
<Images />
</Step>
</Steps>
</Plugin>
Run Code Online (Sandbox Code Playgroud)
关键部分是那条中间线,它说 Stage="PostOutsideTransaction"
该工具生成的相应 C# 代码包括以下行:
base.RegisteredEvents.Add(
new Tuple<int, string, string, Action<LocalPluginContext>>(
40,
"Create",
"contact",
new Action<LocalPluginContext>(ExecutePostContactCreate)
)
);
Run Code Online (Sandbox Code Playgroud)
插件注册中的神奇数字 40 似乎对应于https://msdn.microsoft.com/en-gb/library/gg327941.aspx 中记录的“管道阶段” ,它说
事后
术后
40 …
我有以下问题:
我需要从属于"设备"的特定日历的日历规则中删除或删除"超时规则".需要这样做,以便设备可用于在服务日历上进行安排.
不知何故,我无法理解如何做到这一点.
我能够检索需要删除的日历规则对象,但下一步就是我.
请小心告诉我:
可以通过C#(SDK)完成
任何类似的Web资源或代码部分.
以下代码给出了错误
您尝试删除的对象与另一个对象关联,无法删除.
//equip is of Equipment type and is already initialized
CrmEarlyBound.Calendar cal = (CrmEarlyBound.Calendar)svc.Retrieve("calendar", equip.CalendarId.Id, new ColumnSet(true));
Console.WriteLine("Got the user calendar");
List<CalendarRule> calendarRules = cal.CalendarRules.ToList();
Console.WriteLine("Got the calendar rules " + cal.CalendarRules.ToList().Count);
foreach (CalendarRule cr in cal.CalendarRules)
{
if (cr.Description == "Time Off Rule" && cr.StartTime.Value>=DateTime.Now)
{
Console.WriteLine(cr.StartTime);
Calendar calI = (Calendar)svc.Retrieve(cr.InnerCalendarId.LogicalName, cr.InnerCalendarId.Id, new ColumnSet(true));
//svc.Delete(cr.InnerCalendarId.LogicalName, cr.InnerCalendarId.Id);
}
}
Run Code Online (Sandbox Code Playgroud) 如何在下面的上下文中使用webclient发出POST请求?
我能够成功验证身份并jwt从ADFS 检索令牌:
using (var client = new WebClient())
{
var data = Encoding.UTF8.GetBytes(rstXml);
client.Headers.Add("Content-Type", "application/soap+xml; charset=utf-8");
var responseData =
client.UploadData($"https://{adfsServer}/adfs/services/trust/13/usernamemixed", data);
var rstr = Encoding.UTF8.GetString(responseData);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(rstr);
var nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
nsmgr.AddNamespace("wsse",
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
nsmgr.AddNamespace("wsu",
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
jwt = xmlDoc.SelectSingleNode("//wsse:BinarySecurityToken", nsmgr).InnerText; // JWT
}
Run Code Online (Sandbox Code Playgroud)
如何在相同的上下文中发出POST请求?