How to add sitemap into your customization

Hello everybody,

today I want to describe some simple steps of how to add into your customizaiton sitemap. As you already know, sitemap of Acumatica is saved in database. And if you make customization of your sitemap you may need to add to your project.xml something like this:

<Customization level="0" description="" product-version="5.30">
    <SiteMapNode>
        <data-set>
            <relations version="3" main-table="SiteMap" />
            <layout>
                <table name="SiteMap" />
            </layout>
            <data>
                <SiteMap>
					<row Position="72" Title="Warehouse" 
Url="~/Frames/Default.aspx" Expanded="0" IsFolder="0" 
ScreenID="TC000000" 
NodeID="95A4548D-CA01-4485-992F-FADE1597DC95" ParentID="00000000-0000-0000-0000-000000000000" /> <row Position="1" Title="Producing" Url="" Expanded="0" IsFolder="0" ScreenID="" 
NodeID="42C9E271-EC9D-483E-9A8F-2912E3E7C2ED" ParentID="95A4548D-CA01-4485-992F-FADE1597DC95" /> <row Position="2" Title="Food Administratio" Url="" Expanded="0" IsFolder="0" ScreenID="" NodeID="D9CA98E4-73CC-4DEB-BFED-35EFFD72274C" 
ParentID="95A4548D-CA01-4485-992F-FADE1597DC95" />         <!-- Pages  --> <row Position="1" Title="Management of materials" Url="~/Pages/TC/TC100000.aspx" Expanded="0" IsFolder="0" ScreenID="TC100000" 
NodeID="4083D0D7-3FC1-412F-A3FA-E7D730F3EBFA" ParentID="42C9E271-EC9D-483E-9A8F-2912E3E7C2ED" />                 </SiteMap>             </data>         </data-set>     </SiteMapNode>

For now I'd like to talk only about sitemap node. After I created sitemap node once, soon I got request to modify it and for me it was a bit painful from standpoint of regenerating of xml nodes.

So I decided to write some simple sql statement that allows me to to create sitemap manually in Acumatica, and then read it from db in convenient way for me. 

Below goes that SQL:

select '<row Position="'+ CAST(s.Position as nvarchar(MAX)) +'" Title="' + s.Title  
	+ '"'
	 + ' Url="'  + COALESCE(s.Url, '' ) + '"'
	+ ' Expanded="' + CAST(s.Expanded as nvarchar(1)) + '"'
	+ ' IsFolder="' + CAST(s.IsFolder as nvarchar(1)) + '"'
	+ ' ScreenID="' + COALESCE(s.ScreenID, '') + '"' 
	+ ' NodeID="' + CAST(s.NodeID as nvarchar(MAX)) + '"'
	+ ' ParentID="' + CAST(s.ParentID as nvarchar(MAX)) + '"'
	+ ' Description="' + COALESCE(s.Description, '') + '"' + ' />' 
	as SiteMapRow
	from SiteMap s where CreatedDateTime > '2017-09-12 12:00:00' order by Position

with that SQL you can simply copy/paste generated result into your customization

No Comments

Add a Comment