Updating fields in formula after @compose?

I am trying to compose a new document and set some fields to initial settings but none of the field changes are reflected when the new document opens. Wondering if I’m missing something on how to update a newly composed form fields from a formula.

Code follows below:

TACT_temp_Customer := Customer;

TACT_temp_Revenue := Product_Revenue;

TACT_temp_Siebel := Opportunity;

TACT_temp_Qtr := ASFT_Forecast_Quarter;

TACT_temp_Product := Product;

TACT_temp_POT := POT_Status;

TACT_temp_POC := POC_Status;

TACT_temp_Other := Other_Event_Status;

@Command([CloseWindow]);

@Command([Compose]; “”:“”; “opty”);

Customer := TACT_temp_Customer;

Revenue := TACT_temp_Revenue;

Siebel := TACT_temp_Siebel;

Quarter := TACT_temp_Qtr;

Product := TACT_temp_Product;

TI_Record := “√”;

Last_Tech_Insight_Update := @Date(@Today);

Subject: That won’t work…

Is there a reason that you must have the code as Formula, and not in Lotusscript?

I would write that in Lotusscript, about the same number of lines.

Dim session as New NotesSession

Dim ws as New NotesUIWorkspace

Dim uidoc as NotesUIDocument

Dim newdoc as NotesDocument

Dim temp as String

Set uidoc = ws.CurrentDocument

'*** Create new backend document

Set newdoc = New NotesDocument(session.CurrentDatabase)

'*** Set form name based on form of old (saved)document

newdoc.Form = uidoc.Document.Form(0)

'*** Copy all values from old to new document

temp = uidoc.FieldGetText(“Customer”)

Call newdoc.ReplaceItemValue(“Customer”, temp)

temp = uidoc.FieldGetText(“Revenue”)

Call newdoc.ReplaceItemValue(“Revenue”, temp)

…etc…

'*** Set specific values on new document

Call newdoc.ReplaceItemValue(“LastUpdated”, Now())

Call ws.EditDocument(False,newdoc)

Subject: Thanks - I had come to that conclusion

No particular reason not to use an agent. I started thinking it was simple to use a formula and just was curious if this is doable.

Thanks for the reply.