הערה
גישה לעמוד זה דורשת אישור. אתה יכול לנסות להיכנס או לשנות תיקיות.
גישה לעמוד זה דורשת אישור. אתה יכול לנסות לשנות מדריכים.
מקבל אוסף של שלבים הנמצאים כעת בנתיב הפעיל באמצעות שיטות לקיום אינטראקציה עם השלבים המוצגים בפקד זרימת התהליכים העסקיים.
הנתיב הפעיל מייצג שלבים המעובדים כעת בפקד התהליך בהתבסס על כללי ההסתעפות והנתונים הנוכחיים ברשומה.
תחביר
var stageCollection = formContext.data.process.getActivePath();
ערך החזרה
סוג: אוסף.
תיאור: אוסף של כל השלבים שהושלמו, השלב הפעיל כעת וערכת השלבים החזויים העתידיים בהתבסס על תנאים מרוצים בכלל ההסתעפות. זו עשויה להיות קבוצת משנה של השלבים המוחזרים עם formContext.data.process. getActiveProcess מכיוון שהוא יכלול רק את השלבים המייצגים מעבר חוקי מהשלב הנוכחי בהתבסס על יצירת הסתעפות שהתרחשה בתהליך.
דוגמה
הפונקציה Sdk.formOnLoad משתמשת בפעולת השירות formContext.data.process.getActivePath כדי לאחזר אוסף של שלבים. לאחר מכן, הקוד לדוגמה משתמש בפעולת השירות forEach של האוסף כדי לעבור בלולאה בכל שלב. לאחר מכן הקוד כותב מאפייני מפתח של השלב במסוף באמצעות הפונקציה Sdk.writeToConsole המוגדרת בספריה זו. לאחר מכן, הקוד ניגש לאוסף של שלבים עבור כל שלב באמצעות פעולת השירות getSteps . לבסוף, הדוגמה משתמשת בפעולת השירות forEach של אוסף השלבים כדי לגשת לכל שלב ולכתוב מאפייני מפתח של השלב במסוף.
הערה
יש להגדיר את הפונקציה Sdk.formOnLoad בספריית JavaScript לדוגמה כמטפל באירועים OnLoad עבור טופס, ותיבת הסימון Pass execution as the first parameter must be selected in the Handler Properties .
כמו כן, מדגם זה פשוט מדגים את השימוש בחלק מהשיטות ב- API formContext.data.process . הוא אינו מייצג את השימוש ב- API זה כדי לעמוד בדרישות עסקיות; הוא מיועד רק להדגים כיצד ניתן לגשת לערכים של מאפייני מפתח בקוד.
// A namespace defined for SDK sample code
// You should define a unique namespace for your libraries
var Sdk = window.Sdk || {};
(function () {
// A function to log messages while debugging only
this.writeToConsole = function (message) {
if (typeof console != 'undefined')
{ console.log(message); }
};
// Code to run in the OnLoad event
this.formOnLoad = function (executionContext) {
// Retrieve the formContext
var formContext = executionContext.getFormContext();
// Enumerate the stages and steps in the active path
var activePathCollection = formContext.data.process.getActivePath();
activePathCollection.forEach(function (stage, n) {
Sdk.writeToConsole("Stage Index: " + n);
Sdk.writeToConsole("Table: " + stage.getEntityName());
Sdk.writeToConsole("StageId: " + stage.getId());
Sdk.writeToConsole("Status: " + stage.getStatus());
var stageSteps = stage.getSteps();
stageSteps.forEach(function (step, i) {
Sdk.writeToConsole(" Step Name: " + step.getName());
Sdk.writeToConsole(" Step Column: " + step.getAttribute());
Sdk.writeToConsole(" Step Required: " + step.isRequired());
Sdk.writeToConsole(" ---------------------------------------")
})
Sdk.writeToConsole("---------------------------------------")
});
};
}).call(Sdk);
כאשר הדוגמה פועלת בדפדפן, באפשרותך להשתמש בכלי הפיתוח של הדפדפן כדי להציג את הטקסט הכתוב בקונסולה. לדוגמה, כאשר מדגם זה מופעל בטופס הזדמנות עם תהליך מכירות הזדמנות, הדוגמה הבאה נכתבת במסוף:
Stage Index: 0
Table: opportunity
StageId: 6b9ce798-221a-4260-90b2-2a95ed51a5bc
Status: active
Step Name: Identify Contact
Step Column: parentcontactid
Step Required: false
---------------------------------------
Step Name: Identify Account
Step Column: parentaccountid
Step Required: false
---------------------------------------
Step Name: Purchase Timeframe
Step Column: purchasetimeframe
Step Required: false
---------------------------------------
Step Name: Estimated Budget
Step Column: budgetamount
Step Required: false
---------------------------------------
Step Name: Purchase Process
Step Column: purchaseprocess
Step Required: false
---------------------------------------
Step Name: Identify Decision Maker
Step Column: decisionmaker
Step Required: false
---------------------------------------
Step Name: Capture Summary
Step Column: description
Step Required: false
---------------------------------------
---------------------------------------
Stage Index: 1
Table: opportunity
StageId: 650e06b4-789b-46c1-822b-0da76bedb1ed
Status: inactive
Step Name: Customer Need
Step Column: customerneed
Step Required: false
---------------------------------------
Step Name: Proposed Solution
Step Column: proposedsolution
Step Required: false
---------------------------------------
Step Name: Identify Stakeholders
Step Column: identifycustomercontacts
Step Required: false
---------------------------------------
Step Name: Identify Competitors
Step Column: identifycompetitors
Step Required: false
---------------------------------------
---------------------------------------
Stage Index: 2
Table: opportunity
StageId: d3ca8878-8d7b-47b9-852d-fcd838790cfd
Status: inactive
Step Name: Identify Sales Team
Step Column: identifypursuitteam
Step Required: false
---------------------------------------
Step Name: Develop Proposal
Step Column: developproposal
Step Required: false
---------------------------------------
Step Name: Complete Internal Review
Step Column: completeinternalreview
Step Required: false
---------------------------------------
Step Name: Present Proposal
Step Column: presentproposal
Step Required: false
---------------------------------------
---------------------------------------
Stage Index: 3
Table: opportunity
StageId: bb7e830a-61bd-441b-b1fd-6bb104ffa027
Status: inactive
Step Name: Complete Final Proposal
Step Column: completefinalproposal
Step Required: false
---------------------------------------
Step Name: Present Final Proposal
Step Column: presentfinalproposal
Step Required: false
---------------------------------------
Step Name: Confirm Decision Date
Step Column: finaldecisiondate
Step Required: false
---------------------------------------
Step Name: Send Thank You
Step Column: sendthankyounote
Step Required: false
---------------------------------------
Step Name: File De-brief
Step Column: filedebrief
Step Required: false
---------------------------------------
---------------------------------------