Application Programming Interface forums

0 Abonnenter

3 Emner

4959 Samtaler

Area for questions and answers about SuperOffice API's.

All conversations (4959)

push_pin lock

getting the personid of the current contact

Is there a better way to get the personId of the current contact than using getCgiVariable("personId")? Lately this has become unstable and often returns the personId of a previously viewed user. The following script is run when a user clicks a button on either a contact card or a ticket/request. So what I need in the end is the x_personid, which is a custom field on person. #setLanguageLevel 4; Integer personId = getCgiVariable("personId").toInteger(); if (personId.isNull() == true || personId < 1) { setVariable("url", getProgramBlogic() + "&action=doScript&includeId=close"); } String externalPersonId; SearchEngine se; se.addField("person.x_personid"); se.addCriteria("person.person_id", "Equals", personId.toString()); if(se.select() > 0) externalPersonId = se.getField(0); if(externalPersonId.toInteger()>0) setVariable("url", "https://bn.app.local/Customer/Link/" + externalPersonId); else setVariable("url", getProgramBlogic() + "&action=doScript&includeId=close");

SG

Snorre Garmann
3
4
12. sep. 2025 | 06.19 AM
Emne:
Service and CRMScript Discussion

Seneste svar

Hi Snorre, You said "getCgiVariable("personId") is definately unstable on the latest cloud version of crm. After about 30-45 min it starts returning the personid of a previously opened customer. There is some kind of strange caching going on here." There could possibly an issue with getCgiVariable, but I'm not convinced. We need to know more details to be able to reproduce it. The original SearchEngine query seems correct, to get the x_personid value, it's just that you are experiencing an incorrect personId coming out of the getCgiVariable method I'm assuming if we use your script we should be able to do just that after said period of time. Is that correct? You think it's a time issue, and nothing else, e.g. after a certain number of button clicks? Integer personId = getCgiVariable("personId").toInteger(); if (personId.isNull() == true || personId < 1) { setVariable("url", getProgramBlogic() + "&action=doScript&includeId=close"); } String externalPersonId; SearchEngine se; se.addField("person.x_personid"); se.addCriteria("person.person_id", "Equals", personId.toString()); if(se.select() > 0) externalPersonId = se.getField(0); if(externalPersonId.toInteger()>0) setVariable("url", "https://localhost:8080/person/" + externalPersonId); else setVariable("url", getProgramBlogic() + "&action=doScript&includeId=close"); //NOT 100% SURE WHAT CLOSE DOES, but seems intuitive enough.  
by Tony Yates
2 t, 15 m siden | 02.23 PM
push_pin lock

Intended use of the new 'load request' and 'load request message' CRMScript triggers

Hi, We have been hitting some issues/road blocks with migrating customers to the new service solution, where the customization possibilties are much more restricted. One of the issues we have been hitting a lot is being unable to automatically fill in fields (either custom or default), in the 'old service' we could do this with url variables. In New Service this has not been possible (so protocol does not work). Now with these new triggers we where hoping we could solve these challenges (and migrate more of our customers to new service), but sadly with the first 2 scenario's we tried it, immediately hit an issue: #1 Setting a custom field value based on soprotocol, immediately hit a bug that getNavigateTo () does not work in triggers, preventing us from getting the SOProtocol being navigated to (if it works like that) #2 Just tried to set the ticket priority based on the linked person contact ticket priority, but setting 'TicketEntity.Priority.TicketPriorityId' with setOutputValue doesn't do anything. What is the intended use cases of this triggers here, should setting values with setOutputValue work? The documentation of these triggers is not made yet (# 2185 ), so we are not sure if we are looking at bugs here or if this is not the intended use case.
David Hollegien
2
1
22 t, 51 m siden | 05.47 PM
Emne:
Service and CRMScript Discussion

Seneste svar

Ah, so the GUI is not updated. That sounds like a bug :)
by David Hollegien
9 t, 1 m siden | 07.38 AM
push_pin lock

Error running a script from the Task Menu

Hi All, I am not sure if this is support or SuperOffice communiuty, but I have a site that cannot run CRM Scripts via the task menu button. Currently the script just has the following code. #setLanguageLevel 4; EventData ev = getEventData(); log(ev.getInputValues().toJson()); String test = "1"; If I run the code from the scripting section of the Admin client the script runs with no issues (I have a trace on this). However, if I link the script to a Task Menu button, when I run the option on the task menu I get the following errors. At the top of the page I get: Something went wrong with api/v1/Agents/CRMScript/ExecuteScriptAsEvent: [object Object] In a pop up dialog I get: Request failed with status code 403 Nothing gets recorded in the trace, so the script does not even get as far as running. Does anyone have any idea as to why I would get this issue? Many thanks, Trevor
Trevor Sharp
2
4
15. sep. 2025 | 03.19 PM
Emne:
Service and CRMScript Discussion

Seneste svar

Hi David, You're a genius !!! It was the SymmetricKey and Secret that did not match up.  Now I have corrected this, the script is running from the task menu. Thank you very much for your help with this. Trevor
by Trevor Sharp
23 t, 10 m siden | 05.29 PM
push_pin lock

Max size uploading document using the API. Error above 75 MB

When I upload docs > 75 MB I get "Maximum request length exceeded". I'm using:  savedDocument = await docAgent.SetDocumentStreamAsync(savedDocument, sreader.BaseStream, true);   Less then 75 MB is fine.  I thought 94.4 MB was max and the time for a file upload is 5 min. ( What is the maximum size of an attachment which can be uploaded in SuperOffice CRM? ) Is there a limit using the API? I'm testing against SOD.

FF

Frode Follerås
1
0
9. sep. 2025 | 11.54 AM
Emne:
Online development and web service API's
push_pin lock

Timeout 120 seconds

Hello! Is there any way to run a schedueled script for more than 120 seconds? It is not a very long time. Regards Martin
Martin Andersen
2
1
4. sep. 2025 | 01.49 PM
Emne:
Service and CRMScript Discussion

Seneste svar

OK, thank you!
by Martin Andersen
4. sep. 2025 | 01.54 PM
push_pin lock

Simple Automation? ( if [Member in Project] then set [Checkmark] )

Hello, I am new to SuperOffice scripting and unfortunately not a developer. I am hoping to get some guidance. I want to automate the activation/deactivation of a specific checkmark in a company’s details, based on whether a company (or an employee of a company) is part of a specific project. I also want to remove the checkmark if that is no longer the case. Is this possible to achieve with a script in SuperOffice? Could you point me to the necessary functions to do so? Thanks in advance. I tried to read the documentation myself, but that’s just beyond my skill set.

JB

Jörg Brüggemann
2
1
29. aug. 2025 | 02.22 PM
Emne:
Service and CRMScript Discussion

Seneste svar

Hi, I am afraid that this will be a bit tricky to implement without being a developer. Basically, you would probably like something called a "webhook" (a mechanism for triggering a script when something changes in the database) for the project and/or projectmember entity. This webhook should execute a CRMScript which will query the db and find all distinct companies that are related to the project (through persons who can be project members). Then it should query all companies that have the checkmark enabled, and finally perform a delta-operation (remove checkmark from companies that should no longer have it, and add checkmark to companies that should get it). Sverre
by Sverre Hjelm
3. sep. 2025 | 07.27 AM
push_pin lock

Questions migrating from COM to Hybrid/web model

Old situation: 10 years ago, I created a C# application (let's call it TheApp.exe) that is called from within Superoffice 8 (by using a GUI - Web panel button). Inside TheApp, the currently logged on Superoffice user is used to perform various tasks in Superoffice (via SuperOffice.COM.Application) Workflow for the end user: from within SuperOffice, the user clicks on the button. That opens TheApp.exe on his computer (no need for a separate login). His actions within TheApp are stored in the SuperOffice database (under his own username). Closing TheApp brings the user back to SuperOffice, where he sees the screen updated with the extra data that was filled in via TheApp. New situation: The client is moving towards Superoffice 10.5.4 running on IIS on-prem (the hybrid model?) My question: how do I adjust TheApp to the new situation, providing the same workflow to the end user? Problems I'm running into: 1) How to make the button in SuperOffice in the browser work to open TheApp.exe on his computer? 2) How to make sure the user does not have to login again from within TheApp? Instead, TheApp should be impersonating the user that was already logged in via the browser SuperOffice session (or alternatively: via Windows 11?) 3) Which protocol to use to communicate with SuperOffice from within TheApp? I see there is a Netserver route or a WebApi route. What I've tried: 1) Register a custom protocol on the end user's pc that forwards to TheApp.exe. Calling a url with that protocol when clicking on the Web panel button in SuperOffice. This sort of works, although every time the user clicks on the button, he receives a browser message that it is trying to open an external application. So not a clean solution yet 2) In the url, I was able to provide the <usec> parameter, which gives me a SOTicket in TheApp. 3) Here I'm a bit stuck which protocol to use. I tried using SuperOffice.CRM.Services and then in code do a SoSession.Authenticate(SOTicket); That gives me an error though. Also, I wonder how the assembly knows where SuperOffice is running so where to connect to exactly. I think I'm missing something there. So far it feels a little like failing forward. I'm not sure if any of the steps/solutions I've come up with are the way to go, or if there are better ways of solving my problems. Any help would be much appreciated.  

FC

Frank Cornegge
3
1
1. sep. 2025 | 08.25 AM
Emne:
Online development and web service API's

Seneste svar

Hi Frank! Migrating from SuperOffice v8.x to v10.x has some hurdles. NetServer uses dependency injection to configure database dependencies and logging. Navigating around the application is still supported using SoProtocol , albeit not as uniform as it was in the windows client. For onsite installations, we still support passing the usec credential as a template variable, but not in the online environment. So you should still be able to use it as before, just making the right changes for NetServer will make SoSession.Authenticate work as expected.  We have a GitHub repo that demonstrates these DI changes, but is geared more towards the online environment. I will add a onsite version today for you. We've also introduced the Screen Designer , for minor UI customizations.  More to follow in an email.  Best regards!  
by Tony Yates
1. sep. 2025 | 09.36 AM
push_pin lock

Detect merges - possibly via Webhook event?

Hi Everyone, I am trying to figure out whether I can get information out of SuperOffice API when for instance users merge a Person into another Person. Ideally, I would listen for merge events in the webhook, but that doesn't seem to be an option. Does anyone have any knowledge of this or alternative ideas as to how I might achieve this information?   Best Regards, Henrik
Henrik Povlsen
2
4
13. aug. 2025 | 12.31 PM
Emne:
Online development and web service API's

Seneste svar

Hi Henrik,   Try adding the table number, operation and options fields to the output, maybe that gives some hints to what behavior you are seeing.
by David Hollegien
18. aug. 2025 | 09.04 PM
push_pin lock

Problems getting data from extra table using REST

I don't get data from the "select" columns when I use "archive/dynamic". The URL I use is   "/archive/dynamic?select=y_produkter.x_hovedgruppe,y_produkter.x_produktnr&$filter=y_produkter.id eq 16" And the response is {"PrimaryKey":"16","EntityName":"y_produkter"} Can anyone see what I'm doing wrong? Is there another way of getting data from extra tables?

FF

Frode Follerås
2
1
18. aug. 2025 | 08.13 AM
Emne:
Online development and web service API's

Seneste svar

You are missing a dollar sign.  "/archive/dynamic? $ select=y_produkter.x_hovedgruppe,y_produkter.x_produktnr&$filter=y_produkter.id eq 16"
by David Hollegien
18. aug. 2025 | 08.30 AM
push_pin lock

Request Type CRM Script

Isn't it possible to get the Request type for my request in CRM Script? or is it to early days for request types? 😀  
Rune Elleskov
0
1
11. aug. 2025 | 12.28 PM
Emne:
Service and CRMScript Discussion

Seneste svar

Hi Simen Thanks :-)
by Rune Elleskov
12. aug. 2025 | 12.22 PM