Jamie Posted January 8, 2015 Report Posted January 8, 2015 (edited) Hello, I am in the process of creating a Module and I am in need of getting the newly created service's ID within the addService function. The ID I am after is the ending ID on this URL: admin/clients/editservice/2/5/ Obviously the `2` represents the client and the `5` represents the service's ID. Is it possible to get the `5` within the addService() function inside a Module? Or would I have to calculate it myself (As I am guessing that the service is created after addService())? Any advice would be really appreciated. Regards, Jamie Edit: Accidentally put 'addPackage()' instead of 'AddService()'; Ops! Edited January 8, 2015 by Jamie Quote
Tyson Posted January 8, 2015 Report Posted January 8, 2015 As you guessed, the service ID is not available to Module::addService because it is unknown until after that method call, and would only be created if no errors were encountered. What are you trying to use it for? You might be able to create a plugin that checks the addService event handler, and use that to determine the service ID after the service has been created. Quote
Jamie Posted January 8, 2015 Author Report Posted January 8, 2015 I am attempting to create a module for TCAdmin. TCAdmin uses the billing ID as a reference (It also uses the billing ID as the main ID to reference a service) and instead of creating a whole new lot of IDs that don't match Blesta's services IDs, I thought it would be more effective if the service ID matched the billing ID. I appreciate you comment and I'll have a little play around and see what I can come up with. Thanks alot Quote
Tyson Posted January 8, 2015 Report Posted January 8, 2015 I think most APIs have their own reference ID, and most modules simply store and use that ID where necessary. I don't think you need to go out of your way to match them to service IDs in Blesta. That ID should be a back-end ID anyway, which no one would see (except admins, if you allowed them to add an existing TCAdmin account into Blesta without provisioning it). Jamie 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.