מידע על ביצוע
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מידע על סקריפט שפועל
אפשר לגשת למאפיינים מסוימים של סקריפט שפועל באמצעות השיטות של האובייקט ExecutionInfo
. לדוגמה, הערך isPreview()
מראה אם כרגע מוצגת תצוגה מקדימה של סקריפט או שהוא פועל בפועל.
כך בדרך כלל קל יותר לנפות באגים בקוד:
// Code that generates a report.
// ...
if (!AdsApp.getExecutionInfo().isPreview()) {
// Do not email the report when in preview mode!
MailApp.sendEmail("customer@example.com", "Report is ready!", report);
}
מידע על החשבון של סקריפט
לרוב צריך את פרטי החשבון של סקריפט שפועל, במיוחד כשמשתמשים באותו סקריפט ללא שינוי בכמה חשבונות. אם הסקריפט שולח דוח באימייל, הנמען צריך לזהות את החשבון המקור. אפשר להשתמש ב-method getCustomerId()
של האובייקט Account
כדי:
let accountId = AdsApp.currentAccount().getCustomerId();
MailApp.sendEmail("customer@example.com",
"Report is ready for " + accountId, report);
לאובייקט Account
יש גם שיטות לזיהוי המטבע ואזור הזמן של החשבון.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-06-03 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-06-03 (שעון UTC)."],[[["Access attributes of a running script using the `ExecutionInfo` object, such as determining if the script is in preview mode with `isPreview()`."],["Utilize the `Account` object to retrieve account information like customer ID (`getCustomerId()`), currency, and time zone, particularly useful when a single script operates across multiple accounts."],["Simplify debugging and reporting by conditionally executing code based on the script's execution mode and including account-specific details in outputs like emails."]]],[]]