Application Programming Interface forums

0 Prenumeranter

3 Ämnen

4976 Samtal

Area for questions and answers about SuperOffice API's.

All conversations (4976)

done
Answered
push_pin lock

Error Message and empty Ticket created if Ticket Category changed to the limited Category which he has not Access?

Hi,   We have in CS three separate Categories A, B, C for our both separated Support Teams A and B. Category B has 'Only Member has Access', and only Teams B User are the Member in this category; Category A has not this Limit. In the User role, the Teams A User can read/edit all requests, the Teams B User can only read/edit Requests in own Categories. If Teams B need 2-Level Supports from Teams A, he can change Ticket to Category C, it's the Under-Category of B and all User of Teams A and B are the Member of this Category. With this Configuration it works fine, both Teams get separated Visibilities and access to their Tickets in separated Categories and get common Access to the Tickets in Category C for 2nd-Level Support in our one Ticketsystem. Now the Isses is, if Teams A User find that Ticket is not for his Teams and changed to Category B which he has not Visibility, it raised up an Error Message: and it created a new empty Ticket, only filled Field are Ticket ID and created Time at current Time. I asked our SO Local Suppprt Teams to check that Error Message and see more information: An exception occurred in script: "Service: Saving a request: Message for closing Tickets" at: line 97, char 7 Original exception: DbODBC::FatalException at , line 97, char 7 An exception occurred in script: "Screen: Edit ticket 80 copy, Button: ok" at: line 138, char 16 Original exception: EjScript::RunTimeException i have checked both Scripts. By crm-scripts for Trigger 'Saving a request', the error message was caused by t.save(). I know in this Trigger we don't need this code to save a Ticket, but without this, the set Value of user-defined Fields (UDF) will not be saved to the current Tickets. By Scripts to OK-Button for Screen of Edit-Ticket, the Error Message was caused by red-arrow indicated code. I know all UDFs will be saved in default code: t.setValue(se.getField(0), extraField.toString()); But for some UDFs related to Tables i have set separated in the Screen, because I set special Simple Value to get limited Results of Output of the UDF related Tables. That means, i need both codes in Scripts which caused the Error message. Now the question is, how could i optmize the Scripts to avoid this Issues with Error Message and new created empty tickets by User changed Ticket to Category with limited Access which he dos not have? The correct Output instead of that Error Message after this Changing should be for that User sth. like: You have no rights to access this Ticket. Many thanks! 
Jianchun You
2
6
19. dec. 2025 | 01:27 em
Ämne:
Service and CRMScript Discussion

Senaste svar

No, i mean splitting the save action into two, something like this; #setLanguageLevel 4; Integer ticketId = 1; Integer selectedTicketCategoryId = 2; Ticket ticket; if (ticket.load(ticketId) == false) { exitWithMessage("Unable to load ticket with id '" + ticketId.toString() + "', can't perform changes."); } Integer currentTicketCategoryId = ticket.getValue("category").toInteger(); // set custom and other fields here, don't change category field ticket.setValue("x_", "value"); // save ticket.save(); // category was changed, perform a seperate save if (currentTicketCategoryId != selectedTicketCategoryId) { // load ticket again to make sure we have the latest values, since we did if (ticket.load(ticketId) == false) { exitWithMessage("Unable to load ticket with id '" + ticketId.toString() + "', can't category change."); } ticket.setValue("category", selectedTicketCategoryId.toString()); ticket.save(); }
by David Hollegien
3 h, 57 m sedan | 12:00 em
done
Answered
push_pin lock

"Outbound email or SMS created" Trigger override request status

I have a crm script on the trigger "Outbound email or SMS created" that overrides the message template to force my customers to log into the self service solution to read the content of the message. This trigger works fine and has been working for a long time, except for one anoying thing: The request occationally does not respect the request status and even if the case worker choses to close the request when replying, the request is still Open. At first sight it looks like it is closed, but when refreshing the page it is apparent that it isstill open. When fetching the Ticket in the CRM script i see that the status is wrong, so I guess this is some kind of race condition. Any sugestion as to how to fix this? Should I add a sleep() somewhere? EventData ed = getEventData(); if (ed.getInputValue("outbox.eventName") == "addMessage") { Integer ticketId = Integer(ed.getInputValue("outbox.ticketId")); NSTicketAgent ticketAgent; NSTicketEntity ticket = ticketAgent.GetTicketEntity(ticketId); NSTicketCategoryEntity c = ticket.GetCategory(); NSTicketStatusEntity status = ticket.GetStatus(); log(status.GetName()); //wrong status is logged .... ticketAgent.SaveTicketEntity(ticket); }    

SG

Snorre Garmann
1
2
29. dec. 2025 | 01:18 em
Ämne:
Service and CRMScript Discussion

Senaste svar

Thanks. I didn't find a good way to optimize the order of things. Not much time consuming stuff happening between the load and the save, so i ended up with this loop. I know that in most cases the ticket should be closed, so I think this would work. I tried to use the GetRepliedAt() as a condition, but this seems to have been changed before the Status so it is updated even for the first fetch. Integer ticketId = Integer(ed.getInputValue("outbox.ticketId")); NSTicketAgent ticketAgent; NSTicketEntity ticket; for(Integer i = 0; i < 5; i++) { ticket = ticketAgent.GetTicketEntity(ticketId); NSTicketStatusEntity status = ticket.GetStatus(); if(status.GetName()=="Closed") { break; } sleep(0.1); }

SG

by Snorre Garmann
9 h, 58 m sedan | 05:59 fm
done
Answered
push_pin lock

API-uploaded documents not accessible by other users (default document library)

We're building an integration between a third-party document signing service and SuperOffice using n8n. When a document is signed, a webhook triggers our flow which: Updates the Sale status to Sold Creates a Document entity (POST /api/v1/Document) Downloads the signed PDF Uploads PDF content (POST /api/v1/Agents/Document/SetDocumentStreamFromId) Everything works - the document is created, PDF is uploaded, I can open it. But other users cannot open the PDF, even though: VisibleFor is set to "All" Associate is set to the Sale owner Both users have full admin permissions (User level 0, all data rights set to Delete) We use the default SuperOffice document library (not SharePoint) API calls are authenticated with my OAuth credentials (Authorization Code flow). The document shows CreatedBy = me, even though Associate = other user. We verified the PDF is actually stored - GET /api/v1/Document/{id}/content returns the full PDF data. Is this a known limitation? Do we need a system user or separate integration account for document uploads to be accessible by everyone?

EK

Elias Koivuluoma
2
1
23. dec. 2025 | 10:18 fm
Ämne:
Online development and web service API's

Senaste svar

You should be using a system user here and not an access token tied to your own account. But that does not explain the issue that you are describing. Do other users see the document row in the activities archive of the linked sale?
by David Hollegien
19 h, 25 m sedan | 08:32 em
done
Answered
push_pin lock

"Outbound email or SMS created" Trigger override request status

I have a trigger on "Outbound email or SMS created" that overrides the message template to force the user to log into our self service solution to read the content. This trigger works fine, except for one thing. If the support personell chooses to close the request while adding a message, the request is only sometimes being closed. It looks like it is closed at first sight, but if refreshing the browser I see that the request is still open. I have added logging in the Trigger script and can see that the ticket has the wrong state when fetching from the script, so I guess the problems are some kind of race problem. In the change log of the request it also looks like the request is closed, even if it is open. Any suggestion as to how to solve this? should i add a sleep() to the trigger? EventData ed = getEventData(); if (ed.getInputValue("outbox.eventName") == "addMessage") { Integer ticketId = Integer(ed.getInputValue("outbox.ticketId")); NSTicketAgent ticketAgent; NSTicketEntity ticket = ticketAgent.GetTicketEntity(ticketId); NSTicketCategoryEntity c = ticket.GetCategory(); NSTicketStatusEntity status = ticket.GetStatus(); log(status.GetName()); //wrong status

SG

Snorre Garmann
1
0
29. dec. 2025 | 01:12 em
Ämne:
Service and CRMScript Discussion
done
Answered
push_pin lock

Set UTM data through scripts

Hi!  Version 11.6 added support for UTM parameters to forms, but is it possible to set these through scripts aswell?  One of our customers are using crmscript based endpoints where they get data and they would like to set the UTM data that way aswell, so they can make selections on persons to see which endpoint they came from.  Is it possible to create these rows without an formsubmission and is it via a NSClass or do you have to use the searchengine to insert the row?

FL

Fredrik Larsson
2
1
8. dec. 2025 | 12:29 em
Ämne:
Service and CRMScript Discussion

Senaste svar

As far as I can see in the API is that there is no way to directly set the UTM parameters on the person, only through a form submission ( SetUtmCreatedPersonContactForFormSubmission ) Their is an 'UtmParameters' property on the PersonEntity, but it is readonly, changes to it aren't saved.
by David Hollegien
10. dec. 2025 | 12:16 em
done
Answered
push_pin lock

Add members to workflow using script

Is it possible to add members to a workflow using CRM-script?

FF

Frode Follerås
3
1
28. nov. 2025 | 10:40 fm
Ämne:
Service and CRMScript Discussion

Senaste svar

Hi, you can use the TryAddPersonsToEmailFlow method on the NSPersonAgent class.
by Frode Lillerud
1. dec. 2025 | 09:45 fm
done
Answered
push_pin lock

Issue with FindAgent SOAP search for phone numbers in On-Prem 10.3

Hi all, We have an application that still uses the SOAP interface for searching, but we’ve run into a small problem. We have a new customer running On-Prem 10.3 , and we need to search for phone numbers. We are using the following code: string phoneFullNumber = "4723354000"; using (SuperOffice.CRM.Services.FindAgent find = new SuperOffice.CRM.Services.FindAgent()) {     var archiveColumns = new string[] { "phone.SearchPhoneNumber", "phone.owner_id", "phone.ptype_idx", "phone.phone_id" };     var restriction = new SuperOffice.CRM.ArchiveLists.ArchiveRestrictionInfo[]     {         new SuperOffice.CRM.ArchiveLists.ArchiveRestrictionInfo("phone.SearchPhoneNumber", "EQUALS", phoneFullNumber)     };     SuperOffice.CRM.Services.FindResults results = find.FindFromRestrictionsColumns(         restriction,         "Dynamic",         archiveColumns,         int.MaxValue,         0     );     foreach (var row in results.ArchiveRows)     {         // Process results     } } We believe this approach has worked in the past, but it no longer returns any results.   We also tried setting IsActive = true on the restriction, but it didn’t make a difference.   When logging the request, this is what is sent: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:ApplicationToken xmlns:h="http://www.superoffice.net/ws/crm/NetServer/Services88">519a79b0aeaa3984c78da6a4abc50d49</h:ApplicationToken><h:Credentials xmlns:h="http://www.superoffice.net/ws/crm/NetServer/Services88" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><h:Ticket>7T:NwAwADcANgA5ADEAMgBiADMAMAAzAGQAMwBkADkAZABiADgANAA3AGEAMwAwADQANwBkADYANgBkAGIAZgAzADsAOQAwADEAOQA2ADMAMwA0ADMA</h:Ticket></h:Credentials><h:TimeZone xmlns:h="http://www.superoffice.net/ws/crm/NetServer/Services88" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><h:SoTimeZoneId>0</h:SoTimeZoneId><h:SoTimeZoneLocationCode/></h:TimeZone></s:Header><s:Body><FindFromRestrictionsColumns xmlns="http://www.superoffice.net/ws/crm/NetServer/Services88"><Restrictions xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ArchiveRestrictionInfo><Name>phone.SearchPhoneNumber</Name><Operator>EQUALS</Operator><Values xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:string>4723354000</a:string></Values><DisplayValues xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/><ColumnInfo i:nil="true"/><IsActive>true</IsActive><SubRestrictions i:nil="true"/><InterParenthesis>0</InterParenthesis><InterOperator>And</InterOperator><UniqueHash>-1164823746</UniqueHash></ArchiveRestrictionInfo></Restrictions><ProviderName>Dynamic</ProviderName><DesiredColumns xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:string>phone.SearchPhoneNumber</a:string><a:string>phone.owner_id</a:string><a:string>phone.ptype_idx</a:string><a:string>phone.phone_id</a:string></DesiredColumns><PageSize>2147483647</PageSize><PageNumber>0</PageNumber></FindFromRestrictionsColumns></s:Body></s:Envelope> And this is the response we get: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:ExceptionInfo i:nil="true" xmlns:h="http://www.superoffice.net/ws/crm/NetServer/Services88" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/><h:ExtraInfo i:nil="true" xmlns:h="http://www.superoffice.net/ws/crm/NetServer/Services88" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/><h:Succeeded xmlns:h="http://www.superoffice.net/ws/crm/NetServer/Services88">true</h:Succeeded><h:TimeZone xmlns:h="http://www.superoffice.net/ws/crm/NetServer/Services88" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><h:SoTimeZoneId>0</h:SoTimeZoneId><h:SoTimeZoneLocationCode/></h:TimeZone></s:Header><s:Body><FindFromRestrictionsColumnsResponse xmlns="http://www.superoffice.net/ws/crm/NetServer/Services88"><Response xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><TableRight i:nil="true"/><FieldProperties/><ArchiveColumns/><ArchiveRows/><RowCount>0</RowCount></Response></FindFromRestrictionsColumnsResponse></s:Body></s:Envelope> As you can see, no rows are returned ( RowCount=0 ), and there are no errors.   Has anyone encountered this before or have suggestions on why this might be happening? Could this be related to provider availability, configuration, or permissions in On-Prem 10.3?   Thanks in advance for any advice!  

JR

Jon Rellsve
3
2
26. nov. 2025 | 05:17 em
Ämne:
Online development and web service API's

Senaste svar

For phone lookups, we've always recommended using the MDO providers ` phonesearch `, ` personphone ` and ` contactphone `.  The phonesearch provider is the most flexible as it will return both companies and contacts. GET https://{{env}}.superoffice.com/{{tenant}}/api/v1/MDOList/phonesearch?query=90168242 Accept: application/json Authorization: Bearer {{token}} The type will indicate whether it is a person or contact. [ { "Id": 5, "Name": "John Doe (Johns Company) +4490168242", "ToolTip": "+4490168242", "Deleted": false, "Rank": 2, "Type": "Person", "ChildItems": [], "IconHint": "Person", "ColorBlock": 0, "ExtraInfo": "+4490168242", "StyleHint": "Person", "FullName": "Anthony Yates", "TableRight": null, "FieldProperties": {} }, { "Id": 32, "Name": "White Mountains, Forestry 90168242", "ToolTip": "+4490168242", "Deleted": false, "Rank": 3, "Type": "Contact", "ChildItems": [], "IconHint": "Contact", "ColorBlock": 0, "ExtraInfo": "+4490168242", "StyleHint": "Contact", "FullName": "White Mountains, Forestry", "TableRight": null, "FieldProperties": {} }, ] Best regards.
by Tony Yates
28. nov. 2025 | 12:59 em
done
Answered
push_pin lock

Does EventDataDialogDefinition work properly on mobile CRM?

What I was trying to do I created an “After request saved” trigger that uses a yes/no EventDataDialogDefinition to display a dialog asking the user whether they want to send an email when the ticket status is changed, on mobile CRM. What I expected to happen I expected the dialog to appear every time the ticket status is changed in Mobile CRM. What actually happened In the online CRM version, everything works as expected. In Mobile CRM, the behavior is inconsistent: When changing the status using the pen icon and updating it that way, the trigger runs and the dialog opens. When changing the status using quick change or the top-right options button, the trigger does not behave the same. With “After saving request” , the trigger does not run at all. I then tested additional trigger types ( “ Request changed status ” and “ Request saved ” ). These triggers did run when updating via quick change / options, but the dialog did not open. Steps to reproduce the problem Create an "After request saved", “Request saved”, or "Request changed status" trigger that uses EventDataDialogDefinition to open a yes/no dialog. Open a request in Mobile CRM. Change the status via the pen icon → dialog opens. Change the status via quick change or the options button → trigger may run, but the dialog does not appear. #setLanguageLevel 4; // Displays delete ticket yes/no dialog Void DisplayDialog(EventData ed) { // Display dialog EventDataDialogDefinition dialog; dialog.setIcon("question"); dialog.setType("yesno"); dialog.setPrefix("openDialog_"); dialog.setTitle("Some title"); dialog.setText("Some text"); ed.showDialog(dialog); } EventData ed = getEventData(); String dialogResponse = ed.getInputValue("openDialog_button"); if (dialogResponse.isEmpty()) DisplayDialog(ed); // Do nothing if (dialogResponse == "no") return; if (dialogResponse == "yes") // Send email   Question Is this intended behavior in Mobile CRM, or could this be a potential bug?    

ES

Eivind Simonsen
0
2
20. nov. 2025 | 03:19 em
Ämne:
Service and CRMScript Discussion

Senaste svar

Hi Bas, That matches what I’m seeing as well. In my tests, the input value that normally gets added when using an EventDataDialogDefinition (e.g. "openDialog_button": "no") was missing entirely on both desktop and mobile when using the  “Saving a request” or “Request status changed” triggers. Since that value never appeared, the dialog didn’t open in those cases. Using “After saving request” does work when changing the status via the pen icon, but the challenge is that my customer wants the dialog to appear specifically when using the quick edit. That method doesn’t seem to add the input value or trigger the dialog at all.   What I get when changing status: { "type": 0, "inputValues": { "contactId": "37458", "entryId": "2419", "personId": "83659", "ticketId": "2419", "ticketStatus.new": "20", "ticketStatus.old": "1" }, "blockExecution": false, "navigateTo": "", "message": "", "showDialog": "", "outputValues": {}, "stateValues": {} } What I expected: { "type": 0, "inputValues": { "contactId": "37458", "entryId": "2419", "personId": "83659", "ticketId": "2419", "ticketStatus.new": "20", "ticketStatus.old": "1", "openDialog_button": "yes/no" }, "blockExecution": false, "navigateTo": "", "message": "", "showDialog": "", "outputValues": {}, "stateValues": {} }

ES

by Eivind Simonsen
21. nov. 2025 | 08:26 fm
done
Answered
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
5
13. aug. 2025 | 12:31 em
Ämne:
Online development and web service API's

Senaste svar

Hi David, This was extremely helpful - thank you so much! :-) Best Regards, Henrik
by Henrik Povlsen
20. nov. 2025 | 07:59 fm
done
Answered
push_pin lock

Where can I find EventData commands?

Hello! In this guide I found for task menus , I found a fatastic piece of code that looks like this:  ed.setStateValue( "command:ticket.tab.close" , ticketId); I have many scripts where I want to do things like this, and have before this used soprotocol to navigate around the environment using code. But, soprotocol has it's limitations in the documentation and mainly navigating to new places and creating new enitytys is possible. So I tried looking around the documentation for more commands, and I have not found anything, not in the EventData class or the class method documentation for SetSateValue. So, I was wondering, where do I find the documentation for the state value commands for event data? And as a sub-question, is there a command to force-reload the page you are on? Or specific spaces in SuperOffice? That would also be a wonderful thing, to not have to use html and the window-methods to force a reload. 
Beata Martinsson
1
0
19. nov. 2025 | 02:19 em
Ämne:
Service and CRMScript Discussion