• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Cwebber42
#1 Posted : Friday, August 04, 2017 5:47:11 PM(UTC)
Cwebber42

Rank: Member

Joined: 8/4/2017(UTC)
Posts: 8
Location: Tucson AZ

Thanks: 3 times
Hey there,

I've written an integration for a client that pulls orders from multiple sources in the cloud and handles order processing, accounting data, and shipping data. My current issue is that when I push shipping data back to BVCommerce via the API (BVWebservices3 WSDL) from the customers accounting system, I don't think my change of the shipping status on the order is actually triggering the workflow to send a customer notification e-mail with the tracking information. I have also tried targeting the Workflow directly by bvin using the api but that also didn't seem to fire off the e-mail. Is there anything specific I may be missing to get these e-mails to fire off? I know the order has a package, a value in the tracking number for that package, and the customer has a valid e-mail address to target. Not sure why I can't get the e-mails to send. Any insight would be appreciated.
Aaron
#2 Posted : Monday, August 07, 2017 9:03:49 AM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,081
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 125 time(s) in 120 post(s)
Take a look at this heavily commented code sample:

http://www.bvcommerce.co...m-Options.aspx#post30543

Pay particular attention to the end where Shipping_Package_Ship is called. This call, which maps to Shipping.Package.Ship() in the Core, takes care up updating the shipped quantities for the LineItem(s) and calling the "Package Shipped" workflow. At this point, assuming your workflows are configured as stock, the "Shipping Complete" workflow will not be run and therefore the shipping email will not be sent. To do this you should run the "Shipping Changed" workflow which takes are marking the order complete (if it's paid and shipped) and running the "Shipping Complete" workflow if everything is shipped.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
 1 user thanked Aaron for this useful post.
Cwebber42
#3 Posted : Monday, August 07, 2017 1:55:28 PM(UTC)
Cwebber42

Rank: Member

Joined: 8/4/2017(UTC)
Posts: 8
Location: Tucson AZ

Thanks: 3 times
Thanks for the reply Aaron, one last quick question:

In the code snippet below, is the TaskContext crucial to the function of the workflow call, or can I leave it as an empty object?
If it is needed, what on earth do I put in the Inputs, Outputs, UserId of the TaskContext object??

Code:
;
                var workflows =  client.BusinessRules_Workflow_FindAll(ref token);
                var emailWorkflow = workflows.FirstOrDefault(wf => wf.Bvin == shipChangedWorkflowBvin);
                var tc = new TaskContext()
                {
                    
                };

                if(bvOrder.ShippingStatus == OrderShippingStatus.FullyShipped && bvOrder.PaymentStatus == OrderPaymentStatus.Paid)
                {
                    client.BusinessRules_Workflow_RunByBvin(ref token, tc, emailWorkflow.Bvin);
                }


Aaron
#4 Posted : Monday, August 07, 2017 3:52:17 PM(UTC)
Aaron

Rank: Administration

Joined: 4/2/2004(UTC)
Posts: 2,081
United States
Location: Hummelstown, PA

Thanks: 6 times
Was thanked: 125 time(s) in 120 post(s)
Originally Posted by: Cwebber42 Go to Quoted Post
...is the TaskContext crucial to the function of the workflow call, or can I leave it as an empty object? If it is needed, what on earth do I put in the Inputs, Outputs, UserId of the TaskContext object??


This is how it is handled in the BVC code:

Code:
Dim context As New BusinessRules.OrderTaskContext
context.Order = o
context.UserId = o.UserID
context.Inputs.Add("bvsoftware", "PreviousShippingStatus", o.ShippingStatus.ToString())
BusinessRules.Workflow.RunByBvin(context, WebAppSettings.WorkflowIdShippingChanged)


For your use-case I'm not sure that the Input matters, but I would still use it to be safe.

Note that you can run the workflow by its name ("Shipping Changed") or bvin ("0bd9414e-00a0-414e-8eb7-61121358a609") as these should never change. That will save you an API call. Also, I don't think you need the paid and shipped if statement. This workflow isn't actually the one that sends the shipping email; it calls the "Shipping Complete" workflow if the order is fully shipped. As for the paid status, presumably you wouldn't be shipping any packages if the order wasn't paid.
Aaron Sherrick
BV Commerce
Toll-free 888-665-8637 - Int'l +1 717-220-0012
 1 user thanked Aaron for this useful post.
Cwebber42
#5 Posted : Monday, August 07, 2017 4:04:15 PM(UTC)
Cwebber42

Rank: Member

Joined: 8/4/2017(UTC)
Posts: 8
Location: Tucson AZ

Thanks: 3 times
Awesome just what I needed to finish it off. Thank you Aaron
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2017 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012