When saving a doc in an Absence DB, would like to also save Subject & Date out/return into users calendar. Simple formula below should do that but it only creates calendar doc with field defaults. Does not fill fields.***
@Command ([Compose];@MailDbName ; “Appointment”);
FIELD AppointmentType := “2”;
@SetField(“Subject”; “Vacation”);
@Command([FileSave]);
@Command([FileCloseWindow])
As you can see, I have tried both FIELD and @SetField with static text and I can’t even get this to fill fields.
Any suggestions? - thanks
Subject: @SetField doesn’t work while LS FieldSetText does. Why?
I’ve never created calendar docs with formula, only LotusScript from backend classes.
When you use @Command([Compose]), the focus is now on the new document, so none of the subsequent code (which is in an action on your existing document) gets run. Try using @UpdateFormulaContext to change the focus:
@Command ([Compose];@MailDbName ; “Appointment”);
@UpdateFormulaContext;
FIELD AppointmentType := “2”;
@SetField(“Subject”; “Vacation”);
@Command([FileSave]); @Command([FileCloseWindow])
Subject: Simply change the order:
@Do(FIELD AppointmentType := “2”; @SetField(“Subject”; “Vacation”);
@Command([FileSave]); @PostedCommand([FileCloseWindow]);
@Command([Compose];@MailDbName ; “Appointment”);
This will update the document where you are and close it and then compose the new Appointment.
Subject: RE: @SetField doesn’t work while LS FieldSetText does. Why?
Thanks so much!
I never heard of ‘@UpdateFormulaContext’ before but it sure worked like a charm.
… now, what other DB’s can I enhance by using that new info …
Subject: @SetField doesn’t work while LS FieldSetText does. Why?
Use @UpdateFormulaContext to execute the remainder of the script in the new context - that is, in the document you just composed.