Question
· May 11, 2018

Dynamic Object as a request to Business Process

Hi,

I am sending a request message to Business Process which has one property as Dynamic Object type. So i get the JSON in my REST service and convert that as a dynamic object and set that in the request message and calling the business process from the business service. But the request is not getting sent to the Business Process. Is it possible to send dynamic object input to the business process.

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

Thanks Robert for your reply. I tried that as a %String but when i try to retrieve the value in business process i get an error.

I have a persistent class with a string property and i set that value as the dynamic object. Now that persistent class is my request to the business process. Here is my property

Property Test %String;

Set classObj.Test = DynamicObject (I have created this from my JSON request - I can't define the dynamic object since it can have any different values and i get these dynamic values in my business process based on some logic, basically i dont have a defined set of properties for my dynamic object so i just have to pass that to my business process)

Now if i try this,

w request.Test.%Get("XYZ") (i know that XYX exists in my dynamic object)

i get an error "ERROR <Ens>ErrException: <INVALID OREF>zS1+2^" ...

But if i try to write the trace like request.Test then i get a result as dynamic object.. so the dynamic object seems to be there but i am not able to retrieve the value for some reason.

Shameer

is it defined that way?
Property Test as %String (MAXLEN="") ;

ATTENTION - default MAXLEN = 50 !!!!!

This might look odd but try

set local= dynamicObject.%ToJSON()
set classObj.Test = local

 
so you see if the issue is your property  
or your dynamic Object. as there are 2 objects in the command.
the only thing %String is checked against is Length. 
otherwise. if %ToJSON() fails your dynamic object is broken somehow

You didn't indicate the line you get the error.
anyhow the message is clear:
Either classObj or dynamicObject is not what you expect it to be.
If you test from Terminal you can use

ZWRITE classObj
ZWRITE dynamicObject

to see what they are.

otherwise, you may comment out one line and see if it still breaks e.g.

// set local= dynamicObject.%ToJSON()
set classObj.Test = "my dynamicObject = "_$ISOBJECT(dynamicObject)

So you see what happens.  I expect:  my dynamicObject = 0

So you see where you have to investigate further