Solved

somehow one line of code is skipped

Posted on 2004-04-28
5
251 Views
Last Modified: 2013-12-18
Hi,
i include the following in the formula of a button.
rejectReason is a text field name where i have put a default value as " "
after i pressed on the button a mail is sent out
however the regHis field content is not updated, i.e. it keeps its original value.
there are no error message or error log at all.
Any cluse?
Thanks!!

@SetField("regHis"; "On " + @Text(@Now) + ", " + @Author + " wrote " + rejectReason);
@SetField("regStatus"; "On " + @Text(@Now) +",  " + @Author + " rejected.");
@MailSend(user1;user2;"";"Rejected" ;"";"Rejected.";[IncludeDoclink]);
@SetField("MAIL_SEND"; "Y");
@Command([FileSave]);
0
Comment
Question by:damoncwk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 15

Expert Comment

by:Bozzie4
ID: 10937374
Stop using @setfield.  It's only useful within loops (if you use R6) or within an @do structure (R5).  @setfield requires that the field already exist, and is the cause of a lot of problems, if you don't use it correctly.
Also watch out using the @author function.  It doesn't always returns the original author.  If you want it to be the name of the current user, use @username.

Try again :

FIELD regHis :=  "On " + @Text(@Now) + ", " + @name(]cn];@username) + " wrote " + rejectReason;
FIELD regStatus :=  "On " + @Text(@Now) +",  " + @name(]cn];@username) + " rejected.";
@MailSend(user1;user2;"";"Rejected" ;"";"Rejected.";[IncludeDoclink]);
FIELD MAIL_SEND :=  "Y";
@Command([FileSave])

cheers,

Tom
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 10937381
About @setfield : if you use R6, it should also work when the field doesn't exist yet, but it remains good practice to make sure it exists :

This is the correct way of using @setfield :

FIELD MyField := MyField;
...
@setfield("MyField";"some value");
...
0
 

Author Comment

by:damoncwk
ID: 10937467
Tom,
thanks for that.
However if I do not give any value to the rejectReason field
then the mail is still sent out.
What i am trying to achieve here is that i want to make
sure the rejectReason field is being filled with content
else the mail is not allowed to be sent.

Thanks!
0
 
LVL 15

Accepted Solution

by:
Bozzie4 earned 125 total points
ID: 10938674
Aha.  Add this first line.  This will stop executiong of the formula.

@if( rejectReason = ""; @return(@prompt([ok];"Warning";"You must enter a value for rejectReason")); "") ;
FIELD regHis :=  "On " + @Text(@Now) + ", " + @name(]cn];@username) + " wrote " + rejectReason;
FIELD regStatus :=  "On " + @Text(@Now) +",  " + @name(]cn];@username) + " rejected.";
@MailSend(user1;user2;"";"Rejected" ;"";"Rejected.";[IncludeDoclink]);
FIELD MAIL_SEND :=  "Y";
@Command([FileSave])

Also use the Input Validation formula for rejectReason (Something should be a status or something :  eg. status = "rejected" ):

@if( Something & @trim(rejectReason) = ""; @failure(" please give a reason" ) ; @success )
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10938887
Try this

@SetField("regHis"; "On " + @Text(@Now) + ", " + @Author + " wrote " + rejectReason);

@SetField("regStatus"; "On " + @Text(@Now) +",  " + @Author + " rejected.");

@MailSend(user1;user2;"";"Rejected" ;"";"Rejected.";[IncludeDoclink]);

@SetField("MAIL_SEND"; "Y");

@PostedCommand([FileSave]);

~Hemanth
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question