Skip to content

Instantly share code, notes, and snippets.

View jsmpros's full-sized avatar

jsmpros jsmpros

View GitHub Profile
@jsmpros
jsmpros / PeopleCodeStreamReading.js
Created January 8, 2025 03:16
Read a JSON stream from a REST service through Apache HttpClient
var result = (function () {
// HC Client Types
var HttpClients = Packages.org.apache.http.impl.client.HttpClients;
var HttpGet = Packages.org.apache.http.client.methods.HttpGet
var JsonClass = Packages.jakarta.json.Json;
var START_OBJECT = Packages.jakarta.json.stream.JsonParser.Event.START_OBJECT;
// PeopleCode Types
var CreateSQL = Packages.PeopleSoft.PeopleCode.Func.CreateSQL;
var values = Java.to([null, null, null, null, null],"java.lang.Object[]");
@jsmpros
jsmpros / ActivityGuideURL.pc
Last active November 19, 2024 22:54
App Class to help generate Activity Guide dynamic URLs
class ActivityGuideURL
/** &id is the Activity Guide ID from the PeopleTools Activity Guide component */
method ActivityGuideURL(&id As string);
/** Optional online; Required if called from IB or AE; defaults to %Portal */
method setPortal(&portal As string);
/** Optional online; Required if called from IB or AE; defaults to %Node */
method setNode(&node As string);
/** For adding CONTEXTIDPARAMS to a URL */
method addContextItem(&key As string, &value As string);
(function() {
/* Replace id with the ID of the element that you intend to update */
var id = "PTCS_EVMAP_CFGS_PTCS_SERVICEID$0";
var el = document.getElementById(id);
/* The following is the text to enter into the field */
el.value = "JSM_DD_HIDE_PRNT";
/* Trigger any PeopleSoft-specific change handling */
@jsmpros
jsmpros / simple-rest.pc.txt
Created September 14, 2022 20:41
Simple PeopleCode example that invokes a REST GET without metadata
Local Message &resp;
Local Message &req;
Local IBConnectorInfo &connectorInfo;
Local boolean &bRet;
Local string &sJson;
Local string &sUrl;
REM ** IB_GENERIC predates REST. IB_GENERIC_REST is an alternative in later tools releases;
&req = CreateMessage(Message.IB_GENERIC);
SELECT DISTINCT PL.CLASSID
, PL.TREE_NAME
, PL.ACCESS_GROUP
FROM PS_SCRTY_ACC_GRP PL
INNER JOIN (
SELECT TREE_NAME
, TREE_NODE /* The node currently at the top of the path */
, RTRIM(REVERSE(SYS_CONNECT_BY_PATH(REVERSE(TREE_NODE), ' >> ')), ' >> ') /* Not required, but nice for troubleshooting */ PATH
FROM (
SELECT TREE_NAME
SELECT TREE_NAME
FROM PSTREEACCRECPVW
WHERE TREE_NODE = /* :1 replace with your record name */ 'PERSONAL_DATA'
@jsmpros
jsmpros / FIND_CREF_BY_URL.sql
Created February 2, 2022 16:12
Locate CREF ID by URL fragment
SELECT A.PORTAL_NAME, A.PORTAL_REFTYPE, A.PORTAL_OBJNAME
FROM PSPRSMDEFN A
WHERE REGEXP_LIKE( A.PORTAL_URLTEXT, 'c/PT_FLDASHBOARD.PT_FLDASHBOARD.GBL\?Page=PT_LANDINGPAGE&DB=HC_TL_EMP_DYN_DB')
@jsmpros
jsmpros / JSM_PT858_OJET_CFG.js
Last active July 5, 2021 18:21
PeopleTools 8.58 Oracle JET Configuration
/*
* jsmpros.com
* for demonstration purposes only
* use at your own risk
*/
(function () {
var oJetRootUrl = (function (scriptId) {
var mainUrl = /*window.strCurrUrl ||*/ window.location.href;
var parts =
mainUrl.match(/ps[pc]\/(.+?)(?:_)*?(?:\d)*?\/(.+?)\/(.+?)\/[chs]\//);
@jsmpros
jsmpros / ps_currUrl.js
Last active January 14, 2020 04:15
Navigate to Current URL including all search parameters
if(!!frames["TargetContent"]) {
/* Classic */
top.location.href = frames["TargetContent"].strCurrUrl;
} else {
/* Classic content in a Fluid WorkCenter or Activity Guide */
if(!!document.querySelector(".ps_target-iframe")) {
top.location.href = document.querySelector(".ps_target-iframe").contentWindow.strCurrUrl;
} else {
/* Standard Fluid Content */
top.location.href = strCurrUrl;
@jsmpros
jsmpros / JSM_PRIVATE_JQ.js
Created September 4, 2019 00:02
Hides jQuery from the global namespace when loaded as a module in RequireJS
// http://requirejs.org/docs/jquery.html#noconflictmap
define(['jquery'], function (jq) {
return jq.noConflict( true );
});