Provisional Solution to: Company and contact number field not updated during import

lock
push_pin
done
Answered
0

hey there,

last week i stumbled over this problem, for which since several years (i found 2) bugs/wishes/FAQ exists:

https://community.superoffice.com/en/Issue-Center/Product-Issue/?bid=16858

https://community.superoffice.com/en/product-releases/bugs-wishes/product-issue/?bid=40452

https://crm.superoffice.com/scripts/customer.fcgi?_sf=0&custSessionKey=&customerLang=en&noCookies=true&action=viewKbEntry&id=113017

the FAQ is not really satisfying, especially through this sentence: "The Number field is not allocated automatically due to SuperOffice system design." ..hey, system design has never been a limit for programmers :D

so i tried on my own.

for those who can access their database directly with Microsoft SQL Server Managment here is a simple provisional solution, i run every time after an import:

declare @cnumber int, @cindex int, @ccount int, @pnumber int, @pindex int, @pcount int

SELECT top(1) @cnumber =currentValue FROM CRM7.REFCOUNTS where RefCounts_id=2
SELECT top(1) @pnumber =currentValue FROM CRM7.REFCOUNTS where RefCounts_id=3
SELECT top(1) @cindex =contact_id FROM CRM7.CONTACT where number2=''
SELECT @ccount =count(contact_id) FROM CRM7.CONTACT where number2=''
SELECT top(1) @pindex =person_id FROM CRM7.PERSON where person_number=''
SELECT @pcount =count(person_id) FROM CRM7.PERSON where person_number=''

UPDATE CRM7.REFCOUNTS SET currentValue = (@cnumber + @ccount) WHERE RefCounts_id=2
UPDATE CRM7.REFCOUNTS SET currentValue = (@pnumber + @pcount)  WHERE RefCounts_id=3
UPDATE CRM7.CONTACT SET number2 = contact_id + (@cnumber - @cindex + 1) WHERE number2=''
UPDATE CRM7.PERSON SET person_number= person_id + (@pnumber - @pindex + 1)  WHERE person_number=''

this code just simply fills the empty number field for all companies and contacts, and updates the allocation number.

works very well for me, so i hope this helps other too.

 

 

 

 

10 Jun 2020 | 12:00 AM

All Replies (0)

Add reply