Published on 12/21/2020
Published by Pratik Takle
Return service from template
- We saw that in Awesome Enterprise, we can return variable, array or json from template and module.
- But there is provision that we can also return service from template and module.
- Here is the example how we do it
1 2 3 4 5 6 7 8 |
//** please consider this as demo only || values and names will change as per requirement **// [templates.add main] [templates.run second /] [/templates.add] [templates.add second] //** Here we are returning the service **// [template.return service="service_slug" {parameters needed to perform the operations in service} /] [/templates.add] |
Example:
- Module code
1 2 3 4 5 6 |
[templates.add main] [templates.run second /] [/templates.add] [templates.add second] [template.return service="common.add" parm1="12" param2="12" /] [/templates.add] |
- Common Service – add module
1 2 3 4 |
[templates.add main] [template.set addstr="{module.parm1}+{module.param2}" /] [template.get addstr.math dump=t /] [/templates.add] |
- This service is executing addition of parameters, which are received by service module
- This kind of functionality can be use when we there is user response needs to be shown, like success res and error response.