Dynamic CRM常用代碼記錄


 

 

Dynamic CRM 查詢實體記錄 被共享給了 哪個用戶

 --客戶表名"new_customer"  SELECT u.FullName AS 被共享人,a.new_name AS 客戶名稱,sup.SystemUserid AS 共享人ID,POA.ObjectId AS 共享記錄ID FROM PrincipalObjectAccess  POA inner  join SystemUserPrincipals sup on POA.PrincipalId = sup.PrincipalId  inner join SystemUserBase u  on sup.SystemUserId=u.SystemUserId inner join dbo.new_customer a  on a.new_customerId=POA.ObjectId WHERE POA.ObjectId IN (SELECT new_customerId FROM dbo.new_customer)

--查詢實體信息,實體名稱:account select * from MetadataSchema.Entity where name= 'account'

查詢窗體信息,ObjectTypeCode: 實體的code select * from systemform where ObjectTypeCode = 1

查詢視圖信息: --查詢視圖信息,ReturnedTypeCode:實體的code select * from SavedQuerybase where ReturnedTypeCode = 1 

查詢字段信息: --查詢字段信息 with attr as(    select * from MetadataSchema.Attribute as a    where a.EntityId in (select entityid from MetadataSchema.Entity     where name = 'new_member') and a.IsCustomField = 1 )  select a.attributeid,a.Name,label.Label,ty.Description, (select top 1 name from MetadataSchema.Entity where EntityId in ( select ship.ReferencedEntityId from MetadataSchema.Relationship as ship where ship.ReferencingAttributeId = a.AttributeId)) as 'lookName'  from attr as a inner join MetadataSchema.LocalizedLabel as label on a.attributeid = label.objectid inner join MetadataSchema.AttributeTypes as ty on a.AttributeTypeId = ty.AttributeTypeId where label.objectcolumnname = 'DisplayName' and a.validforcreateapi = 1

查詢關系信息: select * from MetadataSchema.Relationship where ReferencingEntityId in (select top 1 entityid from MetadataSchema.Entity where name = 'new_store')

實體ID查詢方法:  SELECT ObjectTypeCode from Entity  where  name='實體名稱' 調用函數方法: select getpicklist('字段名稱',字段值,實體ID)

--@AttributeName 字段名稱 --@AttributeValue 字段值 --@ObjectTypeCode 實體ID create function GetPickList( @AttributeName varchar(100), @AttributeValue int, @ObjectTypeCode int ) returns varchar(100) as begin declare @value varchar(100)  SELECT @value=Value FROM StringMap  where  AttributeName=@AttributeName AND AttributeValue=@AttributeValue and ObjectTypeCode=@ObjectTypeCode  return @value end

查詢 picklist的方法:

   select    a.AttributeValue   ,a.Value    from StringMap a    where a.ObjectTypeCode=1  and a.AttributeName='new_acc_type' and Attributevalue=100000000

Microsoft Dynamics CRM 解決數據大於5000時,頁面上只能導出5000+數據。

頁面顯示: update [MSCRM_CONFIG].[dbo].[DeploymentProperties] set IntColumn=10000 --調整成10000+   頁面導出:   一、在CRM2011中如果想要導出超過10000記錄數據,做法如下:針對CRM2011導出Excel 時,默認只能導出10000的限制在CRM2011產品中的MSCRM 對應的組織數據庫中,找到名為organizationbase的表, 修改列名為maxrecordsforexporttoexcel的值即可。此處可不要隨便將值設置為-1 。   二、在 CRM2011中如果想要顯示5000+之后的具體記錄數,做法如下: 針對全局的顯示記錄數最大值設置在CRM2011產品中的后台MSCRM_Config數據庫中表名為DeploymentProperties的系統級的參數設定表,找到ColumnName為 PagingLimt的記錄,將IntColumn更改為最大的記錄限制數如50000,如果更改為無限制(有多少記錄顯示多數記錄數)則可設置為-1,修改完成后重啟IIS (iisreset)生效針對用戶每頁顯示記錄條數的設置 在MSCRM中可通過個人選項設置單頁的最大顯示記錄條數,但最大值為250, 多么好的一個數值,但往往很多客戶都想要超越這一值, 通過修改后台表參數也可以達到修改的目的。此 表在MSCRM對應的組織數據庫中,如組織名為Sky,則此表在sky_mscrm下,表名為UserSettings ,修改列名為PagingLimt的值即可,此處可不要隨便將值設置為-1 。  三,代碼只能查出5000+數據方法 update OrganizationBase set MaxRecordsForExportToExcel = 99999999

CRM 數據密鑰 忘記 解決方案

UPDATE EmailServerProfile SET IncomingPassword=null UPDATE EmailServerProfile SET OutgoingPassword=null UPDATE Mailbox SET Password=null UPDATE Queue SET EmailPassword=null UPDATE UserSettings SET EmailPassword=null

 

netsh http show urlacl

netsh http del urlacl https://+:443/adfs/

netsh http del urlacl https://+:443/FederationMetadata/2007-06/

配置ifd命令:

Add-PSSnapin Microsoft.Crm.PowerShell $ifd = Get-CrmSetting -SettingType "IfdSettings"

$ifd.Enabled = 1

$ifd.DiscoveryWebServiceRootDomain = "devurl"  //auth.servername:446

$ifd.ExternalDomain ="https://authurl"  //  https://auth.server:446

$ifd.OrganizationWebServiceRootDomain= "domain+port" // domain+port

$ifd.WebApplicationRootDomain ="zenner.com.cn:446" //serverurl

Set-CrmSetting $ifd iisreset  

Set-ADFSRelyingPartyTrust –TargetName "server" –TokenLifetime 500      //單位 分鍾  server:  anth url

Set-ADFSRelyingPartyTrust –TargetName "CRM Claims Relying Party" –TokenLifetime 500

 
ifd XRMTool 工具鏈接字符串
AuthType=IFD;Url=https://servername:port/organizationname;
HomeRealmUri=https://servername:port/adfs/services/trust/mex/;

Username=domin\username; Password=password

ADFS 證書 驗證 設置

Set-AdfsProperties -AutoCertificateRollover $true

Set-AdfsRelyingPartyTrust -targetname "IFD Access" -signingcertificaterevocationcheck none

 Set-AdfsRelyingPartyTrust -targetname "IFD Access" -encryptioncertificaterevocationcheck none 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM