We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Access extra tables by NetServer Services

I need to program a custom app to read and write data from and to extra tables of SuperOffice Service. The custom app needs to target a CRM Online installation. Is it possible to access extra tables of SuperOffice Service from NetServer Services? And if so how?

Best regards, Marc

RE: Access extra tables by NetServer Services

Hi Marc, 

you can read data from an extratable, as described at the end of this blogpost.

Write is unfortunately not possible via webservices. A workaround can be to create an ejscript that you call as an endpoint.

Av: Frode Lillerud 16. mai 2017

RE: Access extra tables by NetServer Services

Hi Frode,

I am not sure if I am able to call a script from my interface application which runs in a system user context of an Online installation. At least I did not find a way to do so.

The only way I found is to write data into a table accessible by NetServer services (e.g. AppointmentEntity which then acts as a "data carrier") and transfer them to the extra table by using a scheduled task script.

AppointmentAgent agent = new AppointmentAgent();
AppointmentEntity carrier = agent.CreateDefaultAppointmentEntity();
carrier.Type = SuperOffice.Data.AppointmentType.Note;
carrier.Task.TaskListItemId = 16;  // A deleted task used to filter the data carrier in the CRMscript
carrier.Description = "y_installed_base:10000110,,SUO_4,1-0252,2014-10-04,Arlene White,Arlene White,2014-11-01,2015-11-01;...";  // Data to transfer, max 2047 characters
agent.SaveAppointmentEntity(carrier);  // Create an appointment record with contact_id = 0, task_idx = 16 and a text record containing the desired data

In the CRMscript I can transfer data from the TEXT table to my extra table (y_installedbase) and delete the TEXT and APPPOINTMENT records afterwards:

SearchEngine se;
se.addCriteria("appointment.task_idx", "equals", "16");
for (se.select(); !se.eof(); se.next())
  String appointmentId = se.getField(0);
  String textId = se.getField(1);
  String data = se.getField(2);
  WriteExtraTableData(data);  // Write data to extra table
  SearchEngine se1;
  se1.addCriteria("text.text_id", "equals", textId);
  se1.delete();  // Delete text record
  SearchEngine se2;
  se2.addCriteria("appointment.appointment_id", "equals", appointmentId);
  se2.delete();  // Delete appointment record
Av: Marc Eberhard 17. mai 2017

RE: Access extra tables by NetServer Services

Probably going to need to do this in next customer case. So are there nowadays better way to write extra tables?

Av: Mikko Tillikainen 16. apr 2020

RE: Access extra tables by NetServer Services

Hi Mikko,

Yes, in CRMScript you can use the NSDatabaseTableAgent.

Using the nuget proxies, or SOAP services, using the DatabaseTableAgent.

Using REST web services, using the TableRecord endpoint.

This only works towards extra tables [today].

Best regards!

Av: Tony Yates 16. apr 2020

RE: Access extra tables by NetServer Services

Good to know, thanks a lot!

Av: Mikko Tillikainen 17. apr 2020