- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经创建了一个用户,我正在尝试为他分配两个队列 n°1 和 n°2。问题是我使用的代码仅替换了最后一个队列。
Import-Module C:\Powershell\CRMBuzz\CRMBuzzPowerTools_Module_2_0_0_15_Setup\WindowsPowerShell\Modules\CRMBuzzPowerTools\CRMBuzz.PowerTools.PSSnapin.dll -Force -WarningAction SilentlyContinue -DisableNameCheckin
$connString="Url=https://crmlab:5555/CRMLab;<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c297b1a7b0aca3afa7ffb6a7b1b682a1b0afecaea3a0" rel="noreferrer noopener nofollow">[email protected]</a>;password=******;"
$CRMConn = New-OrganizationConnection -ConnectionString $connString -Verbose
$queue_ref0=Get-EntityReferenceByName -OrganizationService $CRMConn -EntityName "queue" -FindFieldName "name" -ReferenceValue "TEST1"
$queue_ref1=Get-EntityReferenceByName -OrganizationService $CRMConn -EntityName "queue" -FindFieldName "name" -ReferenceValue "TEST2"
$userent=Search-EntityFull -OrganizationService $CRMConn -EntityObject systemuser -FieldName domainname -SearchValue "TEST\P_TEST"
[Microsoft.Xrm.Sdk.EntityReference] $userent.Attributes["queueid"]=$queue_ref0
[Microsoft.Xrm.Sdk.EntityReference] $userent.Attributes["queueid"]=$queue_ref1
Update-Record -OrganizationService $CRMConn -EntityObject $userent –verbose
我尝试了网上找到的另一种方法,但它返回不兼容错误。
Move-CrmRecordToQueue -EntityLogicalName account -Id 5ff140ea-95ed-e811-80e9-005056bd633b -QueueName "TEST1" -WorkingUserId 5bf140ea-95ed-e811-80e9-005056bd633b
我也尝试过这个,但不知道要使用的参数。
Import-Module C:\Powershell\Handy.Crm.Extensions.Powershell.Cmdlets
$cred = Get-Credential
$CRMConn = Connect-CrmOnPremDiscovery -Credential $cred -ServerUrl https://crmlab:5555/CRMLab
Set-CRMQueueForUser -Connection $CRMConn -UserId 5bf140ea-95ed-e811-80e9-005056bd633b -QueueId 023963ca-08a5-e611-80c6-00155d011760
编辑
詹姆斯的回答让我明白了一些事情。上面我试图将两个队列添加到用户的默认队列中,这是不可能的。我想我应该将它们添加到默认队列下方的字段中,如下图所示(不知道该字段的名称):
最佳答案
是的,您可以使用PowerShell来做到这一点.
例如,queuemembership_association可以使用以下 cmdlet 创建链接。 (请测试一下,因为我还没有测试过)
PS C:\>$systemuser = Get-CrmRecord systemuser 00005a70-6317-e511-80da-c4346bc43d94 name
PS C:\>$queue = Get-CrmRecord queue 66005a70-6317-e511-80da-c4346bc43d94 fullname
PS C:\>Add-CrmRecordAssociation $systemuser $queue queuemembership_association
有两个函数可用于关联单个实体记录和批量关联,即 Add-CrmRecordAssociation
和 Add-CrmMultiRecordAssociation
。粘贴相关 cmdlet 以及示例:
#CreateEntityAssociation
function Add-CrmRecordAssociation{
<#
.SYNOPSIS
Associates two records for N:N relationship.
.DESCRIPTION
The Add-CrmRecordAssociation cmdlet lets you associate two records for N:N relationship by specifying relatioship logical name.
There are two ways to specify records.
1. Pass EntityLogicalName and record's Id for both records.
2. Get a record object by using Get-CrmRecord/Get-CrmRecords cmdlets, and pass it for both records.
You can specify relationship logical name for the association.
.PARAMETER conn
A connection to your CRM organizatoin. Use $conn = Get-CrmConnection <Parameters> to generate it.
.PARAMETER CrmRecord1
A first record object which is obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then you don't use EntityLogicalName/Id.
.PARAMETER CrmRecord2
A second record object which is obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then you don't use EntityLogicalName/Id.
.PARAMETER EntityLogicalName1
A logicalname for first Entity. i.e.)accout, contact, lead, etc..
.PARAMETER Id1
An Id (guid) of first record
.PARAMETER EntityLogicalName2
A logicalname for second Entity. i.e.)accout, contact, lead, etc..
.PARAMETER Id2
An Id (guid) of second record
.PARAMETER RelationshipName
A N:N relationship logical name.
.EXAMPLE
Add-CrmRecordAssociation -conn $conn -EntityLogicalName1 account -Id1 00005a70-6317-e511-80da-c4346bc43d94 -EntityLogicalName2 contact -Id2 66005a70-6317-e511-80da-c4346bc43d94 -RelationshipName new_accounts_contacts
This example associates an account and a contact records through new_accounts_contacts custom N:N relationship.
.EXAMPLE
Add-CrmRecordAssociation account 00005a70-6317-e511-80da-c4346bc43d94 contact 66005a70-6317-e511-80da-c4346bc43d94 new_accounts_contacts
This example associates an account and a contact records through new_accounts_contacts custom N:N relationship by ommiting parameters names.
When ommiting parameter names, you do not provide $conn, cmdlets automatically finds it.
.EXAMPLE
PS C:\>$account = Get-CrmRecord account 00005a70-6317-e511-80da-c4346bc43d94 name
PS C:\>$contact = Get-CrmRecord contact 66005a70-6317-e511-80da-c4346bc43d94 fullname
PS C:\>Add-CrmRecordAssociation -conn $conn -CrmRecord1 $account -CrmRecord2 $contact -RelationshipName new_accounts_contacts
This example retrieves and stores an account and a contact records to variables, then pass them to Add-CrmRecordAssociation cmdlets.
.EXAMPLE
PS C:\>$account = Get-CrmRecord account 00005a70-6317-e511-80da-c4346bc43d94 name
PS C:\>$contact = Get-CrmRecord contact 66005a70-6317-e511-80da-c4346bc43d94 fullname
PS C:\>Add-CrmRecordAssociation $account $contact new_accounts_contacts
This example retrieves and stores an account and a contact records to variables, then pass them to Add-CrmRecordAssociation cmdlets.
#>
[CmdletBinding()]
PARAM(
[parameter(Mandatory=$false)]
[Microsoft.Xrm.Tooling.Connector.CrmServiceClient]$conn,
[parameter(Mandatory=$true, Position=1, ParameterSetName="CrmRecord")]
[PSObject]$CrmRecord1,
[parameter(Mandatory=$true, Position=2, ParameterSetName="CrmRecord")]
[PSObject]$CrmRecord2,
[parameter(Mandatory=$true, Position=1, ParameterSetName="NameWithId")]
[string]$EntityLogicalName1,
[parameter(Mandatory=$true, Position=2, ParameterSetName="NameWithId")]
[guid]$Id1,
[parameter(Mandatory=$true, Position=3, ParameterSetName="NameWithId")]
[string]$EntityLogicalName2,
[parameter(Mandatory=$true, Position=4, ParameterSetName="NameWithId")]
[guid]$Id2,
[parameter(Mandatory=$true, Position=5)]
[string]$RelationshipName
)
$conn = VerifyCrmConnectionParam $conn;
if($CrmRecord1 -ne $null)
{
$EntityLogicalName1 = $CrmRecord1.logicalname
$Id1 = $CrmRecord1.($EntityLogicalName1 + "id")
}
if($CrmRecord2 -ne $null)
{
$EntityLogicalName2 = $CrmRecord2.logicalname
$Id2 = $CrmRecord2.($EntityLogicalName2 + "id")
}
try
{
$result = $conn.CreateEntityAssociation($EntityLogicalName1, $Id1, $EntityLogicalName2, $Id2, $RelationshipName, [Guid]::Empty)
if(!$result)
{
return $conn.LastCrmException
}
}
catch
{
return $conn.LastCrmException
}
}
#CreateMultiEntityAssociation
function Add-CrmMultiRecordAssociation{
<#
.SYNOPSIS
Associates multiple records to single record for N:N relationship.
.DESCRIPTION
The Add-CrmMultiRecordAssociation cmdlet lets you associate multiple records to single record for N:N relationship by specifying relatioship logical name.
Use @('<object>','<object>') syntax to specify multiple ids or records.
if the relationship is self-referencing, specify $True for -IsReflexiveRelationship Parameter.
There are two ways to specify records.
1. Pass EntityLogicalName and record's Id for both records.
2. Get record object(s) by using Get-CrmRecord/Get-CrmRecords cmdlets, and pass them.
You can specify relationship logical name for the association.
.PARAMETER conn
A connection to your CRM organizatoin. Use $conn = Get-CrmConnection <Parameters> to generate it.
.PARAMETER CrmRecord1
A first record object which is obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then you don't use EntityLogicalName/Id.
.PARAMETER CrmRecord2s
An array of records object which are obtained via Get-CrmRecord/Get-CrmRecords. When you pass CrmRecord, then you don't use EntityLogicalName/Id.
.PARAMETER EntityLogicalName1
A logicalname for first Entity. i.e.)accout, contact, lead, etc..
.PARAMETER Id1
An Id (guid) of first record
.PARAMETER EntityLogicalName2
A logicalname for second Entity. i.e.)accout, contact, lead, etc..
.PARAMETER Id2s
An array of Ids (guid) of second records. Specify by using @('66005a70-6317-e511-80da-c4346bc43d94','62005a70-6317-e511-80da-c4346bc43d94') synctax.
.PARAMETER RelationshipName
A N:N relationship logical name.
.PARAMETER IsReflexiveRelationship
Specify $True if the N:N relationship is self-referencing.
.EXAMPLE
Add-CrmMultiRecordAssociation -conn $conn -EntityLogicalName1 account -Id1 00005a70-6317-e511-80da-c4346bc43d94 -EntityLogicalName2 contact -Id2s @('66005a70-6317-e511-80da-c4346bc43d94','62005a70-6317-e511-80da-c4346bc43d94') -RelationshipName new_accounts_contacts
This example associates an account and two contact records through new_accounts_contacts custom N:N relationship.
.EXAMPLE
Add-CrmMultiRecordAssociation account 00005a70-6317-e511-80da-c4346bc43d94 contact @('66005a70-6317-e511-80da-c4346bc43d94','62005a70-6317-e511-80da-c4346bc43d94') new_accounts_contacts
This example associates an account and two contact records through new_accounts_contacts custom N:N relationship by ommiting parameters names.
When ommiting parameter names, you do not provide $conn, cmdlets automatically finds it.
.EXAMPLE
PS C:\>$account = Get-CrmRecord account 00005a70-6317-e511-80da-c4346bc43d94 name
PS C:\>$fetch = @"
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" no-lock="true">
<entity name="contact">
<attribute name="fullname" />
<filter type="and">
<condition attribute="lastname" operator="like" value="%sample%" />
</filter>
</entity>
</fetch>
"@
PS C:\>$contacts = Get-CrmRecordsByFetch $fetch
PS C:\>Add-CrmMultiRecordAssociation $account $contacts.CrmRecords new_accounts_contacts
This example retrieves contacts by using FetchXML and stores to a variable, then retrieves and store an account record to another variable.
Then passes those variables Add-CrmMultiRecordAssociation.
#>
[CmdletBinding()]
PARAM(
[parameter(Mandatory=$false)]
[Microsoft.Xrm.Tooling.Connector.CrmServiceClient]$conn,
[parameter(Mandatory=$true, Position=1, ParameterSetName="CrmRecord")]
[PSObject]$CrmRecord1,
[parameter(Mandatory=$true, Position=2, ParameterSetName="CrmRecord")]
[PSObject[]]$CrmRecord2s,
[parameter(Mandatory=$true, Position=1, ParameterSetName="NameWithId")]
[string]$EntityLogicalName1,
[parameter(Mandatory=$true, Position=2, ParameterSetName="NameWithId")]
[guid]$Id1,
[parameter(Mandatory=$true, Position=3, ParameterSetName="NameWithId")]
[string]$EntityLogicalName2,
[parameter(Mandatory=$true, Position=4, ParameterSetName="NameWithId")]
[guid[]]$Id2s,
[parameter(Mandatory=$true, Position=5)]
[string]$RelationshipName,
[parameter(Mandatory=$false, Position=6)]
[bool]$IsReflexiveRelationship
)
$conn = VerifyCrmConnectionParam $conn;
if($CrmRecord1 -ne $null)
{
$EntityLogicalName1 = $CrmRecord1.logicalname
$Id1 = $CrmRecord1.($EntityLogicalName1 + "id")
}
if($CrmRecord2s -ne $null)
{
if($CrmRecord2s.Count -ne 0)
{
$EntityLogicalName2 = $CrmRecord2s[0].logicalname
$Ids = New-Object 'System.Collections.Generic.List[System.Guid]'
foreach($CrmRecord2 in $CrmRecord2s)
{
$Ids.Add($CrmRecord2.($EntityLogicalName2 + "id"))
}
$Id2s = $Ids.ToArray()
}
else
{
Write-Warning 'CrmRecords2 does not include any records.'
break;
}
}
try
{
$result = $conn.CreateMultiEntityAssociation($EntityLogicalName1, $Id1, $EntityLogicalName2, $Id2s, $RelationshipName, [Guid]::Empty, $IsReflexiveRelationship)
if(!$result)
{
return $conn.LastCrmException
}
}
catch
{
return $conn.LastCrmException
}
}
关于Powershell Dynamics CRM,如何向用户添加两个队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54080511/
在为 Web 应用程序用例图建模时,为用户可以拥有的每个角色创建一个角色是否更好?或拥有一个角色、用户和一个具有特权的矩阵? guest < 用户 < 版主 < 管理员 1: guest 、用户、版主
我无法使用 Elixir 连接到 Postgres: ** (Mix) The database for PhoenixChat.Repo couldn't be created: FATAL 28P
这个问题已经有答案了: Group by field name in Java (7 个回答) 已关闭 7 年前。 我必须编写一个需要 List 的方法并返回 Map> . User包含 Person
感谢您的帮助,首先我将显示代码: $dotaz = "Select * from customers JOIN contracts where customers.user_id ='".$_SESS
我只想向所有用户中的一个用户显示一个按钮。我尝试了 orderByKey() 但没有成功! 用户模型有 id 成员,我尝试使用 orderByChild("id") 但结果相同! 我什至尝试了以下技巧
我们在工作中从 MongoDB 切换到 Postgres,我正在建立一个 BDR 组。 在这一步,我正在考虑安全性并尽可能锁定。因此,我希望设置一个 replication 用户(角色)并让 BDR
export class UserListComponent implements OnInit{ users; constructor(private userService: UserS
我可以使用 Sonata User Bundle 将 FOS 包集成到 sonata Admin 包中。我的登录功能正常。现在我想添加 FOSUserBundle 中的更改密码等功能到 sonata
在 LinkedIn 中创建新应用程序时,我得到 4 个单独的代码: API key 秘钥 OAuth 用户 token OAuth 用户密码 我在 OAuth 流程中使用前两个。 的目的是什么?最后
所以..我几乎解决了所有问题。但现在我要处理另一个问题。我使用了这个连接字符串: SqlConnection con = new SqlConnection(@"Data Source=.\SQLEX
我有一组“用户”和一组“订单”。我想列出每个 user_id 的所有 order_id。 var users = { 0: { user_id: 111, us
我已经为我的Django应用创建了一个用户模型 class User(Model): """ The Authentication model. This contains the u
我被这个问题困住了,找不到解决方案。寻找一些方向。我正在用 laravel 开发一个新的项目,目前正致力于用户认证。我正在使用 Laravels 5.8 身份验证模块。 对密码恢复 View 做了一些
安装后我正在使用ansible配置几台计算机。 为此,我在机器上本地运行 ansible。安装中的“主要”用户通常具有不同的名称。我想将该用户用于诸如 become_user 之类的变量. “主要”用
我正在尝试制作一个运行 syncdb 的批处理文件来创建一个数据库文件,然后使用用户名“admin”和密码“admin”创建一个 super 用户。 到目前为止我的代码: python manage.
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 6 年前。 Improv
我已在 Azure 数据库服务器上设置异地复制。 服务器上运行的数据库之一具有我通过 SSMS 创建的登录名和用户: https://learn.microsoft.com/en-us/azure/s
我有一个 ionic 2 应用程序,正在使用 native FB Login 来检索名称/图片并将其保存到 NativeStorage。流程是我打开WelcomePage、登录并保存数据。从那里,na
这是我的用户身份验证方法: def user_login(request): if request.method == 'POST': username = request.P
我试图获取来自特定用户的所有推文,但是当我迭代在模板中抛出推文时,我得到“User”对象不可迭代 观看次数 tweets = User.objects.get(username__iexact='us
我是一名优秀的程序员,十分优秀!