Creating Documents |
When you hit the Write button in the CRM client, two things happen:
When you’re using these components, things are a little different:
Creating a Document object does not create the document file.
You can create the document file like this:
This will create a new document from scratch, just like the Write button in the CRM client.
You need to have set the document’s contact, person, project properties, and set the template type to something sensible. If the template type is not set, then the GenerateDocumentFile function will not know which template file to use as a basis for the new document.
This function will create a filename for you (and write it into the Document object) unless you provide a new filename+path as a parameter.
If the createMergeDraft parameter is true, then only some of the template tags are substituted. The idea is that you can use this document as a template for a second call to GenerateDocumentFile – for example if you were building your own mail-merge system.
This will copy a document from somewhere else to the SO_ARC, and create a Document object for you to represent the document.
This is like dragging a document from the desktop into the CRM client.
Remember to edit the script and replace the name and password before running.
Set db = CreateObject("SuperOfficeDB.Database") loginOk = db.Login("name","pass") if not loginOk then msgbox "Unable to log in" WScript.Quit end if Set contact = db.GetContact(2) Set doc = db.CreateDocument doc.SetDefaults doc.Contact = contact doc.Header = "This is a new document" doc.Save doc.GenerateDocumentFile MsgBox doc.FullPath, 0, "File generated"
Check the SO_ARC folder after running this script to see if the document has been created. Open it to see what values are in the document.
Up: Using SuperOfficeDB Prev: Activity Links Sub-object On Models Next: Creating Users Edit