Sales Order Acknowledgment (Print with Routing)

Yes, that is true, as long as the SSRSEnableRouting = true…
Knowing it completed, would be a nice to have :slight_smile:

Any advise as how to achieve this?

You can monitor the SysTask table

1 Like

Good Plan I like it, But How do I access the SSRSEnableRouting to determine if it was true?
Can I track a report being printed and the SSRSEnableRouting = true in a BPM process?
If so where?

1 Like

The following should work

Standard Data Directive on table SysTaskParam

Query for Condition to check for ReportID=OrderAck AND StyleNum=desired stylenum AND SSRSEnableRouting = true

image

  • Three instances of the ttSysTaskParam table
  • The table relationships are all SysTaskNum = SysTaskNum
  • The Table Criterial are:
    • image
    • image
    • image

I used email widgets for testing, but you could replace with Exec Custom Code.

ttSysTaskParam.ParamCharacter holds the order number (in s tring format) when ttSysTaskParam.ParmName = “OrderList”

1 Like

Brilliant!!! I had no idea that was available…
Thank you I will try this out today!!

I have never linked tttables together in Code before.
Would you mind showing me how?

I have linked tttables to database tables, but not tttables

You mean in the Exec Code widget to set the OrderHed field?

Yes, but specifically how to link the tttable to itself like you did above, only in the Exec Code Widget
I have never link tttables together before

Just insert addition ttSysTaskParm tables. You’ll get a warning that the first dup needs to be re-named ttSysTaskParam1, and then the 2nd will be ttSysTaskParam2.

Add the links, and then add table relations

Repeat for the link from ttSysTaskParam1 to ttSysTaskParam2

1 Like

My apologies for the misunderstanding…

How do you link to tttables together in Custom Code?

foreach (var ttSysTaskParam_iterator in (from ttSysTaskParam_Row in ttSysTaskParam
                                   where (string.Equals(ttSysTaskParam_Row.RowMod, IceRow.ROWSTATE_ADDED, StringComparison.OrdinalIgnoreCase))
                                   select ttSysTaskParam_Row))                           
           
    {   
      var ttSysTaskParamRow = ttSysTaskParam_iterator;

}

You don’t really have to link tables in code. That linking in the query was needed because the desired info was in different records within the same ttTable. But there was no way to select them in groups like the query did.

So are you saying I cannot do it in code?
I need to pull information from the tttable like the email and cc email it was sent to and the user who sent it
to update to the order header.
I have had need to link tttables in the past but couldn’t find any information on how.

Well in this situation, it looks as though I could do separate Custom Code for each one of these and update to a variable each time and then do a final custom code to update the OrderHead text field at the end, but use your idea for the beginning condition.

I think I can make this work, however if you have any info on how to link ttTables in Custom Code for future , I would appreciate the knowledge.

Thank you for taking the time to help me! I appreciate it a lot!!

The end goal is to set a UD field in OrderHed after the order is printed with a specific style AND routing is enabled, correct?

So the last piece you need is the custom code block to update the OrderHed field, correct?

Here’s what I have:

image

  1. The Condition is the same as posetd above

  2. I created two variables OrdList and OrdNum
    image

  3. Set the OrdList variable

ttSysTaskParam
.Where( r =>r.ParamName == "OrderList")
.Select( r =>r.ParamCharacter)
.DefaultIfEmpty("Not Found")
.FirstOrDefault()
  1. Set the OrdNum Variable
 Convert.ToInt32(OrdList)
  1. Custom Code Block (code via @Aaron_Moreng (link to post)
//This code will update the JE_JobNum_c on OrderHed
//this uses a technique called LINQ (Language Integrated Query) to have SQL-like syntax in C#

//Define your tables that we will reference below
//Ice/Erp tables can look like this
//the first part is the type, the second is the variable name
Erp.Tables.OrderHed OrderHed;

//now we are going to look for the OrderHed record that matches this variable OrdNum. Make sure to also search by company, like any SQL query. The Session object is good for this. 
//this will select, in this case, a single ShipHead record from the database

OrderHed = (from OrderHed_row in Db.OrderHed
where OrderHed_row.Company == Session.CompanyID && OrderHed_row.OrderNum == OrdNum
select OrderHed_row).FirstOrDefault();

//if the record is not null, we will continue
if(OrderHed !=null)
{
  //now we will set the field on the OrderHed record
  OrderHed.JE_JobNum_c = "PRNTD";
}

Yes, however you have led me to learn the following.

ice.SysTaskParam = gives me the parameter info
ice.sysTaskLog = lets me know if it had an error
ice.SysRptLst = Gives me the Email info, User, Time and Render Format

I do know the code to update the OrderHed…
Just trying to figure the timing since this is a data method…

So technically I can get every thing I need from ice.SysRptLst and ice.sysTaskLog

If ice.sysTaskLog.IsError = false and (ice.SysRptLst.EmailTo or ice.SysRptLst.EmailCC or ice.SysRptLst.EmailBCC <> “”)
then update the OrderHed.UD_textfield

UPDATE: Just realized the OrderNum only exists in the ice.SysTaskParam table -
ParamInteger
Where ParamName = “OrderNum”

and I am wondering if can I link to an ice table in custom code (not sure if its different than a db.table join)

I guess it depends on which table is populated first.
My DataMethod would then need to be on the table updated last.

Mercy, every time I think I have got it, I run into another problem lol! :rofl:

One thing to keep in mind is that the records in those Ice.Sys… tables might not exist very long. It is possible that the SysTaskParam records are deleted before you get a chance to use them. Or that the records in those tables don’t exist at the same time.

Yes, I agree with you.
However in this case the information resides for one day and then purged.
SysRptLst is the last of the 3 tables to be populated it seems.
So I am able to capture the needed information and Update the OrderHed.
I will post the completed project below.

Thank you again, I couldn’t have got there without your help!

Here is my Completed Project.

and the Custom Code to Update the OrderHed

Ice.Tables.SysTaskParam TaskParam;
Erp.Tables.OrderHed OrderHed;
foreach (var ttSysRptLst_iterator in (from ttSysRptLst_Row in ttSysRptLst
                                   where (string.Equals(ttSysRptLst_Row.RowMod, IceRow.ROWSTATE_ADDED, StringComparison.OrdinalIgnoreCase) || string.Equals(ttSysRptLst_Row.RowMod, IceRow.ROWSTATE_UPDATED, StringComparison.OrdinalIgnoreCase))
                                   select ttSysRptLst_Row))                           
             

    {   
  
  
      var ttSysRptLstRow = ttSysRptLst_iterator;
      
      
      TaskLog = (from SysTaskLog_Row in Db.SysTaskLog
                    where  (SysTaskLog_Row.SysTaskNum == ttSysRptLstRow.SysTaskNum )
                    && SysTaskLog_Row.MsgText.Contains("Email")
                    select SysTaskLog_Row).FirstOrDefault();
      
      TaskParam = (from SysTaskParam_Row in Db.SysTaskParam
                    where  (SysTaskParam_Row.SysTaskNum == ttSysRptLstRow.SysTaskNum )
                    && SysTaskParam_Row.ParamName == "OrderNum"
                    select SysTaskParam_Row).FirstOrDefault();
      
      OrderHed = (from OrderHed_Row in Db.OrderHed
                      where string.Compare(OrderHed_Row.Company, ttSysRptLstRow.Company, true) == 0
                      && OrderHed_Row.OrderNum == TaskParam.ParamInteger
                      
                      select OrderHed_Row).FirstOrDefault();
                       
      
      
      
        if (ttSysRptLstRow != null && TaskLog.IsError == false);
        
        OrderHed.SO_AckLog_c = OrderHed.SO_AckLog_c + "SO_AckDate: " + ttSysRptLstRow.CreatedOn + " -User: " + ttSysRptLstRow.UserID +  " -EmailTo:" +ttSysRptLstRow.EMailTo + " -EmailCC: " + ttSysRptLstRow.EMailCC + " -EmailBCC: " + ttSysRptLstRow.EMailBCC+ " -Format: " + ttSysRptLstRow.SSRSRenderFormat + Environment.NewLine ;
      
      }

I emailed the SalesOrderAcknowledgement twice to see the results

4 Likes