Application Programming Interface forums

0 Abonnenter

3 Emner

5006 Samtaler

Area for questions and answers about SuperOffice API's.

All conversations (5006)

done
Answered
push_pin lock

Do Project Member Webhooks not work?

Hi, I am trying to create a webhook via a CRMScript based on changes made to project members. It looks like it should be possible, https://docs.superoffice.com/en/automation/webhook/reference/project-member-events.html , but nothing fires when I add/edit or delete a project member. Here is the code registering the webhook. #setLanguageLevel 4; String targetCrmScript = "ProjectMemberWebHook"; String[] events = String("projectmember.created,projectmember.changed,projectmember.deleted").split(","); NSWebhookAgent webhookAgent; NSWebhook webhook = webhookAgent.CreateDefaultWebhook(); //NSWebhook webhook = webhookAgent.GetWebhook(1); webhook.SetEvents(events); webhook.SetName("Project Members Web Hook Handler"); webhook.SetType("crmscript"); webhook.SetTargetUrl(targetCrmScript); webhook.SetErrorsEmail("trevor.sharp@synergytechnology.co.uk"); webhook.SetState(1); // Set it as active! webhook = webhookAgent.SaveWebhook(webhook); printLine("Webhook succeeded with ID: " + webhook.GetWebhookId().toString()); And here is the webhook. #setLanguageLevel 4; String variablesAvailable = ""; Map m = getVariables(); while (!m.eof()) { variablesAvailable = variablesAvailable + m.getKey().stripLeadingAndTrailing(" ") + " - " + m.getVal().stripLeadingAndTrailing(" ") + "<BR>"; //Move To Next Record m.next(); } log(variablesAvailable); It writes ok to the log when I enable the webhook, but nothing is added to the log when I make changes to the Project Member, and I cannot get any traces from this script. Also with the new screen for creating the webhooks via the GUI, this does not reference the Project Members table, which makes me wonder if it is not supported, but then why have a whole help page on project member events if it is not supported. Does anyone know whether the project members web hooks should fire or not, have I missed something in my code, or am I trying to achieve the impossible. Many thanks, Trevor
Trevor Sharp
2
1
10 t, 36 m siden | 03:01 p.m.
Emne:
Service and CRMScript Discussion

Siste svar

Try clearing the caches and see if the webhook is triggered then   NSDiagnosticsAgent da; da.FlushCaches();  
by David Hollegien
10 t, 0 m siden | 03:36 p.m.
done
Answered
push_pin lock

Pretty format json?

Is it possible to pretty format a json string: Map m = Map (data); printLine(m.toJson()); Outputs: { "First": "Martin", "Last": "Andersen"} I would like to have it like this: {   "First": "Martin",   "Last": "Andersen" }   Regards Martin
Martin Andersen
4
5
10. jul. 2026 | 10:54 a.m.
Emne:
Service and CRMScript Discussion

Siste svar

Can I ask in what context are you going to use the formatted JSON? In addition to those solutions mentioned above, depending on your use - there are other options. You have webpages such as jsonlint.com which will validate and format your JSON string: This of course requires you to copy / paste the output, which may be a hassle if it's a large string. If you're having a panel where you want to display it formatted, you can use jQuery libraries for that purpose.
by Simen Mostuen Iversen
3. aug. 2026 | 06:40 a.m.
done
Answered
push_pin lock

Number and Date Formatting not working when using "NSQuoteAgent.GetOrderConfirmation"

Hi, You may have seen from a previous post (where I raised a question on document filename formats), that I have written a script that uses the "NSQuoteAgent.GetOrderConfirmation" function, to allow one of our customers to produce multple order documents against the same quote, but using different document templates for each document. Our customer needs multiple templates against the quote, for things such as Works Order Sheet, Picking Form etc., and the "GetOrderConfirmation" function works really well, as it allows you to save in SuperOffice multiple "Order Confirmation" documents, using different "Order Confirmation" templates against the same quote.  Below is a screenshot of the script, that runs from the Sale Task menu. The trouble is, that it does not seem to respect the user's Number and Date format when producing the document. Below is a screenshot of part of an order confirmation document produced when raising the document in the normal manner (at the point of placing the order, which can only be done against one of the document templates for any given quote).  The date correctly shows in the UK date format, as per the customer's number and date format. When I produce the same document via a CRM Script, using the following code. NSQuoteAgent quoteAgent; String quoteDoc = quoteAgent.GetOrderConfirmation(quoteVersionId, confirmationTemplateId); This is the document it produces, with the user's number and date format being ignored. As the script runs from the Sale Task menu, I expected the script to run in the context of the user, and therefore use the user's number and date format settings, but this seems not to be the case. Am I missing something in my code, or is this a bug with the function in SuperOffice? Many thanks, Trevor
Trevor Sharp
2
7
14. jul. 2026 | 08:54 a.m.
Emne:
Service and CRMScript Discussion

Siste svar

Great, thanks David, that's really good to know.
by Trevor Sharp
15. jul. 2026 | 04:50 p.m.
done
Answered
push_pin lock

Incoming or outgoing ?

Hi, how can I detect  if an email is outgoing or incoming ?   Rest-API, mirror database query, whatevet method is fine.  

IT

Inge Simon Thorbjørnsen
1
0
14. jul. 2026 | 02:14 p.m.
Emne:
Client libraries and tools
done
Answered
push_pin lock

How do I all tickets via Archive agent?

I try to get tickets, using this NSArchiveAgent agent; NSArchiveListItem[] result = agent.GetArchiveListByColumns2 ("FindTicket", "ticketId,title,status,person/personId", "", "ticketId>'0'", "ticket", 0, 200); printLine ("Row count: " + result.length().toString()); foreach (NSArchiveListItem i in result) { Map col = i.GetColumnData(); col.first(); while (!col.eof()) { print(col.getKey() + ": " + col.getVal() +" - "); col.next(); } }   But it only seem to return open tickets. Why is that - what am I missing?  
Morten Larsen
1
2
13. jul. 2026 | 10:57 a.m.
Emne:
Service and CRMScript Discussion

Siste svar

wow easy! Thanks
by Morten Larsen
13. jul. 2026 | 11:09 a.m.
done
Answered
push_pin lock

Send email from a CRMScript

Simply put, I want to send an email when certain criteria are meet, but I can't find any documentation about the subject. I found a forum post with the class name NSEmailAgent, but it does not exist? Maybe it used to exist? It should of cause be from within SuperOffice, and be shown in the archives, and not some mail-chimp Rest call. Regards Martin
Martin Andersen
2
2
9. jul. 2026 | 10:19 a.m.
Emne:
Service and CRMScript Discussion

Siste svar

Thank you.
by Martin Andersen
9. jul. 2026 | 10:32 a.m.
done
Answered
push_pin lock

NTLM as authenticationMethod removed?

Hi, we have an Online customer who has been using CRMScript to get data from a webservice which is protected by NTLM auth. Somewhere around the time they were upgraded to version 12 all calls from CRMScript using NTLM started to fail. It seems to use basic auth even though authenticationMethod is set to ntlm. Example code: HTTP http; http.setOption("authenticationMethod", "ntlm"); http.setOption("username", "foo"); http.setOption("password", "bar"); http.get("https://testing.requestcatcher.com"); On an older onprem solution I see that setting http.setOption("authenticationMethod", "ntlm") causes the Authorization header to be "Authorization: NTLM ****", but in Online v12 the Authorization header is set to "Authorization: Basic *****". Has NTLM support been removed from version 12? It is still mentioned in the documentation: https://docs.superoffice.com/en/automation/crmscript/reference/CRMScript.Native.HTTP.html
Frode Lillerud
3
3
2. jul. 2026 | 06:56 a.m.
Emne:
Service and CRMScript Discussion

Siste svar

Hello,  We have located the issue and it will be hotfixed in our upcoming release.  Thank you for bringing it to our attention! :)  //Eivind
by Eivind Fasting
8. jul. 2026 | 12:12 p.m.
done
Answered
push_pin lock

Calling CRMscript as webservice from the outside world (Umbraco) but with data in the body as json

I saw this https://community.superoffice.com/en/technical/blogs/archive/building-custom-rest-api-methods-using-crmscript/?epslanguage=en And it works out of the box you could say. But I need a big chunk of data in the body of the request, can I do that?
Martin Andersen
2
1
1. jul. 2026 | 12:12 p.m.
Emne:
Service and CRMScript Discussion

Siste svar

That was fast, I could not even eat a ice before you answered. Thank you.
by Martin Andersen
1. jul. 2026 | 12:25 p.m.
done
Answered
push_pin lock

ERP Sync list mappings: should SuperOffice send the mapped ERP list value to the connector?

Hi there - i need clarification on ERP Sync list mappings, specifically for list fields such as Country. I made a custom Business Central ERP connector exposing country list items from BC through WSGetList. Example ERP country   codes include:   - UK = United Kingdom   - NL = Netherlands   - CZ = Czechia   In SuperOffice ERP admin, we map the ERP list item UK to the SuperOffice country item “Storbritannien” / Great   Britain.   Our expectation was that when SuperOffice later calls the ERP connector, it would send the mapped ERP list key, i.e.   UK.   However, in our connector logs we see SuperOffice sending SuperOffice/internal country values instead:   During advanced search:   {     "FieldKey": "COUNTRY",     "Operator": "oneof",     "ScalarValue": "GB",     "Values": ["GB"]   }   During create actor:   {     "a:Key": "COUNTRY",     "a:Value": "GBR"   }   Business Central rejects this because GBR does not exist in the BC Country/Region table. The valid ERP value is UK.   So the question is:   When a list field is mapped in ERP Sync admin, should SuperOffice apply that mapping before calling connector methods   like WSCreateActor, WSSaveActors, and WSSearchActorsAdvanced?   Or are list mappings only used when importing/displaying ERP values in SuperOffice, meaning the connector must itself   translate SuperOffice values like GB/GBR back to ERP keys like UK (for example by receiving the mapping from netserver)?   Related questions:   1. Does the ERP connector SOAP contract ever receive the saved list mappings?   2. Is IErpSyncAgent.GetConnectionListMappings the right function to call IF i have to go and fetch the mapping manually, which honestly feels really stupid?   3. For CRM -> ERP flows, is the connector expected to receive CRM list values or ERP list values?   4. Is search different from save/create in this regard?   I have added connector-side aliases as a workaround, but I need to understand the intended contract. If the ERP admin   maps ERP UK to SuperOffice “Great Britain”, it seems logical that CRM -> ERP calls should send UK, not GB or GBR.   Can anyone confirm the expected behavior, before i end up ripping all my hair out? :)
Dennis Aagaard Mortensgaard
2
2
25. jun. 2026 | 09:43 a.m.
Emne:
Online development and web service API's

Siste svar

Hi Dennis,  I think SuperOffice is supposed to translate list values to ERP keys before calling WSCreateActor, WSSaveActors and WSSearchActorsAdvanced. That said it looks like WSSearchActorsAdvanced do not follow the same translation layer so we would have to investigate/debug this to figure out if its a bug or by design. It would be interesting to see what is stored in the `ERPLISTITEMEMAPPING` in your database and verify the CrmItemKey value match the actuall integer IDs from the SuperOffice country table. If that row is missing or has a wrong ErpFieldId the code falls back to the raw internal value which could be GBR in your case (?) Do you have access to the database directly?  I suggest you send send an email to appdev@superoffice.com so we can investigate //Eivind
by Eivind Fasting
30. jun. 2026 | 08:02 a.m.
done
Answered
push_pin lock

What does the "Enable batch webhook in Service" option do in a custom object

Hi, I have added a custom object, and I wanted web hooks to fire on this custom object when a record is edited, even if records are updated using the SuperOffice Bulk Update routine.  I assumed that I would need the "Enable batch webhook in Service" option ticked to allow this, but it seems that my web hook runs when using SuperOffice Bulk Update to update these records, without this option being ticked. With this in mind, what does ticking this option actually do? Many thanks, Trevor
Trevor Sharp
2
2
25. jun. 2026 | 10:13 a.m.
Emne:
Service and CRMScript Discussion

Siste svar

Hi David, That is perfect, thank you for clarifying this, I probably will not need to enable this for this site (as I don't want to create any unnecessary performance hits), and this customer does not have access to the old service module, and we are not updating the records via a CRMScript. Thanks again for your help on this. Trevor
by Trevor Sharp
25. jun. 2026 | 10:27 a.m.