Skip to content

Purchase Request Include Screen

Key Lesson: Create an Include screen with an input variable, bind request data to controls, and render related purchase request items.

Create the PurchaseRequestInclude Screen that parent Screens can reuse to display and edit purchase request data. The Screen receives a PurchaseRequest object as an input instead of creating its own request.

  1. In Design, under Object Types, select Screen.
  2. Select +.
  3. Enter PurchaseRequestInclude as the Screen ID, then select OK.
  4. Leave the default text component in place temporarily so that the main content area remains populated while you remove the layout wrapper.
  5. Save your changes before continuing.

Insight

An Include Screen is designed to be embedded in other Screens. The PurchaseRequestInclude name follows the [ScreenName]Include convention and identifies the Screen as the reusable purchase request interface.

The parent Screen already supplies MainLayout. Remove this wrapper from the Include Screen so that embedding it does not create a second application header and sidebar.

  1. Locate the Screen Purchasing.MainLayout label in the layout editor.
  2. Click the label to select the MainLayout component.
  3. Confirm that only the MainLayout component is highlighted and that none of its child components are highlighted.
  4. Right-click the selected component and select Delete & keep children.
  5. Confirm that Screen Purchasing.MainLayout is no longer displayed.
  6. Confirm that the Content Area components together with their children remain in the layout editor.
  7. Save your changes before continuing.

Tip

If you delete the wrong component and have not saved the change, press F5 once or close the editor without saving to restore the last saved version. This discards every unsaved change in the Screen.

Create the input that receives a purchase request from the parent Screen.

  1. Open the Variables tab.
  2. Select + Add new variable.
  3. Configure the variable as follows:
PropertyValuePurpose
NamerequestIdentifies the variable used by this Screen's bindings.
ContextInputAllows a parent Screen to pass the request into this Include Screen.
Type
This.PurchaseRequest
Matches the PurchaseRequest Entity created in the previous stage.
Default expression(Leave blank)The parent Screen supplies the value.
  1. Save your changes before continuing.

  1. Return to the Layout tab.
  2. In the VARIABLES panel, expand request.
  3. Drag request.costCenter into the main content area and drop it on the green placeholder.

Editor Help

When dragging a component or variable onto a screen, Lowgile displays a green placeholder indicating where the element can be dropped.

  1. Select the generated dropdown and configure it as follows:
PropertyValuePurpose
LabelCost CenterIdentifies the value for the user.
Binding
screen.request.costCenter
Reads and updates the Cost Center on the request received from the parent Screen.
  1. Delete the temporary text component. Leave the top-right content area unchanged; it does not need to be removed for this Screen to work.
  2. Leave all other properties at their default values.

  3. Save your changes before continuing.

If this does not happen:

If request does not appear in the Variables panel after it has been saved, press F5 once to reload the Screen editor. If costCenter is still missing, compare the variable type with This.PurchaseRequest and verify the Entity in Create Purchase Request Entities.

Create one vertical outer layout for the Cost Center control, the purchase request item collection, and the Add Item action.

  1. Select the Cost Center dropdown and choose Wrap with Layout. Alternatively, add a Layout to the main content area and move the dropdown into it.
  2. Set the outer Layout’s Layout property to vertical in one column.
  3. Select the Cost Center dropdown inside the outer layout and wrap it in a second Layout.
  4. Set the inner Layout’s Layout property to horizontal in one row. This prevents the dropdown from expanding to the full width of the outer vertical layout.
  5. Confirm that the horizontal layout contains only the Cost Center dropdown and remains inside the outer vertical layout.
  6. Leave all other properties at their default values.

  7. Save your changes before continuing.

Editor Help

For faster layout editing, see Screen Editor Shortcuts.

The items relationship is exposed as a collection on screen.request. Render that collection with a For Loop so that each purchase request item has its own set of controls.

  1. In the VARIABLES panel, expand screen → request.
  2. Drag items[] into the outer vertical layout, below the horizontal Cost Center layout.
  3. Lowgile creates a For Loop and a Data Table. Delete the Data Table; this tutorial uses the For Loop.
  4. Select the For Loop and verify these properties:
PropertyValue
Array expression
screen.request.items
Loop variableitem
Loop variable type
This.PurchaseRequestItem

Attention

The For Loop must be a direct child of the outer vertical layout, not a child of the horizontal Cost Center layout.

If this does not happen:

If items[] is unavailable, verify both directions of the relationship in Define the Purchase Request Relationship before continuing.

When the For Loop is selected, its item variable represents the current PurchaseRequestItem.

  1. Select the For Loop.
  2. In the VARIABLES panel, expand item.
  3. Drag description, quantity, budgetAmount, and currency into the For Loop’s content area.
  4. Configure the generated controls as follows:
VariableLabelControl settingValue
descriptionDescriptionBinding
item.description
quantityQuantityBinding
item.quantity
budgetAmountBudget AmountBinding
item.budgetAmount
currencyCurrencyBinding
item.currency
currencyCurrencyOptions list sourceStatic Entity
currencyCurrencyOptions list StaticEntityPurchasing.Currency
  1. Leave all other properties at their default values.

  2. Save your changes before continuing.

Attention

Bind each control to the loop-scoped item variable. A binding to the full screen.request.items collection does not identify the current item.

  1. Add a Button below the For Loop and keep it outside the loop.
  2. Configure the button as follows:
TabPropertyValue
PropertiesPrefix iconadd
PropertiesTextAdd Item
AppearanceColorPrimary
Events → ClickAction type → Ad-hoc action
screen.request.items.push(new This.PurchaseRequestItem)
  1. Wrap the button in a horizontal Layout directly below the For Loop.
  2. Leave all other properties at their default values.

  3. Save your changes before continuing.

The action adds an empty PurchaseRequestItem to screen.request.items. The For Loop then renders controls for the new item.

  1. In Design, open PurchaseRequestInclude.
  2. Confirm that its request variable uses Input context and type This.PurchaseRequest.
  3. Confirm that the Screen does not contain its own MainLayout wrapper.
  4. Confirm that the Cost Center dropdown binds to screen.request.costCenter and the For Loop uses screen.request.items.
Expected result:

PurchaseRequestInclude accepts a This.PurchaseRequest input, contains no MainLayout wrapper, and binds its Cost Center and item collection to that request.

If this does not happen:

If a value differs, compare the input, bindings, collection, and layout configuration above before continuing.