Have a windows script that stopped working after upgrade to SO 8.3
This does not work
Expected result is: The document dialog should open.
From where do you issue the call? What is the context?
Have you tried PostSoProtocol?
I tried this from an external vbscript:
Set app = CreateObject( "SuperOffice.Application" )If Not app Is Nothing Then app.SetSoProtocol("superoffice:document.details?document_id=0&edit" )Else WScript.Echo "Error getting application object"End If
Works for me on my latest 8.3.What version are you running and may be Tony is on to something, what is your context?/conrad
The entire script looks like this:
Sub OnCurrentSaleCreated() SaleTitle = CurrentSale.Title CurrentSale.Title = CurrentSale.Number & " - " & SaleTitle CurrentDocument.SetDefaults CurrentDocument.Sale = CurrentSale CurrentDocument.Contact = CurrentSale.Contact CurrentDocument.Person = CurrentSale.Person Application.SetSoProtocol( "superoffice:document.details?document_id=0&edit" )End Sub
When a sale gets created there is a slight change to the sale itself (add number) and then the document dialog is supposed to show.
Works fine up till 8.2 r06. But has stopped working in 8.3 (customer runs 8.3.6718.18)
Have tried PostSoProtocol and it does not work either.The difference is that the sale goes into edit mode, that does not happen when using SetSoProtocol.
If I run the protocol string from the run box in windows it works so there is no error there.If I change the script, the first time it is run I get a message saying:"Protocol handler(s) already registered for: document: (?), C_EDIT_DOCUMENT_FROM_ID newdocument: (?), C_REQUEST_NEW_DOCUMENT"
Upgraded to SO 8.3 R2
No change in behaviour.
I'm a little curious as to why you would be calling CurrentDocument.SetDefaults without setting the current document to a new document first?
I'm reminded of this post from 2006, and here is how that script looked (with one modification):
enTableDocTmpl = 130
enCtxDocumentOnly = 11
'SetContext 0, enCtxDocumentOnly ' old way
CurrentDocument.Contact = CurrentSale.contact
CurrentDocument.Person = CurrentSale.person
CurrentDocument.Project = CurrentSale.project
CurrentDocument.Header = CurrentSale.SaleText
CurrentDocument.Description = CurrentSale.SaleText
CurrentDocument.Template = GetListItem(enTableDocTmpl, 2)
Hope this helps!
I have added tfs 59557: Win: Problem opening a new document dialog from inside OnSaleCreatedThere seems to be several issues here. Much has changed between 8.2 and 8.3. 8.3 is the one we put all our efforts in.
I will look into this for the next Win 8.3 release which should be R04 after the summer vacation.
That said, on a different but not related note, the following is not supported from inside a SaleCreated message:
CurrentSale.Title = CurrentSale.Number & " - " & SaleTitle
You must use the *BeforeSave events to further change any fields for a Create/Save.It may have worked simply because the model may have been reset to dirty and will undergo an implcit Save-On-Change-Identtity at some point later on. Any way, not good practice. If it worked, you had luck on you side.
Have a nice summer vacation everyone!Conrad
There is a work-around:
Do not try to set the Current document defaults.Actually, the soprotocol will override it anyway!
This snippet works for me with my latest 8.3.:
Sub OnCurrentSaleCreated() SaleTitle = CurrentSale.Title CurrentSale.Title = CurrentSale.Number & " - " & SaleTitleApplication.SetSoProtocol( "superoffice:document.details?document_id=0&edit" )End Sub
The defaulters have changed much. Also, note that 8.3 has new OnCurrent*Defaults messages e.g OnCurrentDocumentDefaults.
Just let the SoProtocol handler do it's thing with regards to the current document.Note that I have left the CurrentSale.Title = line in. Though you will see the Sale number pre-pended to the sale name and also in the Sale dropdown of the document dialog, it is not yet saved to the database!The model will leave the Create/Edit phase in a dirty state.
I have identified the problem with the document defaulter when called from COM.It needs to know if it is on behalf of the <Application> instance or the <SuperOfficeDB> instance. My bad :-)
I got it working now.
Conrad & Tony thanks for the help.
LukDette websted bruger cookies. SuperOffice bruger primært cookies til overvågning af trafik på webstedet og optimering af indholdet. Vær venlig at fortsætte med at bruge dette websted, hvis du accepterer vores brug af cookies. Læs mere: Politik om beskyttelse af personlige oplysninger