As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
I have a collection hook in place using the code from this example http://stackoverflow.com/questions/20057292/kinvey-business-logic-example-of-saving-new-object-on-collections-javascript
The only thing changed is the collection name however I'm getting this error:
"error": "BLRuntimeError",
"description": "The Business Logic script has a runtime error. See debug message for details.",
"debug": "UnallowedError: Method 'response.continue' is not allowed in this context."
no matter what I try I can't seem to access global variables within the callback - any suggestions.
response.continue() works in collection hooks, but not in custom endpoints. In custom endpoints (and in collection hooks if you want to end execution of a request), use response.complete(). For more information on completing business logic, see http://devcenter.kinvey.com/guides/business-logic#completion
L
Logan Maire
said
over 9 years ago
Thanks for your help Michael.
How do I access the response object from within the modules callback? All I'm trying to do is average data from one collection and update another collection item with that average.
M
Michael
said
over 9 years ago
I'm not sure what you are asking - the response object should be accessible in any callback, as long as the function occurs within the scope of the onRequest function.
The request only completes when the following is outside of the callback.
response.body = docs;
response.complete(200);
You can see in the image, the response object is blue only when outside the callback. The docs object is only blue if it's inside the callback. Even if I declare the docs (or some other) variable before the module class, I cannot set/update it from within the callback.
I hope this makes sense - it's hard for me to explain - I'm a noob!
Logan Maire
I have a collection hook in place using the code from this example http://stackoverflow.com/questions/20057292/kinvey-business-logic-example-of-saving-new-object-on-collections-javascript
The only thing changed is the collection name however I'm getting this error:
"error": "BLRuntimeError",
"description": "The Business Logic script has a runtime error. See debug message for details.",
"debug": "UnallowedError: Method 'response.continue' is not allowed in this context."
no matter what I try I can't seem to access global variables within the callback - any suggestions.