We have recently set up a data directive BPM to notify a few lucky users of the status of the nightly MRP process run. (complete or error) Our users are like most other users; they want to see more notifications until they want to see fewer. In this case our users do not want/need to see MRP notifications generated from our test instance.
So far, I have not found a way to send BPM notifications only when they are generated by the production server. Maybe I’m missing something…
Also, I’m new to Epicor (6 months in), so don’t assume that any question is ‘too basic’.
string res = "SessionNull";
string appserv = "";
if(Session != null && Session.AppServerURL != null)
{
appserv = Session.AppServerURL.ToString();
int index = appserv.ToUpper().IndexOf("PILOT");//presence of the word Pilot in your appserver or whatever name you indicated...
if (index != -1)
{
res = appserv.Substring(index);
}
}
Okay, I understand what’s going on in the code, but I’m unsure how to refer to the ‘res’ variable to set a BPM or scalar variable or to use it in a BPM condition.
What I have done so far is to create an ‘Execute Custom Code’ step, paste in the code as-is, checking for ‘TEST’ instead of ‘PILOT’, and successfully checking syntax.
Thanks, the custom code is now setting the variable, but the first ‘if’ statement is evaluating false.
This may be a testing issue, as I process MRP with a small number of items to test the BPM. Maybe the session doesn’t work the same when processing MRP manually?
Here is the code for reference:
Sess = “SessionNull”;
string appserv = “”;
if(Session != null && Session.AppServerURL != null)
{
appserv = Session.AppServerURL.ToString();
int index = appserv.ToUpper().IndexOf(“TEST”);
//presence of the word Test in your appserver or whatever name you indicated…
if (index != -1)
{
Sess = appserv.Substring(index);
}
I am not sure, but could it be that when the MRP is run from the server, there is no session involved? As usually the session comes from the user logged in?
You may want to instantiate a new session if session is null?
Instead of looking at the session, look at the company name. I assume you set the name on the Test environment to something different than what production is.
We copy our production database over the test database on a regular basis, so the Company field will not allow us to differentiate between environments.
One other thought I had - and being new to Epicor, I don’t know if this is possible or advisable - what if we simply didn’t run MRP on non-production systems?
Test is for testing, it might be ok to run mrp on your test env. One other option could be that in the notification emails, add, as Calvin suggested, the company name in the subject. That way you could différentiate from where it came from. As soon as our copy is made we change the company with the following where the date is the backup- date and time, so we have knowledge of the DB upto date. TRAINING March 22, 2021, 15:35
@BillCox - Do you update the sysagent settings after copying Live to Test?
If you do, you can test for that by making a query type Condition widget, checking the SysAgent table where the FileRootDir contains text from your Test environments Server Ddata Directory setting.
Note that the FileRootDir field contains both the Server Data Directory and the Client Data Directory values separated by a comma. Like: \\usdcaaps00371\EpicorData_UAT,C:\EpicorData_UAT, That ends with a comma, so there might be a third bit in your system.
Presently, we are not updating anything after the copy of Live to Test. I don’t have any experience with the SysAgent, so messing with this might not be a good idea at this time.
Since we have a SQL Agent job that does the copy to Test, I added a step to the job that updates the enabled status for the directive in the BpDirective table. The directive still ran last night despite being disabled, so it seems like this approach isn’t going to work either.