Hi all.
I have two forms. On form A I have an action called ‘REJECT’ which has this formula:
@DialogBox(“Dialogue” ; [AutoHorzFit] : [AutoVertFit] : [NoCancel] : [NoOkCancel] ;“Enter rejection comments here”);
FIELD ReasonForReject := “”;
I have then inserted a field on Form B called ‘ReasonForReject’ which allows the user to enter a comment. I also have a submit button on form B that sends an email out the end user explaining why there request has been rejected using the following formula:
@Command([EditDocument]; “”);@SetField(“Status”; “Rejected”);@Command([FileSave]); @MailSend(“Sunny Lea/ITDev/Lennards”; “”; “”; “Request: Status: - Rejected”; “Please note:.” + @NewLine + “Your query has been rejected by the following reason: " + ReasonForReject;”";[IncludeDoclink]);
@Command([FileSave]);
@Command([FileCloseWindow]).
The problem I am experiencing is that the status field on Form A does not change from ‘Submitted’ to ‘Rejected’.
Can anyone explain why this is happening?
Any help will greatly be apreciated.
Thanks
Sunny
Subject: RE: @Dialogue Problem
You haven’t explained what is the relationship between your two forms, but I believe that form A opens form B in a dialog (i.e. form B is really the form “Dialogue”).
Dialogbox is intended to collect information and pass it back to the original form. There’s a command to pass the information back, @Command( [RefreshParentNote] ). If you close the window, as you do in your Submit button, without calling this command, the values in the dialog do not get passed back to form A.
You did a FileSave from the dialog, so the changes will have been saved to disk. This makes the version on disk different from the version in memory that you are editing. Mistake. If you save your changes from form A now, you will have a save conflict (with yourself).
@If(@DialogBox(“Dialogue” ; [AutoHorzFit] : [AutoVertFit] : [NoCancel] : [NoOkCancel] ;“Enter rejection comments here”); “”; @Return(“user canceled!”));
_tmpReason := ReasonForReject;
_oldStatus := Status
FIELD Status := “Rejected”;
FIELD ReasonForReject := @DeleteField; REM {Why do you want to erase this? It seems like useful info to store in the document.};
@If(@Command([FileSave]);
@MailSend(... _tmpReason ...);
@SetField("Status"; _oldStatus)
)
And in the submit button:
@If(ReasonForReject = “”; @Return(@Prompt([ok]; “Need reason”; “Please fill in the reason for rejecting this perfectly reasonable request.”)); “”);
@Command( [RefreshParentNote] );
@Command([FileCloseWindow])
Subject: RE: @Dialogue Problem
Hi Andre,
Thank you for your response. Ive had a go at using your example, however Im encountering the following error: -
‘Cannot execute the specific command’.
Any ideas what is causing this?
Thanks
Subject: RE: @Dialogue Problem
This will be good practice for you in debugging formulas. See this article for some tips:Debugging Domino Applications part 1 and part 2.