Written by

DBA at WebMais Sistemas
Question Lucas Fernandes · Mar 6, 2019

Applying a custom resource to a Management Portal page through code

Can I apply a custom resource to a Management Portal page through code, using the method or global? The documentation only shows the manual mode: https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GCAS_rsrcs#GCAS_C181701

Or export the settings already saved.

Comments

Eduard Lebedyuk · Mar 7, 2019

Use methods from %CSP.Portal.Utils class:

set pageID = "" //page url, URL encoded via $zconvert(url,"O","URL")

set currentResource = ##class(%CSP.Portal.Utils).%GetCustomResource(pageID)

set sc = ##class(%CSP.Portal.Utils).%SetCustomResource(pageID, newResource)

0
Lucas Fernandes  Mar 8, 2019 to Eduard Lebedyuk

Thank you Eduard. That's what I was looking for. I also found the method that exports and imports the settings:

do ##class(%SYS.Portal.Resources).Export("CustomPortalResourcesExport.xml")

do ##class(%SYS.Portal.Resources).Import("CustomPortalResourcesExport.xml")

0