Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Possible bug

We have created an integration for a customer who are importing sales and documents (in one operation) into SuperOffice from an external program. Due to data rights in SO we want the owner of the sale and the document to be similar. Now it is the correct owner of the sale, but the owner of the document is "crm7".

This it how It works:

Logging in with systemuser for imports called crm7,

Importing documents into SuperOffice, makes the document assosiate (in the example "AH") differs from the user who is logged on ( "crm7").

SODocument doc = SuperOfficeDatabase.AddDocument(tempfile, true, associate.Identity);

            Log("Adding document " + tempfile + " under user " + associate.Identity);

            doc.Description = "Utskriftsnummer " + tilbud.SisteUtskriftsId;

            doc.YourRef = tilbud.Id.ToString();

            doc.OurRef = tilbud.SisteUtskriftsId.ToString();

            doc.Associate = associate;


Having trouble trying opening the document from SuperOffice "path does not exist".

The document/file is under crm7-user in SO-ARC instead of AH user, and we can’t open the document.

Any good advice?


Regards Eirik

RE: Possible bug

First a comment:

> AddDocument(tempfile, true, associate.Identity);

Make sure you verify the API carefully.

AddDocument can take a Contact, Person and Project id - not an Associate id, which is what you want.

You have a use case that we do not support.
Our GUI does not allow us to change the Associate id of a document. So we probably never considered this use case.
When setting the associate id via COM, we do not Move the document. May be we should?

You may need to register a wish for this unless you find a way to move the physical document yourself.
Not sure what the side effects might be...


I have added a wish for this in tfs:
50352: COM: AddDocument on behalf of any associate.

This is now fixed in the next 8.1 release.
I have added the following methoid to IDatabase:

[id(89), helpstring("Add an existing file to the document archive on behalf of some associate, returning a new document object for the file.")]
      HRESULT AddDocumentForAssociate( [in] BSTR i_FilePath, [in] VARIANT_BOOL i_RemoveOriginal, [in] VARIANT_BOOL i_OpenCreatedDocument, [in] long i_AssociateId, [in,defaultvalue(0)] long i_ContactId,[in,defaultvalue(0)] long i_PersonId,[in,defaultvalue(0)] long i_ProjectId, [out,retval] IDocument** o_ppDoc );

Make sure you get the paramters right...

Example vb script code:

app.Database.AddDocumentForAssociate( "d:/AddThisDoc1.txt", False, False, 28 )

Will add document to associate with id 28, Not remove the original and Not open the created one.
(As if you were creating a document from the Diary in Secretary mode)

If associate id is not a known/legal associate id, an error is thrown!
If associate id is 0, logged in user will be used.


Af: Conrad Weyns 31. mar 2017

RE: Possible bug

Hi Conrad,

Thanks for your answer and the fix.

I'll guess we just have to wait for the next release then :)


Af: Eirik Wentzel Jensen 4. apr 2017