Application Programming Interface forums

0 Abonnenter

3 Emner

4934 Samtaler

Area for questions and answers about SuperOffice API's.

All conversations (4934)

push_pin lock

CRMScript HTTP call to Azure Function returns empty response (works in Postman and C#)

Hi everyone, I'm currently trying to make a GET request from CRMScript to an Azure Function endpoint ( *.azurewebsites.net ). The call works perfectly when I test it using Postman and with a simple C# console app. However, when I try it using CRMScript , the response is empty . What I'm doing The function expects a requestid to be sent in the body. Headers include  Accept: application/json and a x-functions-key . I've tried both GET and POST methods in CRMScript. JSONBuilder payload; payload.pushObject(""); payload.addString("requestid", "example-request-id-1234"); //I get the requestid from the first function which also is a request to azurewebsites. payload.popLevel(); printLine(payload.getString()); HTTP httpClient; httpClient.addHeader("Accept", "application/json"); httpClient.addHeader("Content-Type", "application/json; charset=utf-8"); httpClient.addHeader("x-functions-key", "example-functions-key"); httpClient.setOption("parameters", "?" + payload.getString()); String response = String(httpClient.post("https://example-function.azurewebsites.net/api/MyFunctionEndpoint")); printLine("Response: " + response); But response is always empty. 🔹 How it works correctly in C# (for comparison) Here’s a minimal C# example that works correctly: static async Task Main(string[] args) { var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://example-function.azurewebsites.net/api/MyFunctionEndpoint"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("x-functions-key", "example-functions-key"); var content = new StringContent("{ \"requestid\": \"example-request-id-1234\" }", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); }   What am I doing wrong here ? Just to add little preface. I'm trying first to trigger an azure job with crmscript, this works fine and then i use the request id from the response in trigging the azure job to check the status which for some odd reason does not work.
Ummair Tahir
6
10
29. apr. 2025 | 02.22 PM
Emne:
Service and CRMScript Discussion

Seneste svar

You're a legend, @Frode? 💎 The workaround actually did the trick! 🙌 I've also asked the dev to include requestId in the URL instead of the body so we can make it "work the proper way".
by Ummair Tahir
30. apr. 2025 | 09.47 AM
push_pin lock

Trigger on Service: New message on request and messge.getAttachments() is empty

Hey, We're trying to get the attachements for a message on this trigger, but Message.getAttachments() is empty when called. If we manually set an old messageId, we do get the attachements. It's almost like the trigger fires before the attachments are stored. Any clever work arounds here? I tried to get the trigger script to sleep. Or do a while loop and wait until the Integer array is filled with something. But seems like it never does.  I hit execution timeout before the array has any entries. So maybe this is some job that is done after the trigger i run? Best Regards Bjørn

BK

Bjørn Karlsen
0
1
28. apr. 2025 | 02.18 PM
Emne:
Service and CRMScript Discussion

Seneste svar

Hi Bjørn,  I agree with you, it seems like the trigger is fired after the message is created, but before the attachments rows are added to the ticket_attachment table. You should report it to bug@superoffice.com.
by Frode Lillerud
30. apr. 2025 | 09.09 AM
push_pin lock

SuperOffice.SystemUser.Client v1.2 ignores proxy on authentication

Hi There seems to be a bug in the latest version of nuget SuperOffice.SystemUser.Client where the HttpClient provided is not used when authenticating. This results in not using proxy settings and therefore authentication fails when behind proxy. I'm guessing it is this change that causes it Snorre  

SG

Snorre Garmann
2
1
11. apr. 2025 | 07.49 AM
Emne:
Client libraries and tools

Seneste svar

Hello Snorre,  Thank you for reporting this.  This issue belongs on github , so please create an issue there and I will look into it :) /Eivind
by Eivind Fasting
28. apr. 2025 | 07.10 AM
push_pin lock

Best way to create a new address format in Online

Hi there, i have a customer who'd like a custom address format. In order to do this on-premise i would just copy a layout that already exists, and change the variables i need. Therefore i constructed the following CRM-Script that should copy the 4 other lines, and add them to the addressformat table, with my changed values:   #setLanguageLevel 4; SearchEngine se; se.addField('AddressFormat.addressformat_id'); se.addField('AddressFormat.name'); se.addField('AddressFormat.layout_id'); se.addField('AddressFormat.atype_idx'); se.addField('AddressFormat.address1_line'); se.addField('AddressFormat.address1_subpos'); se.addField('AddressFormat.address1_leadtext'); se.addField('AddressFormat.address1_zip'); se.addField('AddressFormat.address1_length'); se.addField('AddressFormat.address1_flags'); se.addField('AddressFormat.address1_mask'); se.addField('AddressFormat.address2_line'); se.addField('AddressFormat.address2_subpos'); se.addField('AddressFormat.address2_leadtext'); se.addField('AddressFormat.address2_zip'); se.addField('AddressFormat.address2_length'); se.addField('AddressFormat.address2_flags'); se.addField('AddressFormat.address2_mask'); se.addField('AddressFormat.address3_line'); se.addField('AddressFormat.address3_subpos'); se.addField('AddressFormat.address3_leadtext'); se.addField('AddressFormat.address3_zip'); se.addField('AddressFormat.address3_length'); se.addField('AddressFormat.address3_flags'); se.addField('AddressFormat.address3_mask'); se.addField('AddressFormat.city_line'); se.addField('AddressFormat.city_subpos'); se.addField('AddressFormat.city_leadtext'); se.addField('AddressFormat.city_zip'); se.addField('AddressFormat.city_length'); se.addField('AddressFormat.city_flags'); se.addField('AddressFormat.city_mask'); se.addField('AddressFormat.county_line'); se.addField('AddressFormat.county_subpos'); se.addField('AddressFormat.county_leadtext'); se.addField('AddressFormat.county_zip'); se.addField('AddressFormat.county_length'); se.addField('AddressFormat.county_flags'); se.addField('AddressFormat.county_mask'); se.addField('AddressFormat.state_line'); se.addField('AddressFormat.state_subpos'); se.addField('AddressFormat.state_leadtext'); se.addField('AddressFormat.state_zip'); se.addField('AddressFormat.state_length'); se.addField('AddressFormat.state_flags'); se.addField('AddressFormat.state_mask'); se.addField('AddressFormat.zip_line'); se.addField('AddressFormat.zip_subpos'); se.addField('AddressFormat.zip_leadtext'); se.addField('AddressFormat.zip_zip'); se.addField('AddressFormat.zip_length'); se.addField('AddressFormat.zip_flags'); se.addField('AddressFormat.zip_mask'); se.addField('AddressFormat.extraFlags'); se.addField('AddressFormat.labelLayout'); se.addField('AddressFormat.registered'); se.addField('AddressFormat.registered_associate_id'); se.addField('AddressFormat.updated'); se.addField('AddressFormat.updated_associate_id'); se.addField('AddressFormat.updatedCount'); se.addField('AddressFormat.labelLayout2'); se.addField('AddressFormat.isBuiltIn'); se.addCriteria('AddressFormat.addressformat_id', 'In', '211,212,213,214'); //print(se.executeHTMLTable()); SearchEngine sequence; sequence.addField('sequence.id'); sequence.addField('sequence.next_id'); sequence.addField('sequence.TableName'); sequence.addField('sequence.TableNumber'); sequence.addCriteria('sequence.id', 'In', '67'); sequence.execute(); Integer next = sequence.getField('sequence.next_id').toInteger(); //Copy the rows from the search engine to 4 new rows, named "Other - 2 address lines" for(se.execute(); !se.eof(); se.next()){ SearchEngine insert; insert.addData('AddressFormat.addressformat_id', next.toString()); insert.addData('AddressFormat.name', 'Other - 2 address lines'); insert.addData('AddressFormat.layout_id', se.getField('AddressFormat.layout_id')); insert.addData('AddressFormat.atype_idx', se.getField('AddressFormat.atype_idx')); insert.addData('AddressFormat.address1_line', se.getField('AddressFormat.address1_line')); insert.addData('AddressFormat.address1_subpos', se.getField('AddressFormat.address1_subpos')); insert.addData('AddressFormat.address1_leadtext', se.getField('AddressFormat.address1_leadtext')); insert.addData('AddressFormat.address1_zip', se.getField('AddressFormat.address1_zip')); insert.addData('AddressFormat.address1_length', se.getField('AddressFormat.address1_length')); insert.addData('AddressFormat.address1_flags', se.getField('AddressFormat.address1_flags')); insert.addData('AddressFormat.address1_mask', se.getField('AddressFormat.address1_mask')); insert.addData('AddressFormat.address2_line', se.getField('AddressFormat.address2_line')); insert.addData('AddressFormat.address2_subpos', se.getField('AddressFormat.address2_subpos')); insert.addData('AddressFormat.address2_leadtext', se.getField('AddressFormat.address2_leadtext')); insert.addData('AddressFormat.address2_zip', se.getField('AddressFormat.address2_zip')); insert.addData('AddressFormat.address2_length', se.getField('AddressFormat.address2_length')); insert.addData('AddressFormat.address2_flags', se.getField('AddressFormat.address2_flags')); insert.addData('AddressFormat.address2_mask', se.getField('AddressFormat.address2_mask')); insert.addData('AddressFormat.address3_line', '0'); insert.addData('AddressFormat.address3_subpos', '0'); insert.addData('AddressFormat.address3_leadtext', '0'); insert.addData('AddressFormat.address3_zip', se.getField('AddressFormat.address3_zip')); insert.addData('AddressFormat.address3_length', '0'); insert.addData('AddressFormat.address3_flags', se.getField('AddressFormat.address3_flags')); insert.addData('AddressFormat.address3_mask', se.getField('AddressFormat.address3_mask')); insert.addData('AddressFormat.city_line', '3'); insert.addData('AddressFormat.city_subpos', se.getField('AddressFormat.city_subpos')); insert.addData('AddressFormat.city_leadtext', se.getField('AddressFormat.city_leadtext')); insert.addData('AddressFormat.city_zip', se.getField('AddressFormat.city_zip')); insert.addData('AddressFormat.city_length', se.getField('AddressFormat.city_length')); insert.addData('AddressFormat.city_flags', se.getField('AddressFormat.city_flags')); insert.addData('AddressFormat.city_mask', se.getField('AddressFormat.city_mask')); insert.addData('AddressFormat.county_line', se.getField('AddressFormat.county_line')); insert.addData('AddressFormat.county_subpos', se.getField('AddressFormat.county_subpos')); insert.addData('AddressFormat.county_leadtext', se.getField('AddressFormat.county_leadtext')); insert.addData('AddressFormat.county_zip', se.getField('AddressFormat.county_zip')); insert.addData('AddressFormat.county_length', se.getField('AddressFormat.county_length')); insert.addData('AddressFormat.county_flags', se.getField('AddressFormat.county_flags')); insert.addData('AddressFormat.county_mask', se.getField('AddressFormat.county_mask')); insert.addData('AddressFormat.state_line', se.getField('AddressFormat.state_line')); insert.addData('AddressFormat.state_subpos', se.getField('AddressFormat.state_subpos')); insert.addData('AddressFormat.state_leadtext', se.getField('AddressFormat.state_leadtext')); insert.addData('AddressFormat.state_zip', se.getField('AddressFormat.state_zip')); insert.addData('AddressFormat.state_length', se.getField('AddressFormat.state_length')); insert.addData('AddressFormat.state_flags', se.getField('AddressFormat.state_flags')); insert.addData('AddressFormat.state_mask', se.getField('AddressFormat.state_mask')); insert.addData('AddressFormat.zip_line', '3'); insert.addData('AddressFormat.zip_subpos', se.getField('AddressFormat.zip_subpos')); insert.addData('AddressFormat.zip_leadtext', se.getField('AddressFormat.zip_leadtext')); insert.addData('AddressFormat.zip_zip', se.getField('AddressFormat.zip_zip')); insert.addData('AddressFormat.zip_length', se.getField('AddressFormat.zip_length')); insert.addData('AddressFormat.zip_flags', se.getField('AddressFormat.zip_flags')); insert.addData('AddressFormat.zip_mask', se.getField('AddressFormat.zip_mask')); insert.addData('AddressFormat.extraFlags', se.getField('AddressFormat.extraFlags')); insert.addData('AddressFormat.labelLayout', se.getField('AddressFormat.labelLayout')); insert.addData('AddressFormat.registered', se.getField('AddressFormat.registered')); insert.addData('AddressFormat.registered_associate_id', se.getField('AddressFormat.registered_associate_id')); insert.addData('AddressFormat.updated', se.getField('AddressFormat.updated')); insert.addData('AddressFormat.updated_associate_id', se.getField('AddressFormat.updated_associate_id')); insert.addData('AddressFormat.updatedCount', se.getField('AddressFormat.updatedCount')); insert.addData('AddressFormat.labelLayout2', se.getField('AddressFormat.labelLayout2')); insert.addData('AddressFormat.isBuiltIn', 'false'); insert.insert(); next = next + 1; } //Update sequence with the new next_id sequence.addData('sequence.next_id', next.toString()); sequence.addCriteria('sequence.id', 'In', '67'); sequence.update();   This Does not work however. I'm getting the following error, that does not really provide me with any help:   So do i really have to send a SQL command to support for them to execute, or what is best practise for me to create a custom address format with the tools available?   Thanks!  
Dennis Aagaard Mortensgaard
3
8
21. mar. 2025 | 12.29 PM
Emne:
Service and CRMScript Discussion

Seneste svar

Well if you update something using the SearchEngine you are bypassing all business logic, so it is not strange that the cache is not updated in that case. It should be updated when you do it through the API/List agent.  If you call DiagnosticsAgent.FlushCaches() after updating and before retrieving, do you the get the correct id's back? so: #setLanguageLevel 4; Integer countryId = 827; Integer customAddressFormatId = 17; NSListAgent listAgent; NSDiagnosticsAgent diagnosticsAgent; NSCountry customCountry = listAgent.GetCountry(countryId); customCountry.SetAddressLayoutId(customAddressFormatId ); customCountry.SetForeignAddressLayoutId(customAddressFormatId ); customCountry.SetDomesticAddressLayoutId(customAddressFormatId ); customCountry = listAgent.SaveCountry(customCountry); diagnosticsAgent.FlushCaches(); customCountry = listAgent.GetCountry(countryId); printLine(customCountry.GetAddressLayoutId().toString()); printLine(customCountry.GetForeignAddressLayoutId().toString()); printLine(customCountry.GetDomesticAddressLayoutId().toString());
by David Hollegien
16. apr. 2025 | 12.04 PM
push_pin lock

Get data from custom object selections via crmscript

I have tried to fetch the data from a custom object selection (dynamic) with these functions but they don´t give me the result i was looking for.  The function GetSelectionMembersArchiveRows on the NSSelectionAgent does only return the selectionId in its columndata when i loop the rows. I also tried to fetch the restrictions from the function GetDynamicSelectionCriteria which crashes because there is no registered plugin for that specific archive. (In this case (ExtraTable databaseField + DynamicSelection)) Are there any other functions / ways to retrieve data from a custom object selection(Dynamic) via crmscript?

FL

Fredrik Larsson
3
7
11. apr. 2025 | 06.24 AM
Emne:
Service and CRMScript Discussion

Seneste svar

Hi Fredrik, The best ways to work with dynamic selections, and to use the Search API's in general, is to understand how the Find and Selection APIs actually work. This applies to both RESTful and CRMScript APIs.  Spending 30 minutes reading the Search API section will save you months in head-scratching.  Hope this helps!
by Tony Yates
14. apr. 2025 | 08.08 AM
push_pin lock

How can we fetch the users local settings language

Hi, As the topic states, how can we fetch the user license using the Netserver? The closest we have actually found is the homecountry from SoContext.CurrentPrincipal, but, that does not really work :) Do we have to use the findagent and fetch the language from userprefference table or something?
Pär Pettersson
2
2
11. apr. 2025 | 07.49 AM
Emne:
Online development and web service API's

Seneste svar

Wow, thanks alot man! Really appreciate it
by Pär Pettersson
11. apr. 2025 | 08.01 AM
push_pin lock

Rest API: Filter Ticket by status

Hi, I want list tickets which are Active. - using "status" give zero or all tickets. - using "BaseStatus" give zero tickets. I'm tring various oprators: eq, contains, etc

SK

Sebastian Kaczmarkiewicz
1
1
2. apr. 2025 | 01.44 PM
Emne:
Online development and web service API's

Seneste svar

Solved

SK

by Sebastian Kaczmarkiewicz
9. apr. 2025 | 10.34 AM
push_pin lock

Setting Quote Version Custom Address through API

Hi community. I'm trying to set custom delivery address in SuperOffice using scripts, and I can't get it to work 100%. It seems like there is a bug, such that this cannot be set using crmscript, so I'm trying to do it using the Agent API. For some reason only Address1 and Address2 can be set, but not Zipcode and City, and I can't figure out why. Look at the following two code-snippets. The first one, is the one I set using contactAgent/SaveQuoteVersionAddressAsync, and the second is from the network-tab using normal Quote in SuperOffice directly. What am I doing wrong? Object I send with the contactAgent/SaveQuoteVersionAddressAsync request: { "quoteVersionId": 52061, "address": { "tableRight": null, "fieldProperties": {}, "wgs84Latitude": 0, "wgs84Longitude": 0, "localizedAddress": [ [ { "tableRight": null, "fieldProperties": {}, "name": "Address1", "value": "Adresse 1", "tooltip": "", "label": "SR_AL_ADDRESS1", "valueLength": 80, "addressType": "PersonPrivateAddress" } ], [ { "tableRight": null, "fieldProperties": {}, "name": "Address2", "value": "Adresse 2", "tooltip": "", "label": "SR_AL_ADDRESS2", "valueLength": 80, "addressType": "PersonPrivateAddress" } ], [ { "tableRight": null, "fieldProperties": {}, "name": "Zipcode", "value": "6000", "tooltip": "", "label": "SR_AL_POSTCODECITY", "valueLength": 12, "addressType": "PersonPrivateAddress" }, { "tableRight": null, "fieldProperties": {}, "name": "City", "value": "Kolding", "tooltip": "", "label": "", "valueLength": 80, "addressType": "PersonPrivateAddress" } ] ], "street": { "atypeIdx": "QuoteShippingAddress", "address1": "", "address2": "", "address3": "", "city": "", "county": "", "state": "", "zipcode": "", "formatted": "" }, "postal": null, "formatted": null }, "addressType": "QuoteShippingAddress", "countryId": 208 } Object I've fetched from dev-tools: { "QuoteVersionId": 52061, "Address": { "TableRight": null, "FieldProperties": {}, "Wgs84Latitude": 0, "Wgs84Longitude": 0, "LocalizedAddress": [ [ { "TableRight": null, "FieldProperties": {}, "Name": "Address1", "Value": "Adresse 11", "Tooltip": "", "Label": "SR_AL_ADDRESS1", "ValueLength": 80, "AddressType": "PersonPrivateAddress" } ], [ { "TableRight": null, "FieldProperties": {}, "Name": "Address2", "Value": "Adresse 22", "Tooltip": "", "Label": "SR_AL_ADDRESS2", "ValueLength": 80, "AddressType": "PersonPrivateAddress" } ], [ { "TableRight": null, "FieldProperties": {}, "Name": "Zipcode", "Value": "6000", "Tooltip": "", "Label": "SR_AL_POSTCODECITY", "ValueLength": 12, "AddressType": "PersonPrivateAddress" }, { "TableRight": null, "FieldProperties": {}, "Name": "City", "Value": "Kolding", "Tooltip": "", "Label": "", "ValueLength": 80, "AddressType": "PersonPrivateAddress" } ] ], "Street": { "AtypeIdx": "QuoteShippingAddress", "Address1": "Adresse 1", "Address2": "Adresse 2", "Address3": "", "City": "Kolding", "County": "", "State": "", "Zipcode": "6000", "Formatted": "Adresse 1\nAdresse 2\n60000 Kolding\n" }, "Postal": null, "Formatted": null }, "AddressType": "QuoteShippingAddress", "CountryId": 208 }       dfd

KR

Kasper Rosenlund
2
1
8. apr. 2025 | 08.00 AM
Emne:
Online development and web service API's

Seneste svar

Hi Kasper, Try only posting the required fields instead of setting LocalizedAddress/street/post/formatted. If you want to set the QuoteShippingAddress, only set the Street portion, if you want to set the QuoteBillingAddress, only set the Postal portion. Do note that this should work in CRMScript, see this thread for a code sample: https://community.superoffice.com/en/technical/forums/api-forums/service-crmscript/set-userdefined-delivery-address-from-quote-by-scripts/
by David Hollegien
8. apr. 2025 | 03.39 PM
push_pin lock

Open a link in another tab

Hi all   we are looking for a way to open a link in another tab.  Vi can easily change to the correct tab by calling     SuperOffice.ClientCrossMessaging.executeSoProtocol("project."+tab+"?project_id="+id);    but we can't find a way to specify the URL to open. I fairly sure this was possible in the windows version.

IT

Inge Simon Thorbjørnsen
2
3
3. apr. 2025 | 01.37 PM
Emne:
Online development and web service API's

Seneste svar

Hi Inge!  OK, so soprotocol is used as a means to perform navigation in SuperOffice. It does not support passing extra parameters other than known currents, i.e. contact_id=2, project_id=2, etc.  The last example provided targets a web panel with extra unknown parameters. As you know, but for those who do not, a web panel is an pre/defined iFrame in the Web Panel list, with a PRE_DEFINED URL and query string parameters. We support template variables as values for those known template variables, which also generally map to known currents.  What you are seeking is something other than the built-in / supported mechanisms. Perhaps a feature wish? One way you could perform such a mechanism is to use the API to change the web panel URL, and then issue the soprotocol to simply "contact.gadgettab" and it would navigate to where you set in the previous update. Of course, this is global and would affect ALL users.  Alternatively, you could use known template variables and pass that into the sprotocol string, which should then be respected by the web panel definition and populated and sent to your pre-defined url accordingly. There are other mechanisms, such as Foreign Keys, that you could use associate with said project_id and link it up before the invocation and handle it in the destination page accordingly. Best regards.  
by Tony Yates
4. apr. 2025 | 11.48 AM
push_pin lock

WebAPI 10: error on QuoteAgent SaveQuoteLineImageAsync function

Hello everyone, In our custom app, we are supposed to replace product images for products in the quote. We first search the quote lines And after that we replace the image for each line using the function SaveQuoteLineImageAsync. Unfortunately, we get a "Not Implemented" error on this call: We have tried WebAPI in versions 10.2 and 10.5, with the same result. This customer is using one of our quote connectors.  We have searched, but could not find the proper method for overwriting. Does the error have to do with the Quote connector or is the method really not yet implemented in Rest API? Thank you in advance! Best regards, Andrey

AS

Andrey Stupak
1
10
1. apr. 2025 | 10.57 AM
Emne:
Online development and web service API's

Seneste svar

https://community.superoffice.com/en/product-releases/bugs-wishes/product-issue/?bid=74847&azure=1
by Georg Diczig
3. apr. 2025 | 03.05 PM