I’m curious what I need to do to create a process in Epicor an attach it to the BAQ Export Process. Does anyone have a short version that I can follow?
I assume you are talking about using Process Sets w/ the BAQ Export Process?
Yes, I actually figured it out. I’ll document so others can see:
First, set up a new Process Set:
Second, create a new schedule on System Agent:
There are many schedule configurations but I did this at one minute just to verify it works.
Third, go to BAQ Export process and attach it to that schedule
Output labels creates header labels.
If you save this to a process set (second tool icon), you can attach to your schedule
If you go back to your Process Set, you can see there is an attached task on it now.
Fourth, go to Schedule Process Set and hit submit to schedule this bad boy
You can verify it go scheduled by going back to the system agent and seeing the task there now.
The query results, at least with our configuration are located on the application sever under \servername\EpicorData\Companies\ {currentCompany}\Processes\ {userWhoSubmitted}
Do you know how to define a different output folder location for the results?
You define it in the Output Filename.
Can you elaborate on that? I defined it with a file name “Company.csv” but it places the actual file in a directory that is inconvenient. I’m trying to figure out how to configure which directory it goes to.
Put the path you want the export to go to with the filename.
\\server\share\share\file.txt
Awesome, thank you!
You cannot use hidden shares however, it gets upset.
Good to know!
Why would you need a Process Set to just export one query. Or is this just an example with 1 query. I havent done this in E10 yet, but is there a reason. I do this on E9 quite a bit. Then I use powershell to grab the file and email or ftp or manipulate the data.
You can create the schedule in System Agent and define the interval.
Go to BAQ Export Process and set the parameters and set Schedule to the schedule you created.
Submit and it will be in the task agent.
I usually do this in the Manager account, so all my scheduled tasks are tied to Manager.
This is an example with one query, however I was asked to investigate how this process could be used to export 1 or more queries on a schedule.
Hey Miguel,
I have a use case for potential automating the emailing of that file after it’s exported. Would you be able to share with me the steps and code necessary to utilize Powershell to send that data?
I run the BAQ Export Process and export to a directory on the server
In this case, I have two exports and I am merging the files into one. The file is them emailed to the webites and it is also uploaded via FTP.
$Path = “\SERVER\Downloads\01027501.csv” #this is my merge file
$dir = “\SERVER\Downloads\WebInv*.csv” # this is where I export my queries
#Set Username:Password@domain/Path
$ftp = “ftp://login:password@54.83.30.101/01027501.csv”
#Merge the files into 1
get-childItem $dir | foreach {[System.IO.File]::AppendAllText($Path, [System.IO.File]::ReadAllText($_.FullName))}
#Check if file is empty
Get-ChildItem $Path | ForEach {
$check = Import-Csv $_
If ($check) {
$EMailBody = $Data | out-string
$smtp = “XX.XX.XX.XX”
$to = “USers user1@ccicms.com”, “datamaster@netcomponents.com”, “inv@sourceesb.com”, “datamaster@mectronic.com”, “inventory@america2.com”, “inventory@PartStat.com”, “inventory@mytrade.com”
$from = “Users user1@ccicms.com”
$subject = "Compass Web Inventory "
$subject += Get-Date -f MMddyyyy
#Will insert a new line at each entry
$body = " "
Now send the email using > Send-MailMessage
send-MailMessage -SmtpServer $smtp -To $to -From $from -Subject $subject -Body $body -BodyAsHtml -Priority high -Attachment $Path
########### End of Script################
"ftp url: $ftp"
$webclient = New-Object System.Net.WebClient
$uri = New-Object System.Uri($ftp)
"Uploading $File..."
$webclient.UploadFile($uri, $Path)
}
Else { return 0 }
}
If (Test-Path $Path)
{
Remove-Item $Path
}
Awesome, thank you!!
BTW, all this was found by google…found examples and merged them together. PowerShell Email file; PowerSHell FTP File; PowerShell Merge Files.
Good to know! I’ve never used Powershell but this looks very interesting…
Hello,
Does anyone know how to specify file path for hosted environments?
I tried this but I get an error.
Just give it a filename then use the File Server Download program to grab your file.
It should be under your user name if I recall correctly.
The reason they do that is you really don’t to give arbitrary Azure sites write access to your servers now, do you?
OR…you can skip the interface and just download your BAQ using PowerShell and schedule it as a Windows Task.