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.
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)
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")