Update doc on postsave

I have one simple thing to fix, but I don’t get it to work:

On postSave I have the following code:

If (uidoc.fieldgettext("CustomerName")="New Customer") Then

	If (uidoc.FieldGetText("SubmitCust")<>"sent") Then

		Call CreateNewCust(uidoc, db, session)

	End If

End If

This run on PostSave. I would like to add:

		Call uidoc.FieldSetText("SubmitCust","sent")

so that I get to “stamp” the document so I do not run the Create over and over again.

I cannot run the code on querysave because it runs eventhou field validations throws @failure and doc can’t be saved.

I understand that I can run an agent on the back-end doc that has been saved.

My problem. One document. When click on Save and all fields get validated → run an agent that creates a new doc with some info, then sets the sent-field in the UIdoc so it can’t create a new doc. But I need to set it also in the saved document. So the field is set.

whaaaa?? how do I get it to work?

Subject: update doc on postsave

Update the back end doc instead of the ui doc.

Rather than using uidoc.FieldSetText(“fieldname”, “value”) use uidoc.Document.fieldname = value.