Application Programming Interface forums

0 Prenumeranter

3 Ämnen

4919 Samtal

Area for questions and answers about SuperOffice API's.

All conversations (4919)

push_pin lock

Creating an extra table in code

Hi All, Is it possible to create, and modify the structure of a table in code using REST API's, for easy deployment of a cusom application. Many thanks, Trevor
Trevor Sharp
2
6
13 h, 24 m sedan | 04:53 em
Ämne:
Online development and web service API's

Senaste svar

That's brilliant David, thank you.  I'll take a proper look at this tomorrow, but it looks pretty good.  Thanks for your help on this.
by Trevor Sharp
12 h, 17 m sedan | 06:00 em
push_pin lock

Trigger double opt-in for newsletter subscriptions via API

  How can a double opt-in email be triggered via the SuperOffice API to confirm the newsletter registration? The background is that customers can register for the newsletter via an external form and subscribe to the newsletter there. When a customer registers for the newsletter, a new person is created via the SuperOffice API. How can I now also send a confirmation email to this person via the API to confirm their newsletter subscription? What options are there for this?    

RW

Ralf Weisser
2
6
12. feb. 2025 | 08:57 fm
Ämne:
Online development and web service API's

Senaste svar

### Request 1 ### ### Set default values into a new ConsentPerson. ###   POST /SuperOffice/api/v 1 /Agents/Person/CreateDefaultConsentPerson HTTP/ 1.1 Content-Type: application/json Accept: application/json   ### Response 1 ### {     "ConsentPersonId" : 0 ,     "ConsentSource" : {         "ConsentSourceId" : 0 ,         "Name" : "" ,          "Tooltip" : "" ,         "Rank" : 0 ,         "Key" : "" ,         "MailTemplateId" : 0 ,         "Deleted" : false ,         "TableRight" : null ,         "FieldProperties" : {}     },     "LegalBase" : {         "LegalBaseId" : 0 ,         "Name" : "" ,         "Tooltip" : "" ,         "Rank" : 0 ,         "Key" : "" ,         "Deleted" : false ,         "TableRight" : null ,         "FieldProperties" : {}     },     "PersonId" : 0 ,     "ConsentPurpose" : {         "ConsentPurposeId" : 0 ,         "Name" : "" ,         "ConsentText" : "" ,         "FormText" : "" ,         "Key" : "" ,         "Tooltip" : "" ,         "Active" : 0 ,         "UpdatedDate" : "0001-01-01T00:00:00" ,         "UpdatedBy" : null ,         "Deleted" : false ,         "Rank" : 0 ,         "PrivacyStatementDesc" : "" ,         "PrivacyStatementUrl" : "" ,         "TableRight" : null ,         "FieldProperties" : {}     },     "Comment" : "" ,     "TableRight" : null ,     "FieldProperties" : {} }   ### Request 2 ### ### Updates the existing ConsentPerson or creates a new ConsentPerson if the id parameter is empty  ###   POST /SuperOffice/api/v 1 /Agents/Person/SaveConsentPerson HTTP/ 1.1 Content-Type: application/json Accept: application/json   {     "ConsentPersonId" : 0 ,     "ConsentSource" : {         "ConsentSourceId" : 5     },     "LegalBase" : {         "LegalBaseId" : 1     },     "PersonId" : 30336,     "ConsentPurpose" : {         "ConsentPurposeId" : 2     },     "Comment" : "" ,     "TableRight" : null ,     "FieldProperties" : {} }   ### Response 2 ###   {     "ConsentPersonId" : 33455 ,     "ConsentSource" : {         "ConsentSourceId" : 5 ,         "Name" : null ,         "Tooltip" : null ,         "Rank" : 0 ,         "Key" : null ,         "MailTemplateId" : 0 ,         "Deleted" : false ,         "TableRight" : null ,         "FieldProperties" : {}     },     "LegalBase" : {         "LegalBaseId" : 1 ,         "Name" : null ,         "Tooltip" : null ,         "Rank" : 0 ,         "Key" : null ,         "Deleted" : false ,         "TableRight" : null ,         "FieldProperties" : {}     },     "PersonId" : 30336 ,     "ConsentPurpose" : {         "ConsentPurposeId" : 2 ,         "Name" : null ,         "ConsentText" : null ,         "FormText" : null ,         "Key" : null ,         "Tooltip" : null ,         "Active" : 0 ,         "UpdatedDate" : "0001-01-01T00:00:00" ,         "UpdatedBy" : null ,         "Deleted" : false ,         "Rank" : 0 ,         "PrivacyStatementDesc" : null ,         "PrivacyStatementUrl" : null ,         "TableRight" : null ,         "FieldProperties" : {}     },     "Comment" : "" ,     "TableRight" : null ,     "FieldProperties" : {} }   ### Request 3 ### ### Send confirmation email to the provided person, email address (id), using the document template. ###   POST /SuperOffice/api/v 1 /Agents/Person/SendConsentConfirmationEmail HTTP/ 1.1 Content-Type: application/json Accept: application/json   {   "PersonId" : 30336 ,   "EmailTemplateId" : 5 ,   "EmailAddress" : maxmustermann@test.net }   ### Response 3 ###   {     "Error" : true ,     "ErrorType" : "InvalidOperationException" ,     "Message" : "Cannot create directory \\\\***\\SO_ARC\\WebConnect\\2025.1 because a file already exists with that name." ,     "FriendlyMessage" : "" ,     "ErrorSource" : "SoDataBase" ,     "InnerError" : {         "ErrorType" : "SoException" ,         "Message" : "Service call Person.SendConsentConfirmationEmail failed" ,         "ErrorSource" : "SuperOffice.Services.Implementation" ,         "InnerError" : {             "ErrorType" : "Exception" ,             "Message" : "Error occurred at creating the physical document E-mail.somail" ,             "ErrorSource" : "SoDataBase" ,             "InnerError" : {                 "ErrorType" : "InvalidOperationException" ,                 "Message" : "Cannot create directory \\\\***\\SO_ARC\\WebConnect\\2025.1 because a file already exists with that name." ,                 "ErrorSource" : "SoDataBase" ,                 "InnerError" : null             }         }     } }

RW

by Ralf Weisser
3. mars 2025 | 05:19 em
push_pin lock

Empty eventdata in script running from form

Hi, I´m currently trying to run scripts when a SuperOffice form is submitted, (I´m using the Run CRMscript field on the form.) however when the script runs is the inputValues JSON empty and there are no values set.  The trigger "Service: New notification request from form submission" gets the correct values and the contact does get created. Do i need to do something in order for the script to receive the correct eventdata?  Regards Fredrik

FL

Fredrik Larsson
1
0
3. mars 2025 | 01:14 em
Ämne:
Service and CRMScript Discussion
push_pin lock

How do I copy CustomFields from one company to another?

Hello everyone.  I want to copy all custom fields from one company to another, but I'm having a hard time understanding how the behind the scenes-logic work. I'm looking for someone who can help me understand it :)   The following code doesn't copy anything. Why? #setLanguageLevel 4; NSContactAgent ca; Integer origId = 8590; Integer newId = 8603; NSContactEntity origComp = ca.GetContactEntity(origId); NSContactEntity newComp = ca.GetContactEntity(newId); Map origUdef = origComp.GetCustomFields(); newComp.SetCustomFields(origUdef); ca.SaveContactEntity(newComp);   Adding the following line updates 'SuperOffice:18', but only 'SuperOffice:18' Map origUdef = origComp.GetCustomFields(); origUdef.insert("SuperOffice:18", "261"); //THIS LINE newComp.SetCustomFields(origUdef); ca.SaveContactEntity(newComp); ..but not if I write it like this: Map origUdef = origComp.GetCustomFields(); origUdef.insert("SuperOffice:18", "[I:261]");   And here comes the kicker. If I alter the previous code-snippet to the following, suddently '[I:261]' works again. Map origUdef; origUdef.insert("SuperOffice:18", "[I:261]");   I tried something like this, but this doesn't work either: Map origUdef = origComp.GetCustomFields(); Map newUdef; for(origUdef.first(); !origUdef.eof(); origUdef.next()) { newUdef.insert(origUdef.getKey(), decodeDBValue(origUdef.getVal())); } newComp.SetCustomFields(origUdef); ca.SaveContactEntity(newComp);          

KR

Kasper Rosenlund
2
2
28. feb. 2025 | 09:46 fm
Ämne:
Service and CRMScript Discussion

Senaste svar

That seems to work. But I'm not still sure why my original code-snippet doesn't work.

KR

by Kasper Rosenlund
28. feb. 2025 | 10:23 fm
push_pin lock

Error 411 missing content-length when doing av http.Post

I get "HTTP Error 411. The request must be chunked or have a content length." when I do a post. It's working from Postman and JavaScript. But not from CRM-script. The header Content-Length is correct, but it seems that it does not "read" it.  Anyone? From debug log: => Send header POST /api/sale HTTP/1.1 Host: api.123.no Accept: */* Content-Type: application/json Authorization: xxxxxxxxxxxxxxxxxxxxxxxx Content-Length: 100 traceparent: 00-ed27b3cd060c4144a33c4a6f5e705d16-d6bbf292bd167881-01 => Send data {"OrderDate": "2024-09-06 13:53:13","OurRef": "Frode Folleras","CustomerNo": "12345", "Lines": [{}]} <= Recv header HTTP/1.1 411 Length Required

FF

Frode Follerås
3
6
6. sep. 2024 | 11:59 fm
Ämne:
Service and CRMScript Discussion

Senaste svar

Thank you Frode! It was a new line in Authorization that fooled me. I removed it and then it worked against the API.

FF

by Frode Follerås
28. feb. 2025 | 08:13 fm
push_pin lock

How to trigger correct language and replyTemplate when triggering email sending

Hi, I'm wondering if there are any possibilities to trigger sending of the correct language in the replytemplate for Ticket email confirmation. I've set up everyting up as described in: https://docs.superoffice.com/no/request/reply-templates/learn/index.html https://docs.superoffice.com/no/admin/options/learn/custlang/update.html https://docs.superoffice.com/no/request/reply-templates/learn/new-language.html In my case, I've setup so that incoming ticket request on a danish service email account is replying in danish, the default setting is norwegian. I'm struggling on how to make the rest api behave in the same manner since we also have a customerportal using the api. https://docs.superoffice.com/en/api/reference/restful/agent/Ticket_Agent/v1TicketAgent_SendTicketMessage.html https://docs.superoffice.com/en/api/reference/restful/rest/TicketMessage/v1TicketMessageEntity_SendTicketMessage.html Do you have any suggestion?   Sincere regards   Truong  

TL

Truong Le
1
0
27. feb. 2025 | 10:36 fm
Ämne:
Online development and web service API's
push_pin lock

Refresh whole page including archives

Hi, We use the following snippet a lot to refresh the page when we have performed some changes (for example, with a task menu dialog): eventData.setNavigateTo("soprotocol:main[refresh=true]"); I have noticed that this does not refresh the archives of an entity (anymore), not sure if this is due to the new UI. My assumptation is that this should also refresh the archives of the page (atleast the one currently active), but since you are explicity setting main in the soprotocol, I am not completely sure? So is this intended behavior? (in that cas, how to refresh the currently active archive?) or a bug
David Hollegien
2
5
21. feb. 2025 | 10:09 fm
Ämne:
Online development and web service API's

Senaste svar

View state in the event data or as method on the ViewState agent would be great, that way we can construct the soprotocol to refresh the correct parts.
by David Hollegien
26. feb. 2025 | 04:35 em
push_pin lock

Document creation via the API

  The following documentation is followed:  https://docs.superoffice.com/en/api/netserver/web-services/howto/document/rest-generate-document.html? tabs=generate-document-rest The first step, creating the document data set via the API, is successfully completed. However, when generating the content - both via a document template and when uploading the content directly - the following error message always appears: „Cannot create directory \\**\con\2025.1 because a file already exists with that name.“ This error message also occurs if a new, non-existent file name is specified when the document data record is created. If a document is created directly in SuperOffice and the content is then overwritten/updated via the API, this works without any problems - in this case a new, unique file name is automatically generated. The document is available in SuperOffice as a template and contains contact and company variables that should also be filled in via the API Does anyone have more detailed information or suggestions for solutions?    

RW

Ralf Weisser
3
10
12. feb. 2025 | 09:04 fm
Ämne:
Online development and web service API's

Senaste svar

Hi Ralf, Unfortunately there is no API to send a form submittion via the API. There was a wish for it, but that was not prioritized and closed. You can use the  PersonAgent.SendConsentConfirmationEmail to method. The person must already exists, and the person must already have the Consent Info already set. If not, you can use the PersonAgent.CreateDefaultConsentPerson API to create one, and then save it using the PersonAgent.SaveConsentPerson API. Hope this helps!
by Tony Yates
20. feb. 2025 | 03:34 em
push_pin lock

Working with a form submission using CRM Script, before it is processed.

Hi All, We have a customer, who want to select a form submission, before it is processed, and depending on the form decide whether the flow following submission goes down the sales route (create a sale), or service route (creates a request).  The obvious choice would be to have two seperate forms on the website one for sales and one for support, but for the case of this customer, the lines are muddy, so a form submission could need to take either one of these routes based on very small differences to the requirements. So ideally I just need to set a value on a field, prior to submission to say "Sales Route" or "Service Route", and then have the CRM Script fire the correct route based on which route was entered against the form submission. Now I know where is not a field in the form submission table to store this info, but I could store it in a custom object, just containing the form submission id, and the route to be taken. The issue is, I cannot see any decent way of running a CRM scipt off a form submission pre-processing.  The ideal scenario would be if you could add a Task button option to the form submission record, and pass through the form submission id to the script, but this is not possible. Alternaly I thought about created a selection of unprocessed form submissions, and then use the side panel to attempt to show a basic form, based on a CRM script to show the details of the selected form submission, and then give two options based on which route to take.  But whilst I know you can use the side panel when on the selection screen, I don't know if there is a way of passing through the selected form submission record, like you can do with most other entities. Is it possible to pass through the selected form submission id to the web panel, or is there another, more intelligent way that I can overcome this issue with just CRM Script. Many thanks, Trevor
Trevor Sharp
2
4
5. feb. 2025 | 05:08 em
Ämne:
Service and CRMScript Discussion

Senaste svar

OK thanks Tony, appreciate your input on this. Trevor
by Trevor Sharp
12. feb. 2025 | 01:59 em
push_pin lock

How to "attach" a project to a contact using the REST apis?

We are making an export from our systems into SuperOffice, and the goal is to export all contacts, projects and persons. So far all separate collections has been exported and works as expected, in that we can find them in the CRM. But it seems to be a possibility for "attaching" both persons and projects to a contact, but we cannot figure out how when using the REST api By looking at the Contact api (https://docs.superoffice.com/en/api/reference/restful/rest/Contact/v1ContactEntity_PostContactEntity.html) the only thing I can find is the links-section, but that does not seem like the right thing. I believe I can do a GET to Contact/{id}/projects, but I cannot find a POST Contact/{id}/projects Basically, when opening a contact in the CRM, I would like to see both 'Contacts' and 'Projects' in the lower half populated. Please advice - Thomas

TL

Thomas Leggett
3
3
11. feb. 2025 | 08:36 em
Ämne:
Online development and web service API's

Senaste svar

Just another perspective. Checkout all the database table reference charts under the Technical Resources area .
by Tony Yates
12. feb. 2025 | 07:59 fm