I have a form that has an action button to submit the document to be saved and launch an agent. The button has the following formula:FIELD Status:=“Submitted”;
@Do(
@Command([FileSave]);
@Command([FileCloseWindow]))
And the WebQuerySave event of the form has the following formula to launch the agent:
@Command([ToolsRunMacro]; “(SubmitWhseDelivery)”)
The problem is that the agent does not seem to be launched. Can anyone tell me what is wrong?
The “(SubmitWhseDelivery)” agent has the following LS code:
Sub Initialize
'== Submit Document Agent
'== Submits doc for web user
'-- Declarations & Instantiate
Set s = New NotesSession
Set db = s.CurrentDatabase
Set note = s.documentcontext
path=db.filepath
'-- set to 1 to debug via msgbox at server console
debugCode=0
'-- Get Doc fields
OriginalUNID = note.DocUnid(0)
’ SendList=note.NextUserEMail(0)
’ SendListAll=note.NextUserEMail
SendList="dlebrun@corp.com"
SendListAll="dlebrun@corp.com"
WONum=note.WONumber(0)
Division=note.Division(0)
JobNum=note.GPJobNumber(0)
Delivered = note.Delivered(0)
DeliveryDate=note.DeliveredDate(0)
docAuthor=Evaluate("@Name([CN];Author)",note)
'currentUser=docAuthor(0)
currentUserEMail=note.AuthorEMail(0)
partialflag=""
'-- Build logic for e-mail
WONum=note.WONumber(0)
st=note.Status(0)
note.DateSubmitted=Now
'-- Generate WO Number
If note.WONumber(0)="-Not Assigned-" Or note.WONumber(0)="" Then Call SetWONum(db,note)
activitytag=" Warehouse Order Submitted"
Call UpdateActivity(activitytag)
MailSubject= st & ": " & WONum
MailTag="This WO has just been submitted. " & Chr(13) & Chr(13) & "Please follow link to view submitted Warehouse Order :"
AlertType="Initial"
Call SendMail_WOGroup(AlertType)
Call SendMail_Issuer(AlertType)
'== CHECK STATUS
If debugCode=1 Then Msgbox st
Select Case st
Case "Draft"
Exit Sub
Case "Submitted"
note.DateSubmitted=Now
'-- Generate WO Number
If note.WONumber(0)="-Not Assigned-" Or note.WONumber(0)="" Then Call SetWONum(db,note)
activitytag=" Warehouse Order Submitted"
Call UpdateActivity(activitytag)
MailSubject= st & ": " & WONum
MailTag="This WO has just been submitted. " & Chr(13) & Chr(13) & "Please follow link to view submitted Warehouse Order :"
AlertType="Initial"
Call SendMail_WOGroup(AlertType)
Call SendMail_Issuer(AlertType)
'Exit Sub ' if status=submitted then no need to go further
'-- look for *Cancelled* WOs and set flags/email --
Case "Cancelled"
note.Status="Cancelled"
note.DateCancelled=Now
activitytag=" Cancelled WO"
Call UpdateActivity(activitytag)
MailSubject= st & ": " & WONum
MailTag="This WO has been cancelled for the following reasons:" & Chr(13) & note.RejectReasons(0) & Chr(13) & Chr(13) & "Please follow link to view WO:"
AlertType="Initial"
Call SendMail_WOGroup(AlertType)
Call SendMail_Issuer(AlertType)
'Exit Sub
End Select
'==================================================
'-- Do the e-mail for order confirmation & arrived at warehouse
If partialflag <>"1" Then Call logStatus
'=== if DeliveryDate field is set by Warehouse Mgr then send mailer to confirm
If DeliveryDate <> "" Then
activitytag=" Delivery Date established - Warehouse Delivery Order closed"
Call UpdateActivity(activitytag)
MailSubject= st & ": " & WONum
MailTag="This WO has been delivered and closed." & Chr(13) & "Please follow link to view WO:"
AlertType="Delivered/Closed"
Call SendOrderClosedMail
End If
'=== End DeliveryDate Code
Call UpdateActivity(activitytag)
'-- If WO Number Required then generate one
If note.WONumber(0)="-Not Assigned-" Or note.WONumber(0)="" Then Call SetWONum(db,note)
MailSubject="Warehouse Delivery Order Form has been created for WO # " & WONum & "."
MailTag="Please follow the link to open/print the Warehouse Delivery Order form: "
AlertType="Delivery"
Call SendMail_WOGroup(AlertType)
Call SendMail_Issuer(AlertType)
End Sub