Hi,I need to get values from server agent, and return them to client agent, which launched it.
My code looks like this.
//
Set docCurOrder = docUI.document
docId = docCurOrder.NoteID
Set docState1 =viewState.GetFirstDocument 'viewState contains only one document
docState1.ImportState = “no errors” ’ Text field, no multiple values
Call docState1.Save (true,false)
Set docState1 = nothing
Set B2B = curdb.GetAgent(“B2B XML server”)
B2B.RunOnServer(docId)
'After execution of some jobs agent changes ImportState field in State document:
//Server Agent body
…
docState.ImportState = ErrorsDuringTheImport
Call docState.Save(true,false)
…
Server Agent body\
'Then i need to read state field on client side to Prompt user about the errors, if there any
Call viewState.Refresh
Set docState2 =viewState.GetFirstDocument ’ using another variable for the document, just in case
Raisederrors = GetFirstItemValue(docState2, “ImportState”, 0, “” )
If Raisederrors = “no errors” Then
Messagebox ("no errors")
…actions…
Else
Messagebox (Raisederrors)
exit sub
End If\
But someway GetFirstItemValue always returns “no errors” even if ImportState field was changed from “no errors”
by server agent. Seems like docState wasn’t updated properly. But why?