Can anyone point me in the right direction for how to set up a workflow to automate the running/emailing out of a custom crystal report?
Add an action to the workflow. In the action code call the etat function from aimp3.
This isn't an answer to your question, but we use a third party Crystal Report scheduler called Logicity to automatically send out reports. It allows us to convert to PDF or Excel automatically. It is simple and has worked fine for our needs. I only use the X3 workflows for email alerts like when batch tasks or imports fail.
Is this in V7?
Thanks Glen, I havent used that one, but I have used other programs like that. It is a possibility but I really wanted to get everything to automate through the system.
Glen,
I have some reports running and emailed based on the workflow as I’ve explained. What I do is I run the report as an action on the workflows start and either export it to excel or pdf. Then in the workflow I specify in the file attachment field the path to the file I just created and the workflow emails the report.
If it needs to be scheduled and not triggered through any transaction then I can use the Recurring task management and trigger the workflow.
I agree that this is only for someone that knows a little how to code in X3 and it is not fully GUI but it does the job. You can create the code once and then just call the action with parameters.
HI Glen,
I was recently doing something simular and I'm curious about how (what format) you specified the path to your file. I ran into issues with this and ended up having to use the filpath formula and even then was limited to the file being in the root, or a subfolder in the root of the current X3 folder. I'd also be intersted in more details on running the report as an action when the workflows start - you you set that up exaclty. When you mention the code, are you talking about the Call WORKFLOW(TYPEVT,CODEVT,OPERAT,CLEOBJ) from AWRK code? I'm using that as well in my code.
Thanks,
-Mike
Hi Mike,
To set the file path, add an entry point to AIMP3 and set the FICHIER variable to your desired path. In the example below I set the path and file name and I add the soh number in the file name. Use this same logic in the workflow path.
$ACTION
Case ACTION
When "IMPRIME" : Gosub IMPRIME
Endcase
Return
$IMPRIME
If ETAT = 'MyReportName' and DESTINATION = 4 Then
FICHIER = "C:\tmp\" + [F:SOH]SOHNUM + "_created.xls"
Endif
Return
Regarding the action start, in the last tab of the workflow just select an action and specify to run at start. On the bottom enter the parameters. The action is going to call etat from aimp3
The answer is yes to running the workflow from code
Thanks,
Israel
Hi All,
I have similar kind of requirement.
Default Purchase Order Workflow is enabled. After the PO Creation ,workflow mail will trigger to users for the signature,Up to this is default functionality. Additionally i needs to attach the PO report PDF along with that mail.
As advised above i created a action on the PO Workflow and call the subprogram to create the pdf on workflow start. Below is my code:
Subprog PRINTPO()
Local Integer NBPAR_MAX:NBPAR_MAX=250
Local Char TBPAR(250)(1..NBPAR_MAX)
Local Char TBVAL(250)(1..NBPAR_MAX)
Local Char RETVAL
Local Integer I(10)
Local Integer J(10)
infbox "po"+num$([M:POH0]POHNUM)
TBPAR(1)="commandedeb":TBVAL(1)=[M:POH0]POHNUM
TBPAR(2)="commandefin":TBVAL(2)=[M:POH0]POHNUM
TBPAR(3)="fournisseurdeb":TBVAL(3)=[M:POH0]BPSNUM
TBPAR(4)="fournisseurfin":TBVAL(4)=[M:POH0]BPSNUM
TBPAR(5)="sitedeb":TBVAL(5)=[M:POH0]POHFCY
TBPAR(6)="sitefin":TBVAL(6)=[M:POH0]POHFCY
TBPAR(7)="signedeb":TBVAL(7)="0"
TBPAR(8)="signefin":TBVAL(8)="5"
TBPAR(9)="datedeb":TBVAL(9)=[M:POH0]ORDDAT
TBPAR(10)="datefin":TBVAL(10)=[M:POH0]ORDDAT
TBPAR(11)="devdeb":TBVAL(11)=[M:POH1]CUR
TBPAR(12)="devfin":TBVAL(12)=[M:POH1]CUR
TBPAR(13)="avenantdeb":TBVAL(13)="0"
TBPAR(14)="avenantfin":TBVAL(14)="0"
TBPAR(15)="comsolddeb":TBVAL(15)="0"
TBPAR(16)="comsoldfin":TBVAL(16)="0"
TBPAR(17)="etatlivdeb":TBVAL(17)="0"
TBPAR(18)="etatlivfin":TBVAL(18)="0"
TBPAR(19)="etatfacdeb":TBVAL(19)="0"
TBPAR(20)="etatfacfin":TBVAL(20)="0"
TBPAR(21)="codimp":TBVAL(21)="0"
TBPAR(22)="filnam":TBVAL(22)="C:\Sage\X3V11\folders\PILOT\tmp\"+[M:POH0]POHNUM+".pdf"
Call ETAT("BONCDE2_EMAIL","FILEPDF","",0,"",TBPAR,TBVAL)From AIMP3
End
After that i created a copy of default PO report and created - BONCDE2_EMAIL
I created a specific script ZBONCDE and call this in the specific script of the BONCDE2_EMAIL report. below is my code.
Subprog IMPRIME(NBPAR,PARAMETRE)
Local Integer YTEMP
For YTEMP = 0 To 30
If [M:AIP]TBPAR(YTEMP) ="filnam"
FICHIER = [M:AIP]TBVAL(YTEMP)
FMTFIC = 29
infbox FICHIER
Break
Endif
Next
End
$ACTION
Case ACTION
When "FICHIER" : Gosub FICHIER From ZBONCDE
#When "IMPRIME" : Gosub IMPRIME From ZBONCDE
When Default
Endcase
Return
$FICHIER
#If GSERVEUR = 0
If dim(FICHIER)
Local Integer YTEMP
# Find the parameter named filnam, and override the report file name with this value
For YTEMP = 0 To 30
If [M:AIP]TBPAR(YTEMP) ="filnam"
FICHIER = [M:AIP]TBVAL(YTEMP)
Break
Endif
Next
#Endif
Endif
Return
But after creating the purchase order the pdf file is not getting created.
Even though if i call the same code from SPEPOH using the following method the file is creating
$APRES_CRE
Kindly advise how to resolve this.
Thanks
Does anyone know how to use a command to have Outlook open and send the email that way??
*Community Hub is the new name for Sage City