BPM control on request date and order date

Hi,
i have a BPM to prevent user from entering request date less date order date in Sales order. it worked fine. However, this BPM block “Copy order” from functioning, reason being when we choose copy order, system always set the order date to current date, so the BPM condition become true and copy order functions cannot used.

Anyway, i can control user while “copy order” function can worked?

Try to use the SalesOrder CopyOrder directive, and force the date to be the same as the order date…then I assume the save will work after passing through your update directive.

Did not test though…

Pierre

Pierre,
how to set this in the method directive - copy order in BPM? to set the new sales order date as the old sales order date?

Do you really want the new Order to have the same date as the old order? Or was that something you thought you needed to do to keep your other BPM from blocking it?

Maybe you could add some logic to your original BPM (the one that balks at Request Dates being before the order date), so that it doesn’t execute when called from within the Copy Order process.

Calvin,
i would be appreciated if you can guide me how to ignore the condition (request date being before the order date) when running “copy order” functions. Thanks.

How are you doing the Request Date check? MD or DD? If MD on what method?

edit

I made an MD on MasterUpdate that throws an exception if you try to save an order with the OrderHed.RequestDate being before OrderHed.OrderDate.

It works fine, but doesn’t fire when using Copy Order. Isn’t that what you want?

P.S. - the order created by the Copy Order process, has:

  • OrderHed.OrderDate = Today’s date
  • OrderHed.NeedByDate = copied from old order
  • OrderHed.RequestDate = copied from old order

Calvin,
Yes. i made a MD that throws an exception if user try to save when OrderHed.RequestDate being before OrderHed.OrderDate but i don’t want it to fire when using Copy Order.

the second option of below condition caused the copy order not able to used.

Hi,
anybody can help me to resolve the above error?

As I stated above:

The order created by the Copy Order process, has:

  • OrderHed.OrderDate = Today’s date
  • OrderHed.NeedByDate = copied from old order
  • OrderHed.RequestDate = copied from old order

So copy order process is making dates that get caught by your BPM.

What do you wan they dates of the new order to default to? If setting them all to todays date is okay - and then requiring the user to update the NeedBy and Request dates - then just set them in the BPM that fires when copying an order. This should happen before SalesOrder.Update() fires.

Hi Calvin,
yes, i am okay to set all the date to todays date when copy order fire and then let the user to change the needby and request date. my problem is I do not know how to set them in the BPM that fires when copying an order like what you suggested.

i appreciated if further guidance from you to help me set it up in the BPM. Thanks in advance.

Here’s what I’ve found …

There’s no easy way to set the dates on the order created by the Copy Order function.

So Instead, I set a CallContextBPMData variable in a SalesOrder.CopyOrder / Pre-Proc BPM. Then you can check for that value in your SalesOrder.Update BPM that checks the dates.

image

Then in your Update() BPM:

image

Add another condition to check the CallContext data value:


Make sure to add the parenthesis too.

Since that Call context varible would remain active during this session of the SO Entry, we need to clear it … This can be done in the GetByID() method:

image

I added a condition so it only clears it if its is equal to the value we’re using for the check. This is so that it doesn’t mess with any other SO BPM that might use that same CallContext variable.

image

And finnaly actually clear the CallContext variable

image

2 Likes

Calvin,
You are marvelous ! it resolved my copy order problem. Again, Thanks you very much for your help.