How You Set Up User Statuses and User Transitions

Enterprise Contracts cover the standard statuses that track the progress of a contract from Draft to Approved. You can also create your business-specific user statuses and user transitions, like Legal Review or Finance Review, to closely monitor your contract stage.

Once defined, you can incorporate these statuses into the contract life cycle.

Start by creating user statuses and transitions:

  1. Navigate to the Setup and Maintenance work area.

  2. Search and select the Manage Contract User Statuses and Transitions task.

  3. Click the Add icon to add one or more user statuses and transitions.

  4. Click Save and Close.

For the user statuses to be available on a contract, you must add the custom statuses and the transitions into the event model. Event models are applied to various contracts based on the conditions specified in each event model. The event model enables you to configure the contract states, the transitions between them, and the actions performed while in each state. Event models are made up of states, events, and actions. Each state of an event model can have one or more events defined for it. Each event can have one or more actions associated with it.

Here's how you can configure an event model:

  1. Sign in to the application as a setup user.

  2. Ensure you're working in an active sandbox.

  3. Navigate to Contracts in Contract Management.

  4. Open the Tasks side panel and click Event Models in the Setup tasks.

  5. In the Events Models page, for the oracle.apps.contracts.coreAuthoring.contractService.view.ContractHeaderVO business object, click the Add icon to create a new event model or select an existing event model and click the Edit icon.

  6. Create the status, events, and actions as defined in the DefaultContractHeader event model. The DefaultContractHeader event model contains the standard configurations. You can skip the statuses that you don't want to use.

    Note: You can associate an event model with a condition. You can create event models specifically for some business units or contract types. You must define these event models with appropriate conditions so that they aren't universally applicable.
  7. Click the Initial State and configure it as defined in the DefaultContractHeader event model.

    The Initial state is a special state that enables you to initiate contract creation. The DefaultContractHeader event model has CREATE and CREATE_FROM_COPY events associated with it.

  8. Click the General State and configure it as defined in the DefaultContractHeader event model.

    The General state is a common state and any event or action defined in this state becomes available for contracts in all the states. The DefaultContractHeader event model has the Validate event that's available for a contract in all the states.

  9. Add new states based on your business requirements.

    You can create a standalone or a child of a parent state. Examples of standalone states are Draft and Canceled. A parent state is a collection of one or more child states. You can use the parent state when events or actions apply to more than one state. In the DefaultContractHeader event model, the Approved Composite state is a parent state for the Approved and Hold states. The events defined for the Approved Composite state are applicable for all the child states defined under it.

  10. Create events for every state based on your business requirements.

    Events are the transitions for a specific state. Events control the actions you can take on a contract in the application. For example, while the contract is in the Draft state, some allowable actions are Cancel, Submit for Approval, and Create Version.

  11. Create actions associated with every event. You can use the DefaultContractHeader event model to find groovy script examples associated with various events and actions.

  12. Click Save and Close.

  13. After testing these changes, publish the sandbox according to your company's business practices.

Example of Adding Legal Review as Custom Status in Event Model

Here's an example for including Legal_Review as the custom status in the event model:

  1. Create user statuses and transitions.

    1. Navigate to the Setup and Maintenance work area.

    2. Search and select the Manage Contract User Statuses and Transitions task.

    3. From the User Statuses section, click the Add icon and enter Legal_Review in the Code column and Legal review in the Name column.

    4. From the User Transitions section, Enter SEND_FOR_LEGAL_REVIEW as user transition value and Send for legal review as name.

    5. Click Save and Close.

  2. Sign in to the application as a setup user.

  3. Ensure you're working in an active sandbox.

  4. Navigate to Contracts in Contract Management.

  5. Open the Tasks side panel and click Event Models in the Setup tasks.

  6. In the Events Models page, for the oracle.apps.contracts.coreAuthoring.contractService.view.ContractHeaderVO business object, select an existing event model and click the Edit icon.

  7. In the States section, click the New icon.

    1. In the Create State window, enter Legal_Review in the Name field and click OK.

    2. Select State in the Type column.

    3. Select General in the Parent State column.

  8. In the LEGAL_REVIEW: Details section, click the New icon.

    1. In the Create Event window, select Entry in the Type field and click OK.

    2. In the Create Event window, select Named event in the Type field and enter CANCEL in the name field. Click OK.

    3. For the CANCEL event, enter StsCode=='DRAFT' in the Guard Condition column.

    4. Similarly create the SUBMIT, ACTIVATE, and VERSION events.

  9. After adding all events, click the Entry event.

  10. In the Entry section, click the New icon to add the condition that changes user status to Legal_Review.

  11. In the Create Event window:

    1. Select Groovy Script in the Type field.

    2. In the Script field enter:

      UserStatusCode='LEGAL_REVIEW';

      eventModel.execute('createHistory');

    3. Click OK.

  12. From the States section, select the DRAFT state.

  13. In the DRAFT: Details section, click the New icon.

    1. In the Create Event window, select Named event in the Type field and enter SEND_FOR_LEGAL_REVIEW in the name field. Click OK.

      Note: The event name must exactly match with the transition code added in the Manage Contract User Statuses and Transitions task.
    2. For this new event, select Legal_Review in the To State column.

  14. Click Save and Close.

  15. To test this new status, create a new contract.

  16. From the Edit Contract page, click Actions > Send for legal review.

  17. The user status for contract changes to Legal review.

Similarly, you can configure more custom user statues as per your business requirements.

How to Raise a Business Event

To configure a status change event, you must raise a business event. To raise a business event, you must first store the changes in an active sandbox. You can either create a sandbox or select an existing one and make it active.

You must activate the configuration tools you want to use in your sandbox.

Follow these steps to create and activate sandboxes for the configuration tool.
  1. Click Navigator > Configuration > Sandboxes.

  2. On the Sandboxes page, click Create Sandbox.

  3. Enter a name and description for your sandbox.

  4. In the Publishable field, select Yes or No. If you set this option as No, you can use your sandbox for testing purposes but can never publish it.

  5. Select Configure Business Objects and click Create to create the sandbox, or Create and Enter to enter or activate the sandbox after creating it.

Here are the steps to raise business events for contracts:
  1. Navigate to Contracts in Contract Management.

  2. Open the Tasks side panel and go to Event Models in the Setup tasks.

  3. In the Events Models page, select DefaultContractHeader event model and click the Edit icon

  4. In the States section, click the DRAFT.

  5. In the DRAFT: Details section, select Entry in the Type field.

  6. In the Entry section, click the New icon to add the condition that changes user status to DRAFT

  7. In the Create Event window, use Groovy scripts to raise a business event. Here's sample code, you can modify the scripts to fit your requirements.
    1. Select Groovy Script in the Type field.

    2. In the Script field enter:

      oracle.jbo.NameValuePairs plist = new oracle.jbo.NameValuePairs();

      plist.setAttribute(“contractId”, ContractId);

      eventModel.execute(`stsMgtAM').raiseBusinessEvent(plist);

    3. Click OK.

  8. Click Save and Close.

  9. To test this new status, create a new contract.