Adding a task via SQL

lock
push_pin
done
Answered
2

Working on getting some very custom intigrations working again after an upgrade from 8 to 10.
I originally had some code that added Appointements to projects that worked using the old VBScript toolset.

Now I wanted to switch this over and just add it using straight SQL  (Microsoft SQL)

When I do this I create the record in the APPOINTMENT table with an ID of the MAX Current ID +1
Then Create the record for that ID in the TRAVELTRANSACTIONLOG  for that ID.
I make a record in the VISIBLEFOR table and again the TRAVELTRANSACTIONLOG table according to the documentation.

Everything is displayed correctly but I can not add a new Appointent in the UI till I delete it.
Assuming because it is trying to add it with the ID I just added.
Is there another table controling the IDs I need to update so the system will grab the next avalaible?

The Table COUNTERVALUE is completly empty. FYI

Thank You,

Jeff

12 Dec 2024 | 06:43 PM

All Replies (2)

Hi,

It is not the recommended way of adding data to SO directly via SQL(will be hard to migrate to SO-online and maybe also maintain), but if one has to, you need to be aware of the sequence table and possibly alos other tables.
sequence table | SuperOffice Docs
next id shoud be fetch from that table and then also ticked up by +1 after saving appointment. (in admin you could correct "next-numbe" to max-id in appointment table + 1)

You could trace a GUI-creation o an appointment in SQL and see what tables it touches, and what code is run.

Without knowing your specific case maybe CRM-script could replace your old VB-script..

//Anders

12 Dec 2024 | 07:06 PM
I need to be able to access a SQL Table in another database which I was told I can not do in CRM-script. Which is why I was looking for alternative methods and was just going to go straight SQL instead.

We will never migrate to SO online as we have way too many customizations and the SO database is tied very closely to another in house DB. So not worried about that ever.

I think this solved it for me once I make these changes.
Thank you,

Jeff
12 Dec 2024 | 08:45 PM

Add reply