สวัสดีครับ ใน blog นี้ผมจะมาแบ่งปัน sql query script สำหรับดูว่ามี object อะไรบ้างที่ถูกสร้างขึ้นมาด้วย extension ภายใน database ของโปรแกรม Microsoft Dynamics 365 Business Central กันครับ
หากเป็นเมื่อก่อน (Microsoft Dynamics NAV 2013/2015/2016/2017/2018) คงไม่มีปัญหาอะไร เพราะเราสามารถดูทุก objects ที่ถูกสร้างขึ้นได้ผ่านโปรแกรม C/SIDE แต่เมื่อเป็นเวอร์ชั่น Microsoft Dynamics 365 Business Central ที่จำเป็นจำต้อง implement โปรแกรมผ่านการทำ extension แล้วนั้นก็จะเริ่มยุ่งยากขึ้นมาหน่อยเพราะมีทั้ง object ใหม่ที่เพิ่มขึ้นมาเช่น table extension และ page extension
ดังนั้นเราจึงต้องอาศัย sql query script สำหรับเรียกดูข้อมูลความสัมพันธ์กันระหว่าง table NAV App Object Metadata และ NAV App สำหรับในการดู existing objects
สามารถ copy sql query script นี้ไปใช้ได้เลยครับ
select
[Extension Name]
,Publisher
,[Version Major]
,[Object Type]
,ID
,Name
,[SubType]
from (
select
[Type] as T
,'' as [Extension Name]
,'' as Publisher
,'' as [Version Major]
,case [Type]
when 1 then 'table'
when 3 then 'report'
when 5 then 'codeunit'
when 6 then 'xmlport'
when 7 then 'menusuite'
when 8 then 'page'
when 9 then 'query'
when 14 then 'page extension'
when 15 then 'table extension' end as [Object Type]
,[ID]
,[Name]
,'' as [SubType]
from [Object]
where Type <> 0
union all
select
[Object Type]
,APP.[Name] as [Extension Name]
,Publisher
,[Version Major]
,case [Object Type]
when 1 then 'table'
when 3 then 'report'
when 5 then 'codeunit'
when 6 then 'xmlport'
when 7 then 'menusuite'
when 8 then 'page'
when 9 then 'query'
when 14 then 'page extension'
when 15 then 'table extension' end as [Object Type]
,[Object ID]
,[Object Name]
,[Object Subtype]
from [NAV App Object Metadata] OM
left join [NAV App] APP
on APP.[Package ID] = OM.[App Package ID]) A
where ID >= 50000
and ID <= 99999
order by T,ID
รูปด้านล่างคือผลลัพธ์ของ sql query script ครับ โดยผมลบ condition ID >= 50000 และ ID <= 99999 ออกครับ
แล้วเจอกันใหมาใน blog ต่อไปครับ สวัสดีครับ