Some users may experience random login-problems to our Community. We are investigating the root cause of this. If you get an error message from CloudFlare, please send the RayID in the message to support@superoffice.com. You may also clear your browser cookies and cashe to solve it. Thanks for your understanding. 

Application Programming Interface forums

0 Subscribers

3 Topics

4941 Conversations

Area for questions and answers about SuperOffice API's.

All conversations (4941)

push_pin lock

Sentry denies Write access

I have a CRM-Script that edits custom-fields on a sale. But for one user, and only one user, this error message comes up. I don't understand what this means, CRM-Script doesn't check which access-rights a user has before it makes changes to the db, right?

BM

Beata Martinsson
2
1
23 May 2025 | 01:23 PM
Topic:
Service and CRMScript Discussion

Last reply

CRMScript triggers execute in the current user context. You may want to encapsulate the script contents in a try/catch block to avoid unnecessary error dialogs. 
by Tony Yates
23 May 2025 | 02:36 PM
push_pin lock

Convert Attachment to CRM Document

Is there any way to simply get an attachment from the attachment db table and convert it to a CRM document that can be added to a sale, contact etc etc? Like, in a imaginary scenario I wish for a like createCRMDocumentEntityFromAttachmentId(1) method or function? Or just any other way to solve it without having to parse the document from the attachment body to a CRM Document.  I am trying to add all attachments from a request to the customer card. 

BM

Beata Martinsson
2
2
22 May 2025 | 12:34 PM
Topic:
Service and CRMScript Discussion

Last reply

Oh, okay good to know! Thank you :)

BM

by Beata Martinsson
23 May 2025 | 06:51 AM
push_pin lock

Get listitem by listId

Hello.  When it comes to defining udef in Sales with respect to lists there are 2 ways. 1. Creating a user defined field and assign a standard list to it.  2. Creating a user defined field and assign a user defined list to it.  I have problems with getting the item value from a standard list.  In the table UDefField the only reference to a standard list table is the field listTableId as far as I can see. If I have defined a userdefined field that points to one of the standard entities (ie, associate, sale stage, project status) and get a the item value id, how can I then fetch the item value if the only lookup field I have is the listTableId ? https://docs.superoffice.com/en/database/tables/udeffield.html I can see there are functions agent.GetListIdByListName("name") and NSMDOListItem item = agent.GetListItem("listname", itemId) but I cannot see a way to get listitem when I only have the listTableId
Ummair Tahir
3
3
18 May 2025 | 02:04 PM
Topic:
Service and CRMScript Discussion

Last reply

Hi Ummair,  OK, Here are three ways to get list name from ListTableId: 1: Hardcode a Map based on known table Ids  (documented in the Database Reference ) Map listTableMap; listTableMap.insert("219","AcademicTitle"); listTableMap.insert("225","AmountClass"); listTableMap.insert("2","Associate"); listTableMap.insert("61","Business"); listTableMap.insert("64","Category"); listTableMap.insert("70","CompanyInterest"); listTableMap.insert("109","Competitor"); listTableMap.insert("73","ContactInterest"); listTableMap.insert("19","Country"); listTableMap.insert("97","Credited"); listTableMap.insert("112","Currency"); listTableMap.insert("91","Function"); // Proj. Member Type listTableMap.insert("216","Intent"); listTableMap.insert("94","MrMrs"); listTableMap.insert("76","Position"); listTableMap.insert("79","Priority"); listTableMap.insert("82","Rating"); listTableMap.insert("103","Reason"); listTableMap.insert("222","Rejection"); listTableMap.insert("48","Relation"); listTableMap.insert("100","Source"); listTableMap.insert("88","Status"); listTableMap.insert("130","Template"); listTableMap.insert("67","TypeFollowUp"); listTableMap.insert("85","TypeProject"); listTableMap.insert("106","TypeSelection"); listTableMap.insert("136","UserDefined"); listTableMap.insert("59","UserGroup"); String tableName = listTableMap.get("2"); printLine("Table Name: " + tableName); // prints: Associate 2: Dynamically lookup the table name from the sequence table String GetTableName(Integer tableNumber) { String [] searchFields = String("sequence.TableName").split(","); NSArchiveRestrictionInfo[] restrictions; NSArchiveRestrictionInfo res1; res1.SetName("sequence.TableNumber"); res1.SetOperator("="); res1.SetValues(String(tableNumber.toString()).split(",")); restrictions.pushBack(res1); NSArchiveOrderByInfo[] order; String[] entities = String("").split(","); Integer pageSize = 250; NSArchiveAgent archiveAgent; NSArchiveListItem[] rows = archiveAgent.GetArchiveListByColumns("Dynamic", searchFields, order, restrictions, entities, 0, pageSize); foreach (NSArchiveListItem row in rows) { Map rowData = row.GetColumnData(); String tableName = rowData.get(searchFields[0]); return tableName; } } String table = GetTableName(2); printLine("Table Name: " + table); // prints: ASSOCIATE 3: Use the UserDefinedFieldAgent to look up the list name: NSUserDefinedFieldInfoAgent udefAgent; NSUserDefinedFieldInfo udefInfoList = udefAgent.GetUserDefinedFieldFromProgId("SuperOffice:7", 1); // 1: Contact, 2: Person, 3: Project, 4: Sale, 5: Temp, 6: Appointment, 7: Document printLine("List Name: " + udefInfoList.GetMdoListName()); // prints: List Name: business Hope this helps!
by Tony Yates
20 May 2025 | 04:39 PM
push_pin lock

how to get value of user-defined list item per crm script

Hi,   in SO Windows with vbscripts by Trigger Sales beforeSave, I can get value of user-defined list item: division = objSO.GetListItem(currentSale.Udef.ByProgId("SuperOffice:1").ListTableId, division).Text   but in SO CLoud or SO Web with crm script, with this i get ID of List item back: devision = ed.getInputValue("SaleEntity.UserDefinedFields.SuperOffice:1"); Is there way to get its ListItem Value back, only with SearchEngine?   Thanks!
Jianchun You
2
8
11 Mar 2020 | 12:00 AM
Topic:
Online development and web service API's

Last reply

Answer to Ummairs question: https://community.superoffice.com/en/technical/forums/api-forums/service-crmscript/get-listitem-by-listid/
by Tony Yates
19 May 2025 | 11:38 AM
push_pin lock

self-defined List Display

Hi, We have Service old Mode for several years and now want to update to new Mode to get AI-based Function, but we have Problems to re-define the Filter, Sort, More Fields to display a List in new Service Mode in Screen Designer. Case 1: We have filtered Project-List related to Tickets. To solve that, in "Screen" of old Service Mode we have defined the Filter for the Projects which Status is open. and display second udf to help User to select correct Project. Here is the filtered Project List, and this works fine: Case 2: We have 2nd List to Ticket based on our Custom Object "Cost Center" with ExtraTable, the "Cost Center" has boolean Field "disabled", the List should be displayed with all enabled Entries to Tickets. Both case we have good solved in old Mode but there is no alternative in new Service Mode. Due to this, we are now disadvantaged to update AI-Function for our Ticketsystem becase SuperOffice do no more Updates to Service old Mode.  
Jianchun You
1
4
16 May 2025 | 12:54 PM
Topic:
Service and CRMScript Discussion

Last reply

I Think SuperOffice has already good Solution in Screen in old Service Mode by self, this can be moved in new Service Mode to display a List in Screen Designer.
by Jianchun You
16 May 2025 | 01:31 PM
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
12
29 Apr 2025 | 02:22 PM
Topic:
Service and CRMScript Discussion

Last reply

The backend developer have already changed things on their end to make it to accept a POST :)
by Ummair Tahir
13 May 2025 | 01:16 PM
push_pin lock

Help with SuperOffice CRM Script: Finding Contacts by Category

I'm developing a CRMScript and need to search for contacts with category custom category. For testing I have just labeled it "C", but I'm getting the error "SearchEngine::useField() contact.category not found" when using either contact.category or contact.category_id in my SearchEngine criteria. What's the correct field name to use when searching for contacts by category in SuperOffice CRM, and should I be using the category name 'C' as a string or looking for an ID number instead? Any working code examples would be very helpful.

KH

Kamil Halden
3
2
12 May 2025 | 10:17 PM
Topic:
Service and CRMScript Discussion

Last reply

Hi Kamil In addition to what Frode said, you can find the field names you're looking for in the database reference: https://docs.superoffice.com/en/database/tables/contact.html
by Espen Steen
13 May 2025 | 06:39 AM
push_pin lock

How to get the columnname in UDF-tables by columnid

HOw do I find the actual database field name based on the response ?    {     "UDefFieldId": 715,     "ColumnId": 40509,     "FieldDefault": "",     "FieldHeight": 17,     "FieldLabel": "Postnummer",     "FieldLeft": 100,     "FieldTop": 0,     "FieldType": "ShortText",     "FieldWidth": 100,     "FormatMask": "",     "HideLabel": false,     "IsIndexed": true,     "LabelHeight": 17,     "LabelLeft": 0,     "LabelTop": 0,     "LabelWidth": 100,     "LastVersionId": 705,     "ListTableId": 0,     "IsMandatory": false,     "Type": "Sale",     "Page1LineNo": 1,     "ProgId": "zip",     "IsReadOnly": false,     "ShortLabel": "",     "TabOrder": 0,     "TextLength": 20,     "Tooltip": "",     "UdefIdentity": 1,     "UDListDefinitionId": 0,     "Justification": "Left",     "Version": 18,     "TemplateVariableName": "ss01",     "HasBeenPublished": true,     "MdoListName": null,     "TableRight": null   },

IT

Inge Simon Thorbjørnsen
2
2
8 May 2025 | 11:48 AM
Topic:
Online development and web service API's

Last reply

Thanks.

IT

by Inge Simon Thorbjørnsen
8 May 2025 | 02:41 PM
push_pin lock

Archiving outlook .msg files using PUT on document Content

Hi,   I'm wondering how to use the REST endpoint correctly https://docs.superoffice.com/en/api/reference/restful/rest/Document/v1DocumentEntity_SetDocumentStreamFromId.html This endpoint behaves correctly whenever I upload .pdf files using "Content-Type" and "application/octet-stream". But when uploading .msg files with the same content type "application/octet-stream". Everything works except that the content within the binary files has an added "prefix" instead of only the binary content. The consequence is failing to open the document inside Super Office online. I've also tried using content-type application/msword with same result. --eada92e1-9621-4759-b670-9d05f01d258d Content-Type: application/octet-stream Content-Disposition: form-data; name="=?utf-8?B?SHVzayDDpSBtZWxkZSBkZWcgcMOlIGZyb2tvc3RzZW1pbmFyIDIuIGFwcmlsISAoMSkubXNn?="; filename="=?utf-8?B?SHVzayDDpSBtZWxkZSBkZWcgcMOlIGZyb2tvc3RzZW1pbmFyIDIuIGFwcmlsISAoMSkubXNn?=" ÐÏࡱá                >  þ   I hope that you can help me with this or have any suggestion to get around this.   Sincere regards   Truong

TL

Truong Le
1
1
5 May 2025 | 08:27 AM
Topic:
Online development and web service API's

Last reply

This might be an encoding problems also. When I remove the "prefix" in notepad++, the file opens fine

TL

by Truong Le
5 May 2025 | 11:43 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
Topic:
Service and CRMScript Discussion

Last reply

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