Link to home
Start Free TrialLog in
Avatar of rognyn
rognyn

asked on

PostSave - @MailSend Help

I can't seem to get this to work.  

The Field DTL_Node is derived from a DbLookup based on the value of another field.  I need to email notifications to selected persons depending on the value of DTL_Node, including the scenario where the Dblookup fails.

Syntactically this is correct but the email notifications don't work.

Synopsis...If TktStatus is "Closed"...end.   If Document is new...process the @If statement and send emails based on value of DTL_Node field.  Finally if If DTL_Node DbLookup fails (causing an error), send email.

Thanks in advance!!!

Here is my PostSave event Formula:  

@If(TktStat="Closed";"";@IsNewDoc;@If(DTL_Node="dknas1" | DTL_Node="grdcta" | DTL_Node="grdctb" | DTL_Node="dknas2" | DTL_Node="dknas3" | DTL_Node="whpscc";@MailSend ("Roger1/EMPL/NY/MyComp"; ""; ""; "A New Trouble Log has been created."; "A Trouble Log has been created by...  ";Orig:"  for Port ": DTL_DktDest : @NewLine : "Click here to view the Trouble Log  ----->     ";[IncludeDoclink]); DTL_Node="qns1" | DTL_Node="bnx" | DTL_Node="wst500" | DTL_Node="wst2002" | DTL_Node="wst2000" | DTL_Node="tandem2" | DTL_Node="tandem" |DTL_Node="mid1" |DTL_Node="mid2" | DTL_Node="gmtr2" | DTL_Node="pearls";@MailSend ("Roger2/EMPL/NY/MyComp"; ""; ""; "A New Trouble Log has been created."; "A Trouble Log has been created by...  ";Orig:"  for Port " : DTL_DktDest : "." : @NewLine : "     Click here to view the Trouble Log  ----->     ";[IncludeDoclink]);@IsError(DTL_Node);@MailSend ("Roger3/EMPL/NY/MyComp"; ""; ""; "A New Trouble Log has been created."; "A Trouble Log has been created by   "; Orig : "": @NewLine: "Note: The Node Lookup has failed for this circuit" : @NewLine :"     Click here to view the Trouble Log  ----->      ";[IncludeDoclink]);"");"")
SOLUTION
Avatar of HemanthaKumar
HemanthaKumar

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
ASKER CERTIFIED SOLUTION
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
SOLUTION
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
SOLUTION
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
SOLUTION
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
SOLUTION
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
Avatar of rognyn
rognyn

ASKER

First let me say thanks for all your help...
To answer some questions...the DTL_DktDest field is an editable "Use View Dialog for Choices" field.  Since it is editable the user may manually type into this field if the "proper" selection is not on the list.  The computed when composed, DTL_Node field,  uses a DbLookup based on the value of the DTL_DktDest field, when the data is typed, the Lookup fails.  So I need to account for this and send mail accordingly.  
The DTL_Node does not return multiple values, but can return a value of  "ERROR: Servor error: Entry not found in index".

I felt I needed to use @IsNewDoc because I only want e-mails sent upon creation of a new document, not upon editing or if the TKt_Stat field value is "Closed".

..as for the "progress" I'm making....I still need some assistance.  For ease...I copied and pasted the Formula "as is" into the "QuerySave" event and got 2/3 functionality..that is to say if the value of Dtl_Node is on the first or second "list comparison",  emails are sent correctly.  If the vale of Dtl_Node is an "error"...then e-mails are not being sent.  
SOLUTION
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
SOLUTION
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
In your las comment you said that the DTL_Node is computed when composed? are you sure? I think it should be computed. Please post the formula.

In the meanwhile, I think your formula for the DTL_Node resembles the following
---
try := @DbLookup( "":"NoCache"; server:database; view; value; column );
@If( @IsError( try ); "ERROR: Servor error: Entry not found in index"; try );
---
If so, then you have two choices:
1. if DTL_Node is shown and you do want the "ERROR:..." message displayed, then
     a. move the DTL_Node to an always hidden paragraph and replace the "ERROR:..." message with <<@Error>>
     b. where was the DTL_Node now put a Computed for display field, like <<DTL_Node1>>, with formula <<try := DTL_Node; @If( @IsError( try ); "ERROR: Servor error: Entry not found in index"; try )>>, for displaying DTL_Node as you like
2. if DTL_Node is (already or easily) hidden, then replace the "ERROR:..." message in with <<@Error>>
Avatar of rognyn

ASKER

Thanks again for everyones help....the Form works fine now.  The choosen fix ( as I'm sure...there was more than 1 way to fix this trouble )was to copy the SendMail formula in to the QuerySave Event and used  @Begins(DTL_Node;"ERROR") to check for the lookup failure.   All emails are correctly sent,  under the correct conditions, and they are sent only when the Document is "new.


I will split the points since I sure that HeMan's fix was also correct...initially I choose the other since copy and pasting the original formula included less editing/typing.

Thanks to both of you!!!!

Roger!