Adding PeopleCode to the Dashboard Header Page and Component

Update your page and component definition to include these PeopleCode programs:

  1. Add page Activate PeopleCode to this page that links this component to your custom application class. There is a one-to-one relationship between a dashboard header component and a custom application class. In the Activate program:

    For example:

    import MYPKG:MyBannerComp;
    
    Component MYPKG:MyBannerComp &oBanner;
    
    Local string &hp_ID = %Request.GetParameter("TABID");
    
    &oBanner = create MYPKG:MyBannerComp(&hp_ID);
    
    /* Display the current context values to the user.                          */
    /* When IsPersistContext is true, the keys exist; use GetKeyValue.          */
    /* Else, you must assign the same values as specified in SetDefaultContext. */
    If &oBanner.IsKeyExist("SETID") Then
       GetField(MY_REC.SETID).Value = &oBanner.GetKeyValue("SETID");
    Else
       GetField(MY_REC.SETID).Value = "AUS01";
    End-If;
    
    If &oBanner.IsKeyExist("DESCR") Then
       GetField(MY_REC.DESCR).Value = &oBanner.GetKeyValue("DESCR");
    Else
       GetField(MY_REC.DESCR).Value = "Default description";
    End-If;
    
    /* Required for correct rendering of the dashboard. */
    &oBanner.ApplyVisuals();
  2. If there are fields to update either on the main page or on a secondary page, add an explicit trigger field as a push button or hyperlink on the main page (even if the data entry occurs on the secondary page):

    • Add FieldChange PeopleCode to this component record field to invoke the PeopleCode API Reference: UpdateContext method: BannerTile class method, which updates the dashboard with the context data values. For example:

      import MYPKG:MyBannerComp;
      
      Component MYPKG:MyBannerComp &oBanner;
      
      &oBanner.SetKeyValue("SETID", GetField(MY_REC.SETID).Value);
      &oBanner.SetKeyValue("DESCR", GetField(MY_REC.DESCR).Value);
      
      &oBanner.UpdateContext()
    • On the Use tab of the Page Field Properties dialog box, select the Activate by Enter Key check box.