· Feb 3, 2020

Cannot use class defined in another namespace even with package mapping


I have two namespaces

  1. In the first one, I have defined a class which Extends (%Persistent, Ens.Util.MessageBodyMethods), we'll call it NSOne.Msg.Req
  2. In the second namespace NSTwo, I want to use the previous class with something like SET pInput = ##class(NSOne.Msg.Req).%New()

I mapped the NSOne.Msg.Req package in namespace NSOne. In Atelier, I can see NSOne.Msg.Req in my NSOne. But, when I try to execute line 2 above, it tells me :

    "status": {
        "errors": [
                "error": "ERROR #5002: ObjectScript error: <PROTECT>^NStwo.Api.1 ^|^^/folder/NSONE_SRC/|NSOne.Msg.Req.1",
                "code": 5002,
                "domain": "%ObjectErrors",
                "id": "ObjectScriptError",
                "params": [
                    "<PROTECT>^NStwo.Api.1 ^|^^/folder/NSOne_SRC/|NSOne.Msg.RQ.Patient.1"
        "summary": "ERROR #5002: ObjectScript error: <PROTECT>^NSTwo.Api.1 ^|^^/folder/NSONE_SRC/|NSOne.Msg.Req.1"
    "content": null


Please note that if I open an IRIS session, set current namespace as NSTwo then it works:

NStwo > SET pInput = ##class(NSOne.Msg.Req).%New()

What did I miss ?

Discussion (2)0
Log in or sign up to continue