Webhooks - Bulk Updates


I have just executed a test where I do a bulk update on a list of companies in a selection.

I have executed two different tests, one where I update the our contact and one where I update "street address 1".

Neither bulk update seems to trigger the contact.change-webhook event. If I do the same change in the GUI, the event is triggered.

According to Tony, the webhook-events should be triggered both when doing bulk-updates as well as native superoffice imports (which I haven't tried yet).

So, is there something that I could have missed or is the support for bulk-updates/import not implemented in online yet??



RE: Webhooks - Bulk Updates

Hi Marcus,

As stated in this forum post, bulk updates execute as batch tasks. Batch tasks execute in their own process and have their own configuration file dependencies. And as stated in that forum post webhooks are now enabled in SOD.

Before responding to this post, I took the time to dig into this with the good folks in the SuperOffice Online Operations Center. Together we verified that the webhooks are also indeed enabled for the online production environment as well. 

You said "Neither bulk update seems to trigger the contact.change-webhook event. If I do the same change in the GUI, the event is triggered.".

I'm going to need more information about your online environment and tenantId where you tried this out. 

Best regards.

Von: Tony Yates 7. Dez 2020

RE: Webhooks - Bulk Updates

Hi Tony,

I've sent you a private message with the customer data...


Von: Marcus Svenningsson 7. Dez 2020

RE: Webhooks - Bulk Updates

I did tests in two of my test tenants in both development (SOD) and production. Webhooks (types: crmscript and webhook) work as expected, even for bulk update jobs.


Von: Tony Yates 8. Dez 2020

RE: Webhooks - Bulk Updates


Very interesting and useful.

One additional question. Do you still have to register a custom app for the online environment to use webhooks when pointing to a crmscript?

Hope you understand what I mean :)


Best regards
Patrik Lindholm

Von: Patrik Lindholm 9. Dez 2020

RE: Webhooks - Bulk Updates

HI Patrik,

Yes, Customer Service is just another application with webhooks already enabled. If you have the license to access CRMScripts, you can create/manage webhooks in Service.

Something to note, applications can only see the webhooks they themselves create. Therefore, when you call GetAllWebhooks, you will only receive webhooks created by Service. This is the same behavior for all applications calling the equivalent API (SOAP, REST, Core).

Get all web hooks

#setLanguageLevel 3;

NSWebhookAgent webhookAgent;
NSWebhook[] webhooks = webhookAgent.GetAllWebhooks("","",0);

for(Integer i = 0; i < webhooks.length(); i++) {
  Integer state = webhooks[i].GetState();
  printLine("Name: " + webhooks[i].GetName());
  printLine("ID: " + webhooks[i].GetWebhookId().toString());
  printLine("State: " + state.toString());
  printLine("Secret: " + webhooks[i].GetSecret());
  printLine("TargetUrl: " + webhooks[i].GetTargetUrl());
  printLine("Registered By: " + webhooks[i].GetRegisteredAssociate().GetName());
  printLine("Registered Date: " + webhooks[i].GetRegistered().toString());
  printLine("Updated By: " + webhooks[i].GetUpdatedAssociate().GetName());
  printLine("Updated Date: " + webhooks[i].GetUpdated().toString());
  printLine("Type: " + webhooks[i].GetType());
  String[] events = webhooks[i].GetEvents();
  for(Integer i = 0; i < events.length(); i++) {
  	printLine("-  " + events[i]);
  // delete when not needed


Create a webhook

#setLanguageLevel 3;

 * Create a new webhook to subscribe to person events.


NSWebhookAgent webhookAgent;
NSWebhook webhook = webhookAgent.CreateDefaultWebhook();

String[] events = String("person.created,person.changed,person.deleted").split(",");
webhook.SetName("Person Webhook from CRMScript");

webhook = webhookAgent.SaveWebhook(webhook);
printLine("Webhook succeeded with ID: " + webhook.GetWebhookId().toString());


Hope this helps.

Von: Tony Yates 9. Dez 2020

RE: Webhooks - Bulk Updates

Thanks Tony

Von: Patrik Lindholm 9. Dez 2020

RE: Webhooks - Bulk Updates


Thanks for clarifying the architecture behind the scenes, that's very valuable information for the overall understanding.

This could actually be worth adding to the documentation of "CrmScript Hooks" [1] so it gets clear what's available without having to register for a custom app, etc. Your different crmscript examples could also be valuable to add there. Just so it gets even easier to just getting started.


Different types of calling methods

It would also be worth pointing out the difference of the code needed in the called crmscript depending on if you call the crmscript using an URL vs using the crmscript-include-name.

In the URL-case your CRMScript is handled as an "web service end point CRMScript", where the crmscript code have to be wrapped using: 


Whereas in the case of calling the script using the crmscript-include-name, the called crmscript is handled as any normal crmscript.

How to get the parameters

It might also be worth mentioning how parameters can be fetched from the call depending on the method used and if there are any special pros and cons using different methods.

In the case of using the crmscript-include-name, I have noticed that the parameters can be gotten using getVariables() or getVariable("variableName").

In some of the examples of the URL-method, the function getCgiContent() is used instead. I don't know if getVariables() can be used also for these type of method-calls?

This could be valuable information if one converts from one method to the other or wants to be using a generic method that could work out of the box for both types of method calls.



Von: Marcus Svenningsson 9. Dez 2020

RE: Webhooks - Bulk Updates

Prefer that you don't use URLs to trigger CRM scripts, since URLs can change if a tenant is moved to a different cluster.

Using Script include ids is more stable.

Also the webhook doesn't have to loop out and back in through the firewall - a script hook is executed directly within the datacenter. Saves a 100 ms just in router hops.

Von: Christian Mogensen 9. Dez 2020

RE: Webhooks - Bulk Updates

Great feedback Christian, thanks!


Von: Marcus Svenningsson 9. Dez 2020

RE: Webhooks - Bulk Updates

Very nice information!



Von: Anders Larsson 11. Dez 2020