This topic contains 3 replies, has 0 voices, and was last updated by Aaron@MIT 7 years ago.

  • Author
    Posts
  • #9974 Score: 0

    DBlum
    • Contributions: 0
    • Level 1

    Hello all,

    I’m having an issue with a very simple workflow. All it does is run once a day to close all sales orders in a specific saved search. I’ve set it up with a saved search criteria, and one action – to set the field value of order status to closed. I’ve tried several different variations of this, but so far nothing works. I either get the workflow to run on the correct transactions, but it changes nothing, or I get an error “Invalid orderstatus reference key H.”

    Is this function possible? What am I missing?

    Thanks
    This is a cached copy. Click here to see the original post.

  • #9975 Score: 0

    DBlum
    • Contributions: 0
    • Level 1

    Maybe someone has a better way to do this?

  • #9976 Score: 0

    girieshg
    • Contributions: 0
    • Level 1

    If you want to automate this, you need to close each line on a sales order to close the order. You cannot directly change the transaction status to Closed. Plus, this kind of action will need SuiteScript… It’s up to you whether you want to use a Scheduled Script or Workflow Action script or some other type.

  • #9977 Score: 0

    Aaron@MIT
    • Contributions: 0
    • Level 1

    I made a scheduled script for exactly this purpose almost 5 years ago. The script I use is attached, since it’s too long to link below. Given it’s age, it’s still a 1.0 script, but it could be ported to 2.0 if needed. You’ll obviously have to modify the script to match your needs, search IDs, etc…

    This is a scheduled script, but can operate as a suitelet if you’d like to trigger it manually. Our version also closes two types of orders: 1) Orders that are billed, but still have some unfulfilled inventory, and 2) Orders that have reached an expiration date (a custom field we designed). You can cut out anything you don’t need. Users who have orders that are closed are then emailed to be notified of the closure, with links to the sales orders in case the user wants to do something with it afterward.

    You can also change the “testing” variable at the top to “true.” While in testing mode, the script will do everything that it normally would, except that it won’t actually close any transactions, and it will email you instead of the person assigned to the order.

    Hope this helps!

    Attached Files

    script.txt

    (17.4 KB, 1 view)

You must be logged in to reply to this topic.