Application Programming Interface forums

0 Abonnenter

3 Emner

4964 Samtaler

Area for questions and answers about SuperOffice API's.

All conversations (4964)

push_pin lock

Is NSNumberAllocationAgent updated lately?

Hello! I've recently come across a support ticket where certain users are unable to create a new contact. Reason being a trigger we created several years ago now throws an error. In this trigger we run NSNumberAllocationAgent.SaveCountRefEntity() in context of a user, but this only works for users with user level 0, We're not sure if the customer has done any changes to their users, or if the access rights for this method has changed with SuperOffice release 11.5?   Example code: #setLanguageLevel 4; NSNumberAllocationAgent numAllocAgent; NSRefCountEntity contactNumberEntity = numAllocAgent.GetRefCountEntity(96); // 96 = Contact number counter Integer incrementedNumber = contactNumberEntity.GetCurrentValue() + 1; // Save the incremented number to counter in database contactNumberEntity.SetCurrentValue(incrementedNumber); numAllocAgent.SaveRefCountEntity(contactNumberEntity); // This one fails!!   Throws error for users outside user level 0:

ES

Eivind Simonsen
3
2
6 t, 27 m siden | 08.18 AM
Emne:
Service and CRMScript Discussion

Seneste svar

Hi Eivind, Yes, I can confirm that this was also included in recent security fix deployed in 11.5. I beleive the mindset is that things that can only be done in Settings and maintenance are things that should only be done by administrators.  It's our business logic that increments Contact numbers when new companies are created. It's not known when these values should be changed otherwise, so we would very much be interested in learning more about your use case that doesn't match the intended behavior. I see you using CRMScript for this - in the context of a non-admin user. If this was a custom application you could perform the changed as a system user. Please send me an email with more context and I'll take it up with the product team for evaluation.  Best regards.
by Tony Yates
4 t, 33 m siden | 10.12 AM
push_pin lock

Is possible to get a filtered Activity-List

Hi, In each Sales we have a  number of archived Emails & Docus, some Emails should be listed for our Logistics User. Therefore we have created a UDF-Checkbox "Logistics" and a Tabs with Custom Screen for Logistics, where we want to have the same but filtered Activity-List: filtered List of Emails & Docus of the current Sales only with this checked Checkbox; Has Download Function via Webtools like in Standart Acrivity-List; and Preview via Minicard. Is this possible, or with other Alternative?   Many Thanks!   Jianchun
Jianchun You
1
0
22 t, 47 m siden | 03.59 PM
Emne:
Service and CRMScript Discussion
push_pin lock

Up/downloading big crm documents using script - Script is taking too much memory

I'm trying to up- and downloading documents using crm-script in Customer Portal. The files are big. 50-150 MB. I'm using "printBinary" when I'm downloading. And  "decodeBase64AsStream(base64)" and  "documentAgent.SetDocumentStream(....)" for creating document.   When it's above 50 MB I get " Script is taking too much memory" Is it possible to change the memory limit for a given tentant Id?    

FF

Frode Follerås
3
3
8. aug. 2025 | 12.50 PM
Emne:
Service and CRMScript Discussion

Seneste svar

Hi Frode, This is not the best solution, but perhaps a viable workaround. If the customer is to download a CRM document, then you can have a link that just-in-time copies the CRM document to an attachment (method: Integer copyCRMDocumentToAttachment(Integer)), and then redirects the customer to the attachment download link. The script could also register a row in an extra table for a job that cleans up the attachment after some time. Sverre
by Sverre Hjelm
14. okt. 2025 | 11.34 AM
push_pin lock

set DateAdd in Screen Simple Value

Hi, In the Custom Screen for 'Edit Ticket' i can define specialized List in Simple Value to display filtered project List related to Tickets: Now I want to display a Date-Field UDF of Project in this Project List. in SO Datebase the Date-Field is stored with a large number. Then i try to convert it as a Date: Now I click Edit Ticket and by seaching in Project list, it pops up with an Error: Question is, how could i convert to display a date-field from a large number in Screen Simply Value?   Thanks for your Helps.
Jianchun You
1
2
24. sep. 2025 | 09.08 AM
Emne:
Service and CRMScript Discussion

Seneste svar

got it: order.0.desc = true
by Jianchun You
6. okt. 2025 | 09.22 PM
push_pin lock

Get/Set information about E-marketing on person card

If im not mistaken, its standard to have E-marketing on the person card for mailings. I'm wondering how you can get/set these values from CRMScript. Been trying to read around the  person table , NSPerson , NSPersonAgent and NSPersonEntity classes, but not finding any useful information on it.

FL

Frederic Lien
2
2
30. sep. 2025 | 02.40 PM
Emne:
Service and CRMScript Discussion

Seneste svar

Both consent info and shipment types can be set using the personentity with the personagent;   #setLanguageLevel 4; Integer personId = 1754; NSPersonAgent personAgent; NSPersonEntity personEntity = personAgent.GetPersonEntity(personId); NSConsentInfo[] personConsents = personEntity.GetConsents(); foreach (NSConsentInfo personConsent in personConsents) { Bool isEmarketing = personConsent.GetConsentPurposeKey().equalsIgnoreCase("EMARKETING"); // do things } NSSelectableMDOListItem[] shipmentTypes = personEntity.GetShipmentTypes(); // do things personEntity.SetShipmentTypes(shipmentTypes); personEntity = personAgent.SavePersonEntity(personEntity);
by David Hollegien
2. okt. 2025 | 09.57 AM
push_pin lock

Delay in CRMScript

Is it possible to add a delay in CRMScript? Say i want to wait 5 minutes before sending an email when the script is triggered. 

FL

Frederic Lien
2
1
26. sep. 2025 | 09.13 AM
Emne:
Service and CRMScript Discussion

Seneste svar

Thank you so much, worked perfectly!

FL

by Frederic Lien
28. sep. 2025 | 03.23 PM
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
7
12. sep. 2025 | 06.19 AM
Emne:
Service and CRMScript Discussion

Seneste svar

Thanks all for helping to clarify the issue. I have created a bug report for this: BUG ID: 82774 and prompted the team. Best regards!  
by Tony Yates
19. sep. 2025 | 11.52 AM
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
15. sep. 2025 | 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
16. sep. 2025 | 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
15. sep. 2025 | 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