@DialogBox Help Please

Hi all.

I have recently used the @DialogBox formula in one of my forms…so that when a form is rejected the user is prompted to enter a reason for this decision.

As a requirement, i need to email such details to a client.

I have a form called Dialogue where i have a field called “ReasonForReject” and this is what appears in the dialogue screen for the user to input there information.

on my other form where the reject button is i have used the @mailsend formula to send the email to the user.

I know this may sound daft but how do i get it so the email displays the information regarding why a request has been rejected?

Here is the code in my reject button…

@Command([EditDocument]; “”);@SetField(“Status”; “Rejected”);

@Command([FileSave]); @MailSend(“Stabilio Genuis/IT/Company”; “”; “”; “NEW IT Request: Status: - Rejected”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “The Request project has been rejected for the following reason: " + ReasonForReject;”";[IncludeDoclink]);

@Command([FileSave]);

@If(@DialogBox(“Dialogue”; [AutoVertFit] : [AutoHorzFit]; “Rejection Reason Required…”) = 0; @Return(“”);“”);

@Command([FileCloseWindow])

Thanking you in advance

Subject: RE: @DialogBox Help Please

You have to rethink this part of the process. You’re doing things in all the wrong order. I see you sending the email before you collect the reason that should be included in the email, and saving the document with a Rejected status before collecting the information that is required when rejecting. What’s going to be done when the user refuses to provide the requested information? Are you going to un-save the document to restore the old status?

Collect the reason first, before saving. Have it in a field in the document, so that (a) the reason is stored in the document when you save, and (b) you can use the field value as part of the email message which you should send after you put up the dialog and after you save (because a save is not guaranteed to work), and (c) if the user cancels you don’t have to undo anything.

Subject: RE: @DialogBox Help Please

Hi,thanks for your response.

I see that I am doing it all in the wrong order…but its compulsory for the user to enter details for the rejection. Basically when the user selected the reject button (action button on the form) it prompts them to enter the details as it brings up the dialogue box.

I understand the useful tip you have given me but i dont know how I would go about prompting the user.

e.g. if the user selectes the reject button, how do i get the field where the user enters a comment up?

Sorry for asking a silly question, but i dont have a lot of experience using notes and so im trying to teach myself a lot of the stuff…except for when I’m stuck.

Thank you for your time

Stabilio

Subject: RE: @DialogBox Help Please

Andre is right - do the @dialogbox FIRST! If you get the reason entered correctly, then you will know you can continue before you set any other fields.

@Command([EditDocument]; “”);

answer := (@DialogBox(“Dialogue”; [AutoVertFit] : [AutoHorzFit]; “Rejection Reason Required…”);

REM {answer = 0 when user presses Cancel.};

@if(answer = 0; @return(@prompt([ok]; “No Reason Provided.” “Reason is required. Action cancelled.”)); “”);

REM {Use 2nd statement in case they click OK and don’t enter a reason, unless you have field validation on the DialogBox.};

@if(ReasonForReject = “”; @return(@prompt([ok]; “No Reason Provided.” “Reason is required. Action cancelled.”)); “”);

REM {Now you can continue on because all requirements are met.};

@SetField(“Status”; “Rejected”);

@Command([FileSave]); @MailSend(“Stabilio Genuis/IT/Company”; “”; “”; “NEW IT Request: Status: - Rejected”; “This e-mail is for FYI purposes only.” + @NewLine + @NewLine + “The Request project has been rejected for the following reason: " + ReasonForReject;”";[IncludeDoclink]);

@Command([FileSave]);

@Command([FileCloseWindow])

Subject: RE: @DialogBox Help Please

Getting warmer, but there are a couple of problems still. First, never do:

@Command([FileSave]);

@Command([FileCloseWindow])

Instead do:

@If(@Command([FileSave]); @Command([FileCloseWindow]); “”)

A save might fail – if nothing else, because the server went down. In this case, it might also be best to wait to do the mail sending until the save succeeds, so…

@If(@Command([FileSave]);

@Do(

    @MailSend(...);

    @Command([FileCloseWindow])

);

""

)

Subject: RE: @DialogBox Help Please

@Dialogbox is fine, you just have to check the return value and see whether the user canceled out of it (1 = OK, 0 = cancel). If they did, abort at that point.

(I know the @Dialogbox help says no return value, but the help is wrong in this case)