Persistent table with %GUID As property

How to set the property 

 Property myguid As %GUID [ Required ];

S obj=class object

S obj.myguid ="guid string"

  • 0
  • 64
  • 1
  • 2


do you look for $System.Util.CreateGUID() ?

Property myguid As %GUID Required ];

Will not work as %Lbrary.GUID is an abstract utility class and does not extend %DataType.  So it is no DataType and has no Accessors!

use instead.:

Property myguid As  %String  [Required];


S obj.myguid = $System. Util.CreateGUID()

But you are free to define your own data type combining %String and %GUID

Pattern can be used:

Property GUID As %String(PATTERN = "8AN1""-""4AN1""-""4AN1""-""4AN1""-""12AN") [ InitialExpression = {$SYSTEM.Util.CreateGUID()} ];

And A can be replaced with L or U to store GUIDs in one case.

You can also try overriding the GUIDENABLED parameter from %Persistent:

Class User.Test1 Extends %Persistent


Parameter GUIDENABLED = 1;

Property Property1 as %String;

Storage Default


<Data name="Test1DefaultData">

<Value name="1">



<Value name="2">












Will give you:

USER>set obj = ##class(Test1).%New()

USER>set obj.Property1 = "Hello"

USER>w obj.%Save()


USER>w obj."%%GUID"


The ^OBJ.GUID index that this creates can be accessed via %ExtentMgr.GUID.