Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save joshbooker/ab9e7cf42e2e87ffcc37cbdeb390ba0e to your computer and use it in GitHub Desktop.

Select an option

Save joshbooker/ab9e7cf42e2e87ffcc37cbdeb390ba0e to your computer and use it in GitHub Desktop.

Multi Resource Scheduling Board

Event Path: AfterInitialize → setIDFromValueIn

Overview

This document traces the event flow in the Multi-Resource Scheduling Board when the form receives initial context values from another form (via context.initialValueIn).


Event Flow Diagram

Form_OnLoad
    ↓
AfterInitialize
    ↓
    [Condition Check: context.initialValueIn.ValueIn exists?]
    ↓
    YES → setIDFromValueIn
           ↓
           [Switch on context.initialValueIn.Like]
           ↓
           ├─ "JobResource.ResourceID" ────────→ SetResourceID_ValueIn → [END]
           ├─ "JobResource.ResourceIDDesc" ────→ SetResourceID_ValueIn → [END]
           ├─ "JobHead.JobNum" ────────────────→ SetJobNum_ValueIn
           └─ "MfgJobHead.JobNum" ─────────────→ SetJobNum_ValueIn
                                                   ↓
                                                GetJobResourcesList
                                                   ↓
                                                Check_ResourceList_HasRows
                                                   ↓
                                                Execute_SearchOnResource_OnSuccess
                                                   ↓
                                                AppendToSearch_CheckForDuplicate
                                                   ↓
                                                [Check for duplicate ResourceID]
                                                   ↓
                                                   NOT DUPLICATE → AppendToSearch_LndPageGrid
                                                                    ↓
                                                                 CommitDataView → [END]

Detailed Event Breakdown

1. AfterInitialize

Location: Lines 97-118
Trigger: Called from Form_OnLoad via SysAfterInitialize

Actions:

  1. Calls GetSchedulingFlags
  2. Checks condition: context && context.initialValueIn && context.initialValueIn.ValueIn
    • Success Path:setIDFromValueIn
    • Failure Path:Execute_LandingPage_Search (standard search dialog)

2. setIDFromValueIn

Location: Lines 920-967
Purpose: Route incoming context to appropriate handler based on the source form

Actions: Uses a switch statement on session.context.initialValueIn.Like to determine context source:

Branch A: Resource-Based Context

When the user navigates from a Resource-related form:

  • Case 1: "JobResource.ResourceID"
  • Case 2: "JobResource.ResourceIDDesc"

Both cases → SetResourceID_ValueIn

Branch B: Job-Based Context

When the user navigates from a Job-related form:

  • Case 3: "JobHead.JobNum"
  • Case 4: "MfgJobHead.JobNum"

Both cases → SetJobNum_ValueIn


3A. SetResourceID_ValueIn (Resource Branch - Terminal)

Location: Lines 974-985
Purpose: Directly populate the ResourceID field

Actions:

{
  "type": "row-update",
  "param": [{
    "columns": [{
      "epBinding": "KeyFields.ResourceID",
      "value": "%session.context.initialValueIn.ValueIn%"
    }]
  }]
}

Result: Updates the ResourceID search field with the passed value
Flow Ends Here


3B. SetJobNum_ValueIn (Job Branch - Continues)

Location: Lines 992-994
Purpose: Initiate resource lookup for a job

Actions:

  • Calls GetJobResourcesList event

4. GetJobResourcesList

Location: Lines 873-917
Purpose: Retrieve all resources associated with the job

Actions:

  1. REST API Call:

    • Service: Erp.BO.JobEntrySvc
    • Method: GetDatasetForTree
    • Parameters:
      • ipJobNum: Value from session.context.initialValueIn.ValueIn
      • ipStartAssemblySeq: 0
      • ipCurrentAssemblySeq: 0
      • ipCompleteTree: false
      • ipJobTypeMode: null
  2. Response Handling:

    • Maps returnObj.JobResourcesResourceList dataview
  3. On Success:

    • Calls Check_ResourceList_HasRows

5. Check_ResourceList_HasRows

Location: Lines 329-336
Purpose: Verify resources were found

Actions:

  • Condition: %ResourceList.hasRow%
    • Success:Execute_SearchOnResource_OnSuccess
    • Failure: Flow ends (no resources found)

6. Execute_SearchOnResource_OnSuccess

Location: Lines 346-350
Purpose: Iterate through all retrieved resources

Actions:

{
  "type": "dataview-condition",
  "param": {
    "expression": "ResourceList.ResourceID = ResourceList.ResourceID",
    "dataview": "ResourceList",
    "result": "matches",
    "iterativeEvent": "AppendToSearch_CheckForDuplicate"
  }
}
  • Loops through each row in ResourceList
  • For each row, calls AppendToSearch_CheckForDuplicate with the row as matches

7. AppendToSearch_CheckForDuplicate

Location: Lines 405-417
Purpose: Prevent duplicate resources in the landing page grid

Actions:

  1. Check Expression:

    trans.dataView('LandingPage').data.findIndex(x => x.ResourceID == '{matches.ResourceID}') == -1
  2. If NOT Duplicate (Success):

    • Calls AppendToSearch_LndPageGrid
    • Calls CommitDataView
  3. If Duplicate (Failure):

    • Skips to next resource (no action)

8. AppendToSearch_LndPageGrid

Location: Lines 444-447
Purpose: Add resource to the landing page grid

Actions:

{
  "type": "row-copy",
  "param": {
    "fromDataView": "matches",
    "toDataView": "LandingPage",
    "row-current-set": false
  }
}

9. CommitDataView

Location: Lines 427-438
Purpose: Persist changes to dataviews

Actions:

  1. Commits KeyFields dataview
  2. Commits LandingPage dataview

Flow Ends Here


Summary

Resource-Based Navigation

When a user navigates from a Resource form (e.g., right-click → Multi-Resource Scheduling Board):

  1. Resource ID is directly populated in the search field
  2. User can immediately view the scheduling board for that resource

Job-Based Navigation

When a user navigates from a Job form (e.g., from Job Entry):

  1. System retrieves all resources associated with the job
  2. All unique resources are added to the landing page grid
  3. User sees a list of resources involved in the job
  4. User can then proceed to view the scheduling board

Key DataViews Involved

  • KeyFields: Contains search parameters (ResourceID, StartDate, EndDate)
  • LandingPage: Grid displaying selected resources before viewing the board
  • ResourceList: Temporary storage for resources retrieved from job operations
  • TransView: Transaction view containing system state and flags

Integration Points

This flow is triggered when:

  • User clicks a related link from another form
  • Another form passes context via the app-open action with initialValueIn parameter
  • The Like property indicates the source data type (Resource or Job)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment