Entity.Contains和Entity.Attributes.Contains之间的技术差异是什么.我知道它们都有效,但寻找一些技术细节.
microsoft-dynamics dynamics-crm dynamics-crm-2011 dynamics-crm-2013
我们目前正在使用Dynamics CRM 2016.我们有一个iframe,暂时用于加载另一个应用程序.我们希望将当前登录到CRM的帐户的用户名传递到iframe的URL.使用以下js函数,我可以获取UserId和Name,但它是全名,而不是帐户上的用户名:
function createUrl() {
//var user = Xrm.Page.context.getUserId();
var user = Xrm.Page.context.getUserName();
var url = "http://myapp/app?user=" + user;
Xrm.Page.getControl('IFRAME_externalSite').setSrc(url);
}
Run Code Online (Sandbox Code Playgroud)
我能找到的唯一解决方案是使用Xrm.Page.context.getUserId()方法中的UserId并通过OData查询SystemUser实体并从那里检索用户名.有没有查询OData服务的另一种方法?
我正在运行Microsoft Dynamics CRM 2013的自定义代码验证工具,并将以下内容标记为潜在问题.
这些都来自一个使用jQuery JavaScript Library v1.6.1的JavaScript文件
任何人都可以告诉我: - 除了ActiveX对象,我知道这只是IE浏览器,如果这些是其他主流浏览器如Firefox/Chrome的问题. - 我是否需要更新java脚本库的版本 - 或者我是否需要将这些方法调用替换为兼容的?
我想创建一个JS文件,它可以区分2011和2013版本的DCRM.是否有一些我可以使用的功能或某种方式来检查JS是在CRM 2011上执行而不是在CRM 2013上执行.
我想为CRM 2011和CRM 2013解决方案创建一个通用代码,并且将根据所使用的服务器相应地处理一些特定任务.
我很好,如果有一些客户端功能在2013年给出异常,在catch块我将处理它并将区分.但无论如何,它"不应该给服务器端打击".
请帮忙.
我试图在自定义工作流活动中使用optionset输入参数,所以我使用了以下代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
using Microsoft.Xrm.Sdk.Query;
using System.Globalization;
namespace ITWorx.VisitManagement.Workflows
{
public class FormatDate : CodeActivity
{
[Input("Preferred Language")]
[AttributeTarget("contact", "itworx_preferredlanguage")]
[Default("894330000")]
public InArgument<OptionSetValue> PreferredLanguage { get; set; }
protected override void Execute(CodeActivityContext context)
{
IWorkflowContext workflowContext = context.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = context.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(workflowContext.UserId);
int preferredLanguage = PreferredLanguage.Get<OptionSetValue>(context).Value;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是在下面的行中抛出了一个异常:
int preferredLanguage = PreferredLanguage.Get<OptionSetValue>(context).Value;
Run Code Online (Sandbox Code Playgroud)
异常:NullReferenceException {"对象引用未设置为对象的实例."}
请指教
我有一个名为Document Access的实体.现在,此实体文档访问与事件具有N:1关系(一个事件可以具有许多文档访问权限).
当有人创建新的文档访问记录时,我有一个JS来检查创建记录的人(当前登录用户)是否与事件的所有者相同.如果没有,我不允许创建(这是在保存记录上设置的).
文档访问记录的所有者可以是任何人(不一定是事件的所有者).除非由事件所有者完成,否则如何确保防止删除这些文档访问记录?
除系统管理员外,禁用Dynamic CRM中所有用户的最佳方法是什么?
我编写了一个包含以下配置的插件:
我只是想将一个datetime
字段设置为等于另一个datetime
字段:
IPluginExecutionContext context = localContext.PluginExecutionContext;
IOrganizationService service = localContext.OrganizationService;
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parmameters.
Entity entity = (Entity)context.InputParameters["Target"];
try
{
if (entity.LogicalName == "list" && entity.Attributes["gbs_lastusedonoriginal"] != null)
{
entity.Attributes["lastusedon"] = entity.Attributes["gbs_lastusedonoriginal"];
service.Update(entity);
}
}
catch (FaultException ex)
{
throw new InvalidPluginExecutionException("An error occured in the plug-in.", ex);
}
}
Run Code Online (Sandbox Code Playgroud)
我得到的例外是:
未处理的异常:System.ServiceModel.FaultException`1 [[Microsoft.Xrm.Sdk.OrganizationServiceFault,Microsoft.Xrm.Sdk,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35]]:插件中发生错误.Detail:
-2147220891 OperationStatus 0 SubErrorCode -2146233088插件中发生错误. …
c# microsoft-dynamics crm dynamics-crm-2011 dynamics-crm-2013
我总是这样做的旧方法是在加载时触发脚本并将字段设置为this或that(隐藏,锁定等).但是既然我们现在已经获得了那些新的,酷炫的,有光泽的商业规则,我想我可以给他们一个打击.
问题是我无法弄清楚如何根据当前用户的角色指定一个条件......它隐藏在哪里?!
我正在使用Dynamics CRM 365.我使用queryexpression检索Opty名称和Opty id(唯一).
QueryExpression queryOnline = new QueryExpression("opportunity");
queryOnline.Criteria = new FilterExpression();
queryOnline.Criteria.AddCondition("createdon", ConditionOperator.LastXDays, hours);
queryOnline.Criteria.AddCondition("statuscode", ConditionOperator.Equal, 1); // For Open Opportunity
queryOnline.ColumnSet = new ColumnSet(true);
EntityCollection entCol = _service.RetrieveMultiple(queryOnline);
foreach (Entity presName in entCol.Entities)
{
//Get Opty ID and Name
}
Run Code Online (Sandbox Code Playgroud)
现在我想创建SendEmailRequest
发送机会记录,我使用上述方法检索.简而言之,我想SendEmailRequest
用以下格式创建:
在电子邮件说明中(多行文本/字符串):
你有开放的机会:
ID || 名称
00001 || 打开OPTY NAME
00002 || 打开OPTY NAME
我已成功创建发送电子邮件请求,有或没有模板.但是当我想将查询表达式中的opty记录粘贴到电子邮件描述中时,我遇到了问题.电子邮件描述是字符串格式的"多行文本"字段.
c# dynamics-crm dynamics-crm-2011 dynamics-crm-online dynamics-crm-2013
表格:实体A.
表格:实体B.
功能: 当我在实体中选择审批人时:A并选择一个html按钮我使用下面的代码将查询字符串发送到表单实体:B
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD>
<SCRIPT type=text/javascript>
function setDelegate(){
var ApproverInfo = new Array();
ApproverInfo = window.parent.Xrm.Page.getAttribute('bch_approver').getValue();
if(ApproverInfo[0] != null)
{
var parameters = {};
parameters["formid"] = "{b053a39a-041a-4356-acef-ddf00182762b}";
window.parent.Xrm.Utility.openEntityForm("bch_delegate", ApproverInfoId );
}
}
</SCRIPT>
<META charset=utf-8></HEAD>
<BODY><INPUT onclick=setDelegate(); value="Set Delegate" type=submit> </BODY></HTML>
Run Code Online (Sandbox Code Playgroud)
在表单实体:B页面加载我写了以下javascript代码来读取和设置实体中的查找:B
我已经使用以下代码收到了查询字符串:
// Get the Value of the Regarding through the Customer Parameters
var param=Xrm.Page.context.getQueryStringParameters();
if (param != null ) {
alert('inside');
var ApproverId=param["bch_signingauthority"];
var bchName …
Run Code Online (Sandbox Code Playgroud) javascript crm dynamics-crm dynamics-crm-2011 dynamics-crm-2013