Update the Order's Submit Date

Create an extension that uses an extensible flexfield to update the order submit date.

This topic uses example values. You might need different values, depending on your business requirements.

  1. Create an extensible flexfield.

    Attribute

    Value

    Name

    H1AttributeDateTime1

    Category

    Additional Header Information

    Context

    HeaderContext1

    For details about how to create an extensible flexfield, see Set Up Extensible Flexfields in Order Management.

  2. In the Setup and Maintenance work area, go to the task.

    • Offering: Order Management

    • Functional Area: Orders

    • Task: Manage Order Management Extensions

  3. On the Manage Order Management Extensions page, notice the elements.

    • Three tabs, one for each extension point.

    • A Sequence column. Order Management runs the extensions for each extension point sequentially according to the values in the Sequence column. For example, if the first row contains a value of 10, the second row a value of 30, and the third row a value of 20, then Order Management will run row one, row three, and then row two.

  4. On the Manage Order Management Extensions page, click Actions > Create New.

  5. In the Create Extension dialog, accept the default values, then click OK.

    The Use Existing option creates a reference to an extension that already exists. It doesn't create a copy. For example, assume an extension named My_Extension already exists on the On Save extension point. Assume you set Use Existing to My_Extension when you create an extension on the On Start of Submission Request extension point. If you modify My_Extension from On Start of Submission Request at any point in the future, then Order Management will automatically update My_Extension for On Save with your modification. If you modify My_Extension for On Save, then Order Management will update My_Extension for On Start of Submission Request.

  6. On the Create Extension page, on the On Start of Submission Request tab, enter values.

    Attribute

    Value

    Name

    Update Order Submit Date

    Description

    This extension sets the value of an extensible flexfield to the date and time when Order Management submitted the sales order.

  7. In the Definition area, add code.

    // Make sure the extension runs only for your test sales order. If more than one developers use your test environment, then this condition makes sure the code updates only your sales order. You must remove this condition in a production environment.
    def poNumber = header.getAttribute("CustomerPONumber");
    if( !"UpdateOrderSubmissionDate".equals(poNumber) ) return;
    
    // Get the current time, and then create an instance of java.sql.Date, and set it to the current time.
    long currentTime = new Date().getTime();
    def date = new java.sql.Date(currentTime);
    
    // Get the row for the flexfield context named HeaderContext1.
    def flexfieldContext = header.getOrCreateContextRow("HeaderContext1");
    
    // Set the date on the attribute named _H1AttributeDateTime1 to the current date. Use flexfieldContext to identify the flexfield context where _H1AttributeDateTime1 resides, which is HeaderContext1.
    flexfieldContext.setAttribute("_H1AttributeDateTime1", date);
  8. Click Validate > Save and Close.

Test Your Set Up

  1. Navigate to the Order Management work area, create a new sales order, then click Submit.

    Attribute

    Value

    Purchase Order

    UpdateOrderSubmitDate_run_extension

  2. Click Actions > View Additional Information.

  3. In the Additional Information dialog, click HeaderEFFDetails, then verify that the dialog displays the value.

    Attribute

    Value

    H1AttributeDateTime1

    The current date and time. For example:

    04/01/17 6:25 PM