How to add a custom function through package?

Hi Team,

With reference from below URL, i have created one sample package with flash alert message.

But after installation and restart, am not getting the expected result in that route(“location”: “app/model/custom.rb”,).

Kindly share the more details about package, with how to add the custom function.

Thanks,
Sankara.S

Hi @sankara_xerago - please provide more information/code. That sounds like an implementation error. Having the source code accessible would be of help.

Hi @thorsteneckel,

Below two things are am trying in zammad,

  • adding a new function button in chat box like reply.
  • with that button I’m trying to call one api from outside.

Below is my code sample for API access,

url = URI("****")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["x-redmine-api-key"] = ''
request["content-type"] = 'application/json'
request["cache-control"] = 'no-cache'
request.body = ""
response = http.request(request)
puts response.read_body

With this code i have created the .szpm file as per (Examples of zpm files?). After installation & restart of server, while trying to access the route which i mentioned in .szpm file in the location field, am getting the “server error : 500”.

I have few doubts in .szpm file
* what is build host? for that which detail i need to give in the field.
*for my functionality(new button funtion for chat box) which location of zammad i need to give in the location field.

Thanks in advance.

Hi @sankara_xerago - unfortunately this is not yet enough information for me to help you :slightly_frowning_face: You have to be capable of identifying the files you need to change on your own. Otherwise someone else needs to point you to the required file every single time. I described the process on how to find the right template and JS controller in detail here: Examples of zpm files?

There is also this great thread about best practices on how to develop an addon. There are some cool references to open source addons as well.

Regarding the build host: This attribute is optional and soft deprecated. You don’t need to fill it out or even add it to your file.

I’d recommend to you to have a local development system and start adding and changing local files first and start creating a addon once everything works as you want. This reduces the overhead and is easier and faster for you.

Happy hacking!