Additional PeopleCode Examples
This section provides additional code examples for the Related Content Framework: Creating Service Definitions and Service Configurations.
The following PeopleCode program:
Creates a service definition (APPTEST_UGEN_SERVID).
Creates a configuration for a component (PCODEAPI_MAINCOMP_GBL).
Adds a related action to the component (REL_CONTENT Comp).
Maps the related action to a page field (0.RELCONT_PCODE.RELATED_ACT.4).
Configures the menu layout for the same page field.
import PTCS_SRVDEFN:*;
import PTCS_SERVICE:*;
import PTCS_SRVCONFIG:*;
import PTCS_MENULAYOUT:*;
Component PTCS_SRVDEFN:RCServiceDefinition &rcUgenServDefn;
Component PTCS_SERVICE:RCService &pgRFFlRcService;
Component PTCS_SRVCONFIG:RCServiceConfig &rcRFFlServConfig, &rcRAFlServConfigUGEN;
/* RCServiceDefinition creation */
&rcUgenServDefn = create PTCS_SRVDEFN:RCServiceDefinition("APPTEST_UGEN_SERVID", "ENG");
&rcUgenServDefn.ServiceName = "REL_CONTENT Comp";
&rcUgenServDefn.Descr = "RELATED_CONTENT comp as a generic PeopleSoft URL" | &sFieldName;
&rcUgenServDefn.ServiceUrlType = "UGEN";
&rcUgenServDefn.MsgNodeName = "QEDMO";
&rcUgenServDefn.PortalUrlAdm = "c/QE_RELATED_CONTENT_FRAMEWORK.RELATED_CONTENT.GBL";
&rcUgenServDefn.SecUseEdit = 1;
Local boolean &bRet = &rcUgenServDefn.Save();
/* RCService creation */
&pgRFFlRcService = create PTCS_SERVICE:RCService("EMPLOYEE", "PCODEAPI_MAINCOMP_GBL");
&pgRFFlRcService.MenuName = "QE_RELATED_CONTENT_FRAMEWORK";
&pgRFFlRcService.PnlGrpName = "PCODEAPI_MAINCOMP";
&pgRFFlRcService.SetLanguage("ENG");
&bRet = &pgRFFlRcService.Save();
/* Related actions */
/* RCServiceConfig create */
&rcRAFlServConfigUGEN = &pgRFFlRcService.AddNewService("APPTEST_UGEN_SERVID", 0);
&rcRAFlServConfigUGEN.IsCompService = "P";
&rcRAFlServConfigUGEN.PnlName = "PCODEAPI_MAINCOMP";
&rcRAFlServConfigUGEN.SeqNum = 0;
&rcRAFlServConfigUGEN.HideFromSearch = "N";
&rcRAFlServConfigUGEN.IsDefault = "N";
&rcRAFlServConfigUGEN.MapSecOptions = "P";
&rcRAFlServConfigUGEN.HandlerName = "";
&rcRAFlServConfigUGEN.InstanceLbl = "REL_CONTENT Comp";
&rcRAFlServConfigUGEN.UrlTarget = "NWIN";
&rcRAFlServConfigUGEN.MenuOpt = "N";
&rcRAFlServConfigUGEN.MainMenuOpt = "N";
&rcRAFlServConfigUGEN.nSeqNumMmnu = 0;
&rcRAFlServConfigUGEN.nSeqNumRmnu = 0;
&rcRAFlServConfigUGEN.PackageRoot = "";
&rcRAFlServConfigUGEN.QualifyPath = "";
&rcRAFlServConfigUGEN.AppClassId = "";
&rcRAFlServConfigUGEN.cInitMin = "N";
&rcRAFlServConfigUGEN.cEnable = "Y";
&rcRAFlServConfigUGEN.SrvcOpenOpt = "";
&rcRAFlServConfigUGEN.IsEmbeddable = "";
&rcRAFlServConfigUGEN.IsSingleUOW = "";
&rcRAFlServConfigUGEN.MasterTemplate = "";
&rcRAFlServConfigUGEN.AllowPersonalization = "Y";
&rcRAFlServConfigUGEN.CompEvent = "";
&rcRAFlServConfigUGEN.ProcessSeq = "";
&rcRAFlServConfigUGEN.cEnable = "Y";
&rcRAFlServConfigUGEN.AllowPersonalization = "Y";
&bRet = &rcRAFlServConfigUGEN.Save();
/* RCMapFields create */
Local PTCS_SRVCONFIG:RCMapFields &rcRAFlMapFldsUGEN = &rcRAFlServConfigUGEN.AppendMapField("0.RELCONT_PCODE.RELATED_ACT.4");
&rcRAFlMapFldsUGEN.ParameterName = "PTCS_MENUFIELD";
&rcRAFlMapFldsUGEN.PnlName = "PCODEAPI_MAINCOMP";
&rcRAFlMapFldsUGEN.MapFieldType = "PF";
&rcRAFlMapFldsUGEN.RefreshService = "N";
&rcRAFlMapFldsUGEN.MapNullValue = "N";
&rcRAFlMapFldsUGEN.FieldMenuOpt = "Y";
&rcRAFlMapFldsUGEN.SeqNumFmnu = 0;
&bRet = &rcRAFlServConfigUGEN.Save();
/* RCMenuLayout, RCMenuFolder, and RCMenuLink create */
Local PTCS_MENULAYOUT:RCMenuLayout &rcRAFlMenuLayout = &rcRAFlServConfigUGEN.AddPageFieldMenu("PCODEAPI_MAINCOMP.4", "0.RELCONT_PCODE.RELATED_ACT.4");
Local PTCS_MENULAYOUT:RCMenuFolder &rcRAFlMenuFolder = &rcRAFlMenuLayout.AddFolder("Root", Value(&rcRAFlServConfigUGEN.SeqNum));
&rcRAFlMenuFolder.PrntFolderId = &rcRAFlMenuFolder.FolderId;
Local PTCS_MENULAYOUT:RCMenuLink &rcRAFlMenuLinkUGEN = &rcRAFlMenuFolder.AppendMenuLink(&rcRAFlServConfigUGEN.ServiceId, &rcRAFlServConfigUGEN.InstanceId);
&bRet = &rcRAFlMenuLayout.Save();
%Response.RedirectURL(%Request.GetHeader("Referer"));