Question
· Mar 29, 2022

<METHOD DOES NOT EXIST> Error getting when call method from ClassMethod.

Hi Team,

I am getting the below error while calling Method from ClassMethod in the same cls file.

Please help me with this, So It would be very helpful for me.

ERROR <Ens>ErrException: <METHOD DOES NOT EXIST>zHL7ToFHIRService+13 ^FHIRConversion.FHIR.BusinessService.HL7ToFHIRService.1 *SendRequestSync,Ens.BusinessService -- logged as '-'
number - @'
Set tSC = ##class(Ens.BusinessService).SendRequestSync("HL7ToFHIRBusinessProcess",pInput,.tResponse)'
 
 
Thanks,
Harshdeep Acharya
Product version: IRIS 2021.1
Discussion (4)1
Log in or sign up to continue

calling Method from ClassMethod

This is the problem. A Method needs to be called in the context of an instantiated object. A ClassMethod by definition isn't associated with an instantiated object.

If it's necessary to do it this way, your ClassMethod could use %New() to instantiate an object and then call the Method on that object:

set myObj = ##class(My.Object.Class).%New()
set tSC=myObj.myMethod()

But, it looks like you're working with a Business Service class. For that, it isn't enough to simply use %New(). You need to use Ens.Director::CreateBusinessService to instantiate the object before calling the Method.

https://docs.intersystems.com/irisforhealth20212/csp/docbook/DocBook.UI....