SQL Query สำหรับ ดู Extension Objects บน Business Central เวอร์ชั่น BC16 ขึ้นไป

Spread the love

สวัสดีครับ จากบทความก่อนหน้านี้ SQL Query SCRIPT สำหรับ ดู existing extension objects บน D365BC พบว่าเมื่อเอา SQL Script ไปลอง run บน Database ของ Business Central ที่เป็นเวอร์ชั้นตั้งแต่ BC16 ขึ้นไปก็พบว่า SQL Script ที่ใช้เรียกดูว่าใน Extension มี Object อะไรบ้างก็ใช้งานไม่ได้แล้ว

Photo by Gantas Vaičiulėnas on Unsplash

สาเหตุก็มาจากทาง Microsoft ได้ปรับเปลี่ยน Virtual Tables ที่เก็บข้อมูล Extension Object ใหม่ตั้งแต่เวอร์ชั่น BC16 ขึ้นไปนั่นเอง Viewing Table Data – Business Central

ในบทความนี้จะมาอัพเดต Script ที่ใช้เรียกดู Object ภายใน Extension ที่ได้ Install ลงในระบบ Business Central ครับ

สามารถ Copy นี้ไปใช้กับ Database ของ Business Central ที่เป็นเวอร์ชั่น BC16 ขึ้นไปได้เลยครับ

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 [Application Object Metadata] OM
            left join [Published Application] APP 
                on APP.[Package ID] = OM.[Package ID]) A
where ID >= 50000
    and ID <= 99999
order by T,ID

รูปด้านล่างคือผลลัพธ์ของ sql query script ที่ไม่มี where ID >= 50000 และ ID <= 99999

dynamics 365 business central existing object

แล้วเจอกันใหม่ในบทความหน้า สวัสดีครับ

ERP Consultant ที่อยากแชร์ความรู้เกี่ยวกับการพัฒนาโปรแกรม Microsoft Dynamics NAV / 365 Business Central ทั้งทางด้าน Business และ Technical ให้กับเหล่านักศึกษา, ผู้ที่เริ่มต้นอาชีพนี้ หรือต้องการที่จะเพิ่มเติมความรู้ด้าน ERP ในรูปแบบ blog ที่เป็นภาษาไทย Contact: amaddev90@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *