Hi,
This is for R5. I want to append a doclink to a schedule document when a button is hit on a scheduleChange document. Basically the user will compose a new scheduleChange document, and then will hit the "Submit" button.
The problem is the button code also modifies some fields in the document, which seems to conflict. originally i did this
Code:
pcDoc.status = "repApprove"
'create link to schedule
'get schedule doc
schUID$ = pcDoc.schDocUID(0)
Set schDoc = db.GetDocumentByUNID(schUID$)
Set linkItem = pcDoc.GetFirstItem("pc_schLink")
If (linkItem.Type = RICHTEXT) Then
Call linkItem.AppendDocLink(schDoc, "Click to view Schedule")
End If
Call pcDoc.Save(True, False)
This inserted the doclink fine, but then the "status" field was not updated, unless the user editted the pcDoc document. I have debugged and am sure that schDoc is not "Nothing"
Then i tried this:
Call uiDoc.FieldSetText("status", "repApprove")
Call uiDoc.Save
Set pcDoc = uiDoc.Document
Call uiDoc.FieldSetText("SaveOptions", "0")
Call uiDoc.Close
'create link to schedule
'get schedule doc
schUID$ = pcDoc.schDocUID(0)
Set schDoc = db.GetDocumentByUNID(schUID$)
Set linkItem = pcDoc.GetFirstItem("pc_schLink")
If (linkItem.Type = RICHTEXT) Then
Call linkItem.AppendDocLink(schDoc, "Click to view Schedule")
End If
Call pcDoc.Save(True, False)
The "status" field was updated, but when the document closes it prompts the user if the changes should be saved (eventhough Save has been called and SaveOptions has been set to "0")
If the user selects "No", then the doclink appears, which is fine. But if the user selects "Yes" (as most users probably would), then the doclink doesnt appear.
Any suggestions? Or any suggestions on how to add the doclink when the document is saved for the first time? Thanks!

AppendDocLink on new document save ... (Sam Welch 6.Aug.03)
. . 