I have the following code behind an action button which has stopped the execution of my field level input validation. Can anyone tell me why?
add_info := @Prompt([OkCancelEdit]; “Additional Information”; “Please enter any additional information.”; " ");
SendTo := Assignees;
FIELD SaveOptions := SaveOptions;
@SetField(“Comments”; add_info);
@If(@Prompt([YesNo];“Send memo?”;“Are you ready to send this message?”);@MailSend(SendTo;DocAuthor;“”;“!!! IMPORTANT - Task Assignment.”;“”;“The attached task has been assigned to you for completion: " + @NewLine + @Name([CN];Requestor) + " is requesting the assigned task to be completed by " + @Text(reqDueDate)+”." + @NewLine + “Please click on the enclosed doclink to review the assigned task.—> “;[IncludeDoclink]);@Return(””));
Subject: Why are you using the “SaveOptions” field? You do not need it.
I would rewrite your formula as follows.
FIELD Comments := @Prompt([OkCancelEdit]; “Additional Information”; “Please enter any additional information.”; " ");
@If(@Prompt([YesNo];“Send memo?”;“Are you ready to send this message?”); “”; @Return(“”));
@If(@Command([FileSave]); “”; @Return(“”));
REM “If input validation passes…”;
@MailSend(Assignees; DocAuthor; “”; “!!! IMPORTANT - Task Assignment.”; “”; “The attached task has been assigned to you for completion: " + @NewLine + @Name([CN];Requestor) + " is requesting the assigned task to be completed by " + @Text(reqDueDate)+”." + @NewLine + "Please click on the enclosed doclink to review the assigned task.—> "; [IncludeDoclink]);
Thanks Bill,I tried your code too but it won’t validate either. I have found out that its my first @prompt which is being thrown before validation. Its not supposed to happen until after validation. Thanks in advance for any help.
Angie
(My problematic code)
add_info := @Prompt([OkCancelEdit]; “Additional Information”; “Please enter any additional information.”; " ");
SendTo := Assignees;
FIELD SaveOptions := SaveOptions;
@SetField(“Comments”; add_info);
@If(@Prompt([YesNo];“Send memo?”;“Are you ready to send this message?”);@MailSend(SendTo;DocAuthor;“”;“!!! IMPORTANT - Task Assignment.”;“”;“The attached task has been assigned to you for completion: " + @NewLine + @Name([CN];Requestor) + " is requesting the assigned task to be completed by " + @Text(reqDueDate)+”." + @NewLine + “Please click on the enclosed doclink to review the assigned task.—> “;[IncludeDoclink]);@Return(””));
I’ve changed my code to the following at your suggestion. Unfortunately its still throwing the prompt with empty fields.
Thanks,
Angie
@If(@IsValid;“”;@Return(“”));
add_info := @Prompt([OkCancelEdit]; “Additional Information”; “Please enter any additional information.”; " ");
SendTo := Assignees;
FIELD SaveOptions := SaveOptions;
@SetField(“Comments”; add_info);
@If(@Prompt([YesNo];“Send memo?”;“Are you ready to send this message?”);@MailSend(SendTo;DocAuthor;“”;“!!! IMPORTANT - Task Assignment.”;“”;“The attached task has been assigned to you for completion: " + @NewLine + @Name([CN];Requestor) + " is requesting the assigned task to be completed by " + @Text(reqDueDate)+”." + @NewLine + “Please click on the enclosed doclink to review the assigned task.—> “;[IncludeDoclink]);@Return(””));
Are you using the Input Validation objects to validate, or are you validating in the QuerySave? The QuerySave won’t fire until the [FileSave] is called.
I don’t get it, then. The @Return(“”) should stop the action before anything else is called. Could it be the case that you’re using @IsDocBeingSaved in your validation formulas? If so, there’s no way to keep anything from happening until after the save is called, and your prompts come before the [FileSave].
Stan you were right on with the @IsDocBeingSaved. I’ve made the changes and now validation works but my @mailsend isn’t.
Here’s my code now. Thanks!
Angie
@If(@IsValid;“”;@Return(“”));
add_info := @Prompt([OkCancelEdit]; “Additional Information”; “Please enter any additional information.”; " ");
SendTo := Assignees;
FIELD SaveOptions := SaveOptions;
@SetField(“Comments”; add_info);
@If(@Prompt([YesNo];“Send memo?”;“Are you ready to send this message?”);@MailSend(SendTo;DocAuthor;“”;“!!! IMPORTANT - Task Assignment.”;“”;“The attached task has been assigned to you for completion: " + @NewLine + @Name([CN];Requestor) + " is requesting the assigned task to be completed by " + @Text(reqDueDate)+”." + @NewLine + “Please click on the enclosed doclink to review the assigned task.—> “;[IncludeDoclink]);@Return(””));