Switch form using LotusScript

I need to test a field (DocumentTypeTX) and switch forms (to PricingAgreement) if the field contains"Pricing Agreement" I cannot use a form formula because there are too many existing views. I thought I could handle this in the Postopen event using the following code, but I get an “Operation Failed” error on the Evaluate statement. I get the same error in the Queryopen event.

Sub Postopen(Source As Notesuidocument)

'if DocumentTypeTX = "Pricing Agreement" then switch forms to PricingAgreement

Dim s As New NotesSession

Dim doc As NotesDocument

Set doc = source.Document

If doc.DocumentTypeTX(0) = "Pricing Agreement" Then

	Dim ret As Variant

	Dim evalstring As String

	evalstring = |@Command( [SwitchForm] ; "PricingAgreement"|

	ret = Evaluate( evalstring, doc)

End If

End Sub

Subject: Switch form using LotusScript

You can’t use @commands with evaluate.

You could try using formula language in one of the Open events

@If(DocumentTypeX = “Pricing Agreement”;

@Command([SwitchForm]; “Pricing Agreement”);

“”);

Subject: That worked - thanks!

That worked! Wow I don’t know if I have ever used Formula Language in the PostOpen event. Thanks!