Link to home
Start Free TrialLog in
Avatar of damoncwk
damoncwk

asked on

somes codes are executed while some are not

Hi,
I use the following formula for a button
however only the mailsend line is executed
all other fields keep their original content rather than the assigned one from the
following codes. I guess it does not matter with the type of the
fields since I can set the field contents of same fields using same codes
for another button.
Any clues?
thanks!!!

FIELD bstatus :="approved";
FIELD status := "Registered";
@MailSend(user;ITuser;"";"Your PPCR is approved" ;"";"Your PPCR is approved.";[IncludeDoclink]);
@SetField("MAIL_SEND"; "Y");
FIELD regHis :=  "On " + @Text(@Now) + ", " + @Name([CN];@UserName);
FIELD regStatus :=  "On " + @Text(@Now) +",  " + @Name([CN];@UserName);
@Command([FileSave]);
@PostedCommand([OpenFrameset];"Sales")
Avatar of RanjeetRain
RanjeetRain

Are these fields computed or computed for display type? That may be the case.
Avatar of damoncwk

ASKER

Hi,
They are all editable fields.

I have tried something different and noted that
if I add a text field A beside the button

the button will set the content of field B to be that of field A
If i fill in field A then in addition to the mail being sent out
field B is also set to the value of field A.
If I delete field A and the button set
the content of B to some hardcoded string then
only the mail is sent out but the content of field B remains its original value.
The document has been saved already, before sending the mail ?

I've pasted this code in a test appl.  and for me, it works fine (except that I can't open the frameset, of course)
I do have some problems getting the mail delivered : this only works if I save the document first ....

If you use R6, you can detect an error in the mailsend command like this :
@iferror(@MailSend(user;ITuser;"";"Your PPCR is approved" ;"";"Your PPCR is approved.";[IncludeDoclink]);@return( @prompt([ok];"error";"Error sending mail"));

Maybe change @command([filesave]) to @postedcommand([filesave]) ?

cheers,

Tom
I still encounter the same problem even if I create a new
button and paste the code to the new button.
is there any possible causes?
Thanks!
Yes, there are possible causes :

- the value of the fields is changed somewhere else (querysave event, field translation, computed fields)
- the user can't edit the document (rights ?)
- the document is not in Edit mode

cheers,

Tom
Hi Tom,
How can I set a form in edit mode when I open it from a document link in mail
or from a view?
Basically i want to open it in edit mode based on the user role.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of RanjeetRain
RanjeetRain

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial