Developing Contextual Embeddable Pagelets

This section discusses how to develop contextually relevant pagelets that you embed in transaction pages.

  1. Create an embeddable pagelet using Pagelet Wizard.

    See Understanding Pagelet Wizard Pagelet Types.

  2. Create a transaction page definition using Application Designer.

    See Creating New Page Definitions.

  3. Place an HTML area on the page definition.

    See Inserting HTML Areas.

  4. Write a PeopleCode function and map the pagelet parameters with any available values from the component buffer.

This PeopleCode example uses application packages to create an embeddable pagelet.

 /* Import the Pagelet Wizard application package to create the embeddable pagelet*/
      import PTPPB_PAGELET:*;
       import PTPPB_PAGELET:UTILITY:*;
           Component object &Pagelet, &myDataSource;

           /* Create the Pagelet Wizard application pakage and assign the pagelet ID*/
           &PWAPI = create PTPPB_PAGELET:PageletWizard();
           &PageletID = "EMBEDED_PAGELET";

           /* Get the pagelet's pointer by passing the pagelet id*/
           &Pagelet = &PWAPI.getPageletByID(&PageletID, False);
           &myDataSource = &Pagelet.DataSource;

           /* Set the pagelet parameters to default values*/
           &Pagelet.PopulateInputsWithDefaults();

           /* Read the pagelet parameters */
           &DSParamColl = &myDataSource.getParameterCollection();
           &CollectionParamArray = &DSParamColl.getCollectionAsArray();

           /* To override the pagelet parameter default values, */
					/*	 read the CollectionParamArray and set the parameter values */
					/*  from the component buffer based on the business requirement */
           If &CollectionParamArray.Len > 0 Then
            For &i = 1 To &CollectionParamArray.Len
              If (&i = 1) Then
                &DSParameter = &CollectionParamArray [&i];
                &CollectionParamArray [&i].value = PSOPRDEFN.OPRDEFNDESC;
              End-If;
            End-For;
           End-If;

           /* Get the Embeddable Pagelet HTML */
           &PgltHTML = &Pagelet.Execute();

           /* Associate the Pagelet HTML with the HTML Area */
           PSUSRPRFL_WRK.HTMLAREA = "<div class='PSTEXT'>" | &PgltHTML | "</div>";