Notifications

20 views

Problem


If you need to access on Outbound REST message in another Scope. Assuming it is accessible, you may sometimes get the error:

REST Msg Outbound - RESTMessageClient : Error constructing REST Message/Method: xxxxxxxxxxx [HR Task] HTTP Method (POST): com.glide.generators.InvalidGlideRecordException: Unable to find REST Message Record with Name: xxxxxxxxxxx: com.glide.rest.outbound.RESTMessageDAO.getRestMessageRecord(RESTMessageDAO.java:86)
com.glide.rest.outbound.RESTMessageDAO.<init>(RESTMessageDAO.java:71)
com.glide.rest.outbound.RESTMessageDAO.newInstance(RESTMessageDAO.java:67)
com.glide.rest.outbound.RESTMessageConfig.initNew(RESTMessageConfig.java:67)
com.glide.rest.outbound.RESTMessageClient.<init>(RESTMessageClient.java:57)

[...]

java.lang.Thread.run(Thread.java:748)

Evaluator: com.glide.communications.ProcessingException: Error constructing REST Message/Method:xxxxxxxxxxxr [HR Task] HTTP Method (POST)
Caused by error in script at line 15

13: gs.print(gr.function_name);
14: gs.print(gr.rest_message.name);
==> 15: var sm = new sn_ws.RESTMessageV2(gr.rest_message.name, gr.function_name);
16: 

Solution


 

The Outbound REST message you are trying to call from within your Business Rule or Script Include is in another scope. But it is still accessible. You need to Prefix the REST message name with the scope name. This is referring to the first argument of the function below :

RESTMessageV2(String name, String methodName)

So if you know the name of the Outbound REST you can just add the prefix e.g.:

 

SCOPE = 'my_scope'

REST Message= 'my_rest'

The function call would look like :

var msg = new sn_ws.RESTMessageV2('my_scope.my_rest', 'function_name');

This solution applies even if the REST name is a variable e.g. :

 

SCOPE = 'my_scope'

REST Message= gr.rest_name

var msg = new sn_ws.RESTMessageV2('my_scope.'+gr.rest_name, 'function_name');

 

Root Cause


To call any Scoped resources you need to explicitly specify the scope if you are not in that scope.

Article Information

Last Updated:2018-12-10 00:40:46
Published:2018-12-10