メインコンテンツにスキップ
Adaptive Planning
最終更新: 2025-11-21
ai.util

ai.util

関数

方法
パラメータ
返品
説明
apply( obj, config )
  • obj: オブジェクト プロパティの受信者
  • config: Object プロパティのソース
オブジェクト
config のすべてのプロパティを obj にコピーし、obj を返します。
decodeBase64( encodedBase64 )
2018.3 で使用可能
  • encodedBase64: String
Base64 としてエンコードされた文字列。E.g. dGV4dA==
String
デコードされた Base64 文字列を返します。
テキスト
decodeHtml( encodedHtml )
2018.3 で使用可能
  • encodedHtml: String
HTML リテラルで使用するために予約文字を翻訳した文字列。{b}様[ there] > Words<
String
文字列を生の HTML で返します。
"こんばんは。<b> [ there] >ことば<!
decodeUrl( encodedUrl )
2018.3 で使用可能
  • encodedUrl: String
HTML でエンコードされた URL を含む文字列。例 https%3a%2f%2fwww.Example.com%2ffings%2f%3fid%3d123%26more%3dwords%23hash
String
生の URL を含む文字列を返します。
https://www.example.com/fings/?id=123&more=words#hash
decrypt( encryptedText )
  • encryptedText: The encrypted string that was previously generated by the ai.util.encrypt() function.
String
暗号化解除された元のプレーン テキスト文字列を返します。
ai.util.decrypt()関数は暗号化プロセスを逆仕訳し、暗号化された文字列 (通常は保存されたパスワードまたは API キー) を取り込み、元のプレーン テキスト形式に変換します。これにより、CCDS スクリプト内で の認証に使用できます。外部システムまたは API
この方法を設定するには、まずプリティ オブ プライバシー (PGP) 暗号化を設定します。参照PGP 暗号化の設定
encodeBase64( rawBase64 )
2018.3 で使用可能
  • rawBase64: String
テキストを含む文字列。例テキスト
String
テキストを Base64 でエンコードします。
dGV4dA==
encodeHtml( rawHtml )
2018.3 で使用可能
  • rawHtml: String
HTML のままの文字列。例"こんばんは。<b> [ there] >ことば<!
String
HTML リテラルで使用するために予約文字を翻訳した文字列を返します。
{b}様[ there] &gt; Words&LT;
encodeUrl(rawUrl)
2018.3 で使用可能
  • rawUrl: String
生の URL を含む文字列。例: https://www.Example.com/fings/?id=123&more=words#hash
String
生の URL をエンコードされた HTML で返します。
https%3a%2f%2fwww.example.com%2ffings%2f%3fid%3d123%26more%3dwords%23hash
encrypt( textToEncrypt )
  • textToEncrypt: 安全に暗号化するプレーン テキスト値。これは通常、後続の API 呼び出しで使用されるパスワードまたは機密情報です。
String
入力文字列の暗号化された表現を返します。この出力は、プレーン テキストではなく、機密性の高い認証情報の保存や送信に使用する必要があります。
ai.util.encrypt()関数は、提供されたプレーン テキストの文字列に (Workday Adaptive Planningプラットフォームによって管理される) 暗号化アルゴリズムを適用します。これは主にカスタム クラウド データ ソース (CCDS)スクリプトで、認証情報をインテグレーション設定の設定パラメータとして保存する前に保護するために使用されます。
この方法を設定するには、まずプリティ オブ プライバシー (PGP) 暗号化を設定します。参照PGP 暗号化の設定
format (formatString, arg1, arg2......argN )
  • formatString: 文字列 置換トークンを含む文字列。例: "{0} 件あります"
  • arg1: 文字列トークン {0} を置き換える値
  • arg2: String Etc...
String
トークン化された文字列を定義し、トークンを置き換える任意の数の引数を渡すために使用されます。各トークンは一意である必要があり、{0}、{1} などの形式で増分する必要があります。
isDate( value )
  • value: 混合 テストする値
ブール値
渡された値が JavaScript の日付オブジェクトである場合に真を返します。
isUndefined( value )
  • value: 混合 テストする値
ブール値
渡された値が '未定義' である場合に真を返します。
isDefined( value )
  • value: 混合 テストする値
ブール値
渡された値が '未定義' でない場合は真を返します。
isArray( value )
  • value: 混合 テストする値
ブール値
渡された値が JavaScript の配列である場合は真を、それ以外の場合は偽を返します。
isString( value )
  • value: 混合 テストする値
ブール値
渡された値が文字列である場合に真を返します。
isNumber( value )
  • value: 混合 テストする値
ブール値
渡された値が数値であり、有限である場合に真を返します。
isBoolean( value )
  • value: 混合 テストする値
ブール値
渡された値が真または偽の場合、真を返します。
toarray( a, i, j)
配列数式
isPrimitive( value )
  • value: 混合 テストする値
ブール値
渡された値が文字列、数値、ブール値の場合に真を返します。

//Example for ai.util.apply var sourceObj = {department:"Engineering"}; var destObj={}; ai.util.apply(destObj,sourceObj); ai.log.logInfo("Source Properties applied to Destination object: "+JSON.stringify(destObj)); // Source Properties applied to destination object: {department:Engineering} //Example for ai.util.decodeHtml var encodedHtml = "Hello &lt;b&gt; [there] &gt;words&lt;!"; var decodedvalue=ai.util.decodeHtml(encodedHtml); ai.log.logInfo("Decoded HTML is " +decodedvalue); // Decoded HTML is Hello [there] >words //Example for ai.util.encodeHtml var rawHtml = "Hello <b> [there] >words<!"; var encodedvalue=ai.util.encodeHtml(rawHtml); ai.log.logInfo("Encoded HTML is " +encodedvalue); // Encoded HTML is Hello <b> [there] >words<! //Example for ai.util.decodeBase64 var encodedBase64 = "VGhpcyBpcyBhIHNhbXBsZSB0ZXh0IGZvciBlbmNvZGluZw=="; var decodedbasevalue= ai.util.decodeBase64(encodedBase64); ai.log.logInfo("Decoded base64 is: "+decodedbasevalue); //Decoded base64 is:"This is a sample text for encoding" //Example for ai.util.encodeBase64 var rawBase64 = "This is a sample text for encoding"; var encodedbasevalue= ai.util.encodeBase64(rawBase64, ""); ai.log.logInfo("Encoded base64 is: "+encodedbasevalue); //Encoded base64 is:VGhpcyBpcyBhIHNhbXBsZSB0ZXh0IGZvciBlbmNvZGluZw== //Example for ai.util.encodeUrl var rawUrl = "https://docs.postman-echo.com/"; var encodedUrl=ai.util.encodeUrl(rawUrl); ai.log.logInfo("Encoded URL is: "+encodedUrl); //Encoded URL is: https%3a%2f%2fdocs.postman-echo.com%2f //Example for ai.util.decodeUrl var encodedUrl = "https%3a%2f%2fdocs.postman-echo.com%2f"; var decodedUrl=ai.util.decodeUrl(encodedUrl); ai.log.logInfo("Decoded URL is: "+decodedUrl); //Decoded URL is: https://docs.postman-echo.com/ //Example for ai.util.encrypt function testConnection(context) { var message = "-----BEGIN PGP MESSAGE-----" +"Version: GnuPG v2.0.14 (GNU/Linux)" +"Your Message" +"-----END PGP MESSAGE-----"; var text = ai.util.decrypt(message,'myPgp'); ai.log.logInfo("text message", text); return true; } //Example for ai.util.decrypt function testConnection(context) { var text = "Text to encrypt"; var encrypedPgpMessage = ai.util.encrypt(text,'myPgp'); ai.log.logInfo("encrypted message", encrypedPgpMessage ); return true; } //Example for ai.util.format var formatted=ai.util.format('How ar{0} you{1}',"e","?"); ai.log.logInfo("Formatted String is: "+formatted); //How are you? //Example for ai.util.isDate() var d = new Date(); var verifyIfDate=ai.util.isDate(d); ai.log.logInfo("Provided value is: "+verifyIfDate); //Provided value is: true //Example for ai.util.isUndefined var sampleValue; var verifyIfUndefined=ai.util.isUndefined(sampleValue); if (verifyIfUndefined) { ai.log.logInfo("Value is undefined"); } else { ai.log.logInfo("Value is defined"); } //Value is undefined //Example for ai.util.isDefined var sampleValue=6; var verifyIfDefined=ai.util.isDefined(sampleValue); ai.log.logInfo("verifyIfDefined: "+verifyIfDefined) if (verifyIfDefined) { ai.log.logInfo("Value is defined"); } else { ai.log.logInfo("Value is undefined"); } //Value is defined //Example for ai.util.isArray var sampleValue=["a","b"]; var verifyIfArray=ai.util.isArray(sampleValue); if (verifyIfArray) { ai.log.logInfo("Is is an Array"); } else { ai.log.logInfo("Not an Array"); } //It is an array //Example for ai.util.isString var sampleValue="123"; var verifyIfString=ai.util.isString(sampleValue); if (verifyIfString) { ai.log.logInfo("Is is a string"); } else { ai.log.logInfo("Not a string"); } //Example for ai.util.isNumber var sampleValue = {firstName:"Jon", lastName:"Doe"}; var verifyIfNumber=ai.util.isNumber(sampleValue); if (verifyIfNumber) { ai.log.logInfo("Is is a number"); } else { ai.log.logInfo("Not a number. Provided value is of type: "+typeof(sampleValue)); } //Not a number. Provided value is of type: object //Example for ai.util.isBoolean var sampleValue = true; var verifyIfBoolean=ai.util.isBoolean(sampleValue); if (verifyIfBoolean) { ai.log.logInfo("Value is Boolean"); } else { ai.log.logInfo("Not a Boolean. Provided value is of type: "+typeof(sampleValue)); } //Value is Boolean //Example for ai.util.isPrimitive var sampleValue = {firstName:"Jon", lastName:"Doe"}; var verifyIfPrimitive=ai.util.isPrimitive(sampleValue); if (verifyIfPrimitive) { ai.log.logInfo("Provided value is a Primitive Data Type"); } else { ai.log.logInfo("Provided value is not primitive: "+typeof(sampleValue)); } return true;