Application Programming Interface forums

0 Abonnenter

3 Emner

4755 Samtaler

Area for questions and answers about SuperOffice API's.

push_pin lock

Sentry plugin not working when referencing another table

Hi, We have a customer who is looking to move from SuperOffice Windows to SuperOffice Web, and I am trying to develop an equivelent sentry plugin to stop end users from being able to edit approved appointments.  We have a custom NetServer table, that stores the appointment id of the approved appointment and the id of the associate approving the appointment, along with the approval date. However, whilst I think it is coded correctly it is not making the appointment read only when the appointment is approved.  I have done some similar tests with the UDAppntSmall table, as per Dennis' example in the post here , to rule out the problem being with a custom table, but this does not work either. My modify select is as follows. public void ModifySelect(Select sql, TableInfo tableInfo) { AppointmentTableInfo ati = (AppointmentTableInfo)tableInfo; AcedaappfieldsTableInfo aaf = CustomTablesInfo.GetAcedaappfieldsTableInfo(); UDAppntSmallTableInfo udti = TablesInfo.GetUDAppntSmallTableInfo(); sql.JoinRestriction.LeftOuterJoin(ati.AppointmentId.Equal(aaf.AppointmentId)); sql.JoinRestriction.LeftOuterJoin(ati.UserdefId.Equal(udti.UdappntsmallId)); sql.ReturnFields.Add(aaf.AuthorisedbyId); sql.ReturnFields.Add(udti.Long14); } Now when I open the appointment the sentry code is fired several times (around about 14 times I think, from the point of double clicking the appointment to the appointment dialog being shown on screen with all the data loaded), and in most cases my custom table, and the UDAppntSmall table are found, and the code to limit the table rights to select only, fires (the results in the Watch window show the data from these tables being loaded correctly). But once, about half way through this process, everytime the appointment is opened (after about the 6th instance of the code firing), both tables are not found, and it is here when you first see the appointment dialog showing in SuperOffice (the following 7 times or so, of the code running on the appointment open event, both tables are found in the code, and the correct AuthorisedbyId is visible, but the appointment is still not opened as read only). Now if I move up the row where I set the table rights to row 42, as in the commented section above, outside the check on the custom table, the appointment does correctly load as read only.  But of course this will not work for the customer as I need to check that the appointment is approved before making the appointment read only. Whilst this code was running, all SQL traces that I ran whilst opening the appointment, did reference AuthorisedbyId field and return the correct value, so I don't know why this one instance on every appointment load the code does not correctly load the joined tables, and why the appointment is not made read only. And when I move an appointment via drag and drop, this is not blocked by the sentry plugin either, and the "var Test" line of code is hit far more often (though the table rights row is also still hit at times during this process), so I am completely stuck on what to try next. Finallly and, this is far less important, "SoLogger.LogError(ex)", no longer works.  How should this now be written now, to prevent a compile error? Many thanks, Trevor  
Trevor Sharp
3
7
13. jun 2023 | 12:47
Emne:
Client libraries and tools

Seneste svar

Hi Christian, Thanks for this reply, really good to know.  One problem I reported on this to AppDev was that as soon as as I use the Modify Select in the plugin for recurring appointments (the customer has quite a few recurrences of the appointments) the time to load and open appointment increases by about 10 times the amount as when not using the Modify Select.  Is this speed issue also resolved in 10.2.9. Many thanks, and have a great weekend. Trevor
by Trevor Sharp
21 t, 46 m siden | 04:21
push_pin lock

Refresh ticket list after task menu crmscript has been completed

Hello!  I´m working in the new request section and have added a new task menu item that deletes the ticket you right-click on. (This is done by crm-script.) Is there any way to refresh the list you are currently in by using the script so that the deleted ticket disappears from the list. 

FL

Fredrik Larsson
2
4
22. sep 2023 | 08:42
Emne:
Service and CRMScript Discussion

Seneste svar

Sounds more like a bug to me if executing the refresh soprotocol doesn't actually refresh everything in the screen. I don't think you have an other way of refreshing the screen that would refresh the table.
by David Hollegien
28. sep 2023 | 08:29
push_pin lock

static table v2 -> onClick?

Using a Static table element in a custom screen, how would I make it possible to fill in a few text elements when a row in the table is clicked?

DE

Dan Einarsson
2
3
14. sep 2023 | 08:25
Emne:
Online development and web service API's

Seneste svar

Hi Dan, Sorry for the late response. Unfortunately, I think your options are limited. The grid only supports certain features, and there is no way to easily override that. The only way to get full freedom and all the options you want is to create your own element, using the "Ejscript element" type. I have done this several times myself to create UI elements that do exactly what I want. Sverre
by Sverre Hjelm
27. sep 2023 | 06:37
push_pin lock

Bug: ListBox -> setNotEditable

when setNotEditable(true) is set for a List Box the value can still be changed using the Drop down arrow.

DE

Dan Einarsson
1
0
26. sep 2023 | 11:26
Emne:
Service and CRMScript Discussion
push_pin lock

Create contact without company

Hi Is it possible to create contacts(Person) that has no associated company, through the api? I have set the global setting "Mandatory Company on Contact" to false. The code below causes Object Reference exception somewhere in superOffice public async Task CreatePerson(int personId, string email, string firstName, string lastName) { var contactAgent = new ContactAgent(_config); try { var person = await contactAgent.AddPersonAsync(0, new PersonEntity() { Emails = new[] { new EntityElement() { Value = email } }, Firstname = firstName, Lastname = lastName }); } catch (Exception e) { throw; } }

SG

Snorre Garmann
2
2
26. sep 2023 | 08:08
Emne:
Application Programming Interface forums

Seneste svar

Thanks, that worked great.

Community.Data.Models.ForumConversationDetails?.AuthorInitials

by Snorre Garmann
26. sep 2023 | 10:10
push_pin lock

console.log stopps working in Screen html elements

Hi, We have noticed that the console.log function have stopped in more and more SuperOffice enviroments, we currently have 3 prod enviroments that have stopped working, and today we got a sod enviroment as well. It just seems to stop working from one day to another. alert works just fine, console.warn and other variants of console logging works, but, console.log is the most crusial since we use it to check objects etc, and its quite anoying to have to stringify em to use in console.warn :) Anyone else have noticed this, and have a solution? Regards Pär Pettersson
Pär Pettersson
3
4
14. sep 2023 | 01:39
Emne:
Service and CRMScript Discussion

Seneste svar

Can this be changed/removed?, really annoying when trying to debug something..
by David Hollegien
22. sep 2023 | 11:54
push_pin lock

CRMScript Webhook online: missing values

Hello everyone, we are using person delete webhook for synchonizing the person to ERP in our new project. According the documentation are Values available in this webhook: In our test (delete company with a person), after waiting for deleting a person from recycle bin, we got this: What could be a reason for missing the parameters here? Thank you in advance! Best regards, Andrey  

AS

Andrey Stupak
2
6
15. sep 2023 | 12:08
Emne:
Service and CRMScript Discussion

Seneste svar

Thank you, now it is perfect! :)

Community.Data.Models.ForumConversationDetails?.AuthorInitials

by Andrey Stupak
19. sep 2023 | 03:53
push_pin lock

Using webapi to find contacts based on custom field

Can anyone guide me to an example using the webapi to query contacts based on a custom field? ie. find contact where myCustomId = 1234  

SG

Snorre Garmann
2
9
18. sep 2023 | 11:36
Emne:
Client libraries and tools

Seneste svar

Great! I got the providerName confused. You should add an example like this to the top of the Search api doc. :) Thanks.

Community.Data.Models.ForumConversationDetails?.AuthorInitials

by Snorre Garmann
19. sep 2023 | 12:48
push_pin lock

Issue with creating/POST ChatSession using rest-api

Hi! I am building an integration to Superoffice on behalf of a customer (in python).  Specifically, the client wants to use third party chat/messaging software for customer to agent interactions, and then store those conversations as ChatSessions. I am trying to store these conversations as ChatSessions using rest POST /api/v1/ChatSession for creating the chatsession with initial data, and then POST /api/v1/ChatSession/Messages for storing the actual messages. My issue is that the timestamps I provide when creating the chat session gets rejected/neglected. The other data in the payload is correctly stored in SO, however the timestamps does not appear in Superoffice nor are they reflected in the response from the request. A minimal payload: payload = { "TopicId": 2, "CustomerAlias": customer_data['Kontaktnamn'], "CustomerEmail": customer_data['Email'], 'WhenEnded': '2023-08-23T16:07:42.2383759+02:00', 'WhenFetched': '2023-08-23T16:07:42.2383759+02:00', 'WhenIdle': '2023-08-23T16:07:40.2383759+02:00', 'WhenRequested': '2023-08-23T16:06:40.2383759+02:00', 'WhenStarted': '2023-08-23T16:06:52.2383759+02:00', "Status": 9, "User": {'AssociateId': 518} } My expectation, based on the documentation found here , is that WhenEnded, WhenFetched, WhenIdle, WhenRequested and WhenStarted should be posted with the values supplied when doing POST /api/v1/ChatSession, and reflected in SuperOffice The response I get from API looks like this; Where WhenEnded seems to be automatically set when I also set status=9 in the payload. The other timestamps are incorrect. In superoffice, the duration of chat is showing the following: And the other times are not showing at all (when started is empty, for example). In order to reproduce the same problem, I think do POST /api/v1/ChatSession using rest-api with the minimal payload supplied should suffice, changing the user id and topic values to something corresponding. The problem might be the format of the timestamp in the payload (should be string), and I have tried multiple ways of formatting it. The same issue carries over to storing messages on POST /api/v1/ChatSession/Messages, where the time is saved as the time of the request and not necessarily the time(s) supplied in the payload. My other sneaking suspicion is that there is some other, hidden dependency related to the timestamps that makes the endpoint ignore those parts of the payload. 

MJ

Michael Jonasson
2
4
1. sep 2023 | 03:32
Emne:
Online development and web service API's

Seneste svar

Thank you!

Community.Data.Models.ForumConversationDetails?.AuthorInitials

by Michael Jonasson
18. sep 2023 | 02:55
push_pin lock

Using the soprotocol for opening the add relation dialog and providing parameters for active and relation type

Hi, I've written a trigger that opens up the <add relation> dialog when certain conditions are met when saving a company. ed.setNavigateTo("soprotocol:relation[mode=edit&new=true]?relation_id=0"); To help the user I would lika to fill out the active part of the relation (= ed.ActiveContactId) and the relation type. I've tried providing the parameters for this using many different naming conventions, but none of the work. As I couldn't find a detailed reference for soprotocol parameters I'm a bit stuck.  Is it at all possible to provide parameters for the <add relation> dialog? The same way as when opening the <add appointment> dialog (example: appointment[mode=edit&new=true]?appointment_id=0 &appointment_type=1&doby=2024.08.14 &enddate=2024.08.14&calendarassociate_id=5&contact_id=10&person_id=15&pids=5,10,15)   Thanks, Jan
Jan Bonde
1
0
15. sep 2023 | 08:04
Emne:
Service and CRMScript Discussion