CRM相關SQl手記

2022-08-03 04:33:13 字數 1534 閱讀 8263

--1.查詢某個實體的主要字段

select [attributeid] as [attributeid],

[name] as [name] from [attributeasifpublishedview]

where entityid = '39c2a7d3-6689-4cd5-8673-30545d918d6c'

and displaymask & 256 = 256

--2.根據實體code查詢實體資訊

select top 1 entityid,logicalname from metadataschema.entity where objecttypecode=1

--3.獲取實體選項集型別的字段

select distinct llv.label,apv.value from

( select top 1 * from metadataschema.entity where entity.name = 'account'

) entity

inner join dbo.attributelogicalview alv on entity.entityid=alv.entityid

inner join attributepicklistvalueview apv on alv.optionsetid=apv.optionsetid

inner join localizedlabelview llv on apv.attributepicklistvalueid=llv.objectid

and alv.name='crm_is_group' and llv.objectcolumnname='displayname'

--4.查詢某個實體的某個欄位的欄位名稱

select alv.attributeid,name,physicalname from attributelogicalview alv

inner join

( select top 1 entityid from metadataschema.entity where objecttypecode=1

)et on alv.entityid=et.entityid

where columnnumber in(9,10029,10025)

--5.查詢實體的中文和英文內容

select e.name,ll.label

from metadataschema.localizedlabel ll

inner join metadataschema.entity e

on ll.objectid=e.entityid and ll.solutionid=e.solutionid

inner join solution s

on ll.solutionid=s.solutionid

where (s.uniquename='active' )

and ll.objectcolumnname='localizedname'

and e.name='systemuser'

CRM相關操作

1.前端介面獲取當前crm實體記錄的guid var currententityid xrm.page.data.entity.getid 2.前端介面獲取當前crm實體記錄欄位的值 xrm.page.getattribute createdfromcode getvalue createdfrom...

css相關 隨手記

1.獲取div下面第乙個span裡面的值。id thisdiv children span eq 0 text class thisclass children span eq 0 text 獲取其他元素將span替換為其他元素,獲取第二個將0替換為1 根據id或者class獲取當前元素的文字 id...

SQL開發隨手記

delete from 表名 truncate table 表名 不帶where引數的delete語句可以刪除mysql表中所有內容,使用truncate table也可以清空mysql表中所有內容。效率上truncate比delete快,但truncate刪除後不記錄mysql日誌,不可以恢復資料...