Vérification d'expiration d'org Salesforce

VérifiéPrudence

Vérifie la date d'expiration des orgs Salesforce (essai, Developer Edition, scratch) et fournit des conseils. Supporte les sorties JSON/CSV pour alertes et sauvegarde.

Spar Skills Guide Bot
DevOpsIntermédiaire
25/07/2026
Claude CodeCursorCodex
#salesforce#org-lifecycle#expiration-monitoring#sf-cli#alerting

Recommandé pour

Synthèse automatique

Vérifie la date d'expiration des orgs Salesforce (trial, Developer Edition et scratch orgs), calcule les jours restants et affiche des conseils via la Salesforce CLI.

Points forts

  • Distingue correctement les sources d'expiration : TrialExpirationDate en SOQL pour les orgs trial/DE, expirationDate de sf org list pour les scratch orgs
  • Trie les résultats par urgence (orgs déjà expirées et les plus proches de l'échéance en premier) avec un résumé d'une ligne
  • Prend en charge un org précis, l'org par défaut ou tous les orgs authentifiés, avec sortie JSON/CSV pour cron et alerting
  • Fournit des commandes de sauvegarde pour un org à risque et explique comment prolonger ou renouveler un trial

Limites

  • Lecture seule : ne crée, ne supprime, ne rafraîchit et ne change jamais l'org actif
  • Dépend d'un script bash fourni qui doit être appelé par chemin absolu, ce qui peut échouer si le répertoire du skill est déplacé
  • Nécessite sf >= 2.0.0 et jq >= 1.6.0 installés localement, et un org authentifié pour interroger TrialExpirationDate
Quand l'utiliser

À utiliser dès qu'un utilisateur veut savoir quand un org Salesforce expire, combien de jours restent, ou mettre en place une alerte sur les orgs bientôt expirés.

Quand l'éviter

À ne pas utiliser pour le calendrier de rafraîchissement des sandboxes, la création/suppression/bascule d'orgs, ou des essais non-Salesforce comme AWS ou Netflix.

Analyse de sécurité

Prudence
Score qualité85/100

The skill is a read-only reporting tool: it queries trial/scratch org expiration dates and prints prioritized guidance, explicitly refusing to create, delete, refresh, or switch orgs. It invokes a bundled bash script and the Salesforce CLI, both powerful tools used for a legitimate purpose, and includes good hygiene (absolute-path checks). The lack of the script's contents and the broad `Bash(bash)` grant warrant caution rather than a clean 'safe', but there are no malicious indicators.

Points d'attention
  • •Executes a bundled shell script via `bash` whose contents are not included in the reviewed SKILL.md, so the actual commands run cannot be fully verified.
  • •Uses the Salesforce CLI (`sf data query`, `sf org list`) which performs authenticated network calls and reads org metadata; legitimate but touches credentials/network.
  • •`Bash(bash)` is a broad capability that could execute arbitrary commands if the script path is wrong or the script is tampered with; the skill mitigates this by requiring an absolute path verification step.
  • •No evidence of destructive actions, secret exfiltration, curl|sh, base64 payloads, or safety-disabling instructions.
Comment cette analyse est faite

Exemples

Check one org's trial
When does my trial org expire? How many days are left on dev-myorg?
Find orgs expiring soon
Which of my authenticated Salesforce orgs are expiring within 30 days? Show them sorted by urgency.
Set up alerting
Give me a --json output of my expiring orgs and a cron-friendly command that fails if any org expires within 14 days.

name: dx-org-trial-expiration-check description: "Check when Salesforce orgs expire (or already expired) and what to do about it, for one org, the default org, or across all authenticated orgs, using the Salesforce CLI (sf). Use when the user asks about org or trial expiration, "when does my trial expire", "is my trial org still active", "how many days are left", "which orgs are expiring soon", wants to filter orgs expiring within N days, needs machine-readable (JSON/CSV) output for cron or alerting, wants to back up an at-risk org before it lapses, or asks how to extend or renew an expiring trial or Developer Edition org. Covers trial editions, Developer Edition orgs (anything with a TrialExpirationDate), and scratch orgs (via sf org list). DO NOT TRIGGER for sandbox refresh timing, for creating, deleting, or switching the active org, or for non-Salesforce trials such as AWS, Netflix, or other vendors — this skill reads expiration and prints guidance, it does not modify orgs." allowed-tools: Read, Bash(bash), Bash(sf data query), Bash(sf org list), Bash(sf config get), Bash(jq), Bash(date) metadata: version: "2.0" cliTools: - tool: ["jq"] semver: ">=1.6.0" - tool: ["sf"] semver: ">=2.0.0"

Org Expiration Check

Determine when a Salesforce org expires, how many days remain, and whether it has already expired — for one org, the default org, or every authenticated org. Results are prioritized (already-expired and soonest-expiring first) with a one-line summary. The skill can also emit machine-readable output for alerting, print backup commands for an at-risk org, and explain how to renew an expiring trial or Developer Edition org.

When to use

Trigger on requests like:

  • "When does my trial org expire?" / "Is it still active or has it expired?"
  • "How many days are left on my trial?"
  • "Which of my orgs are expiring soon?" / "expiring within 30 days?"
  • "Alert me / set up a cron job for expiring orgs" (use --json + --fail-if-expiring).
  • "Back up my org before it expires" (use --preserve).
  • "How do I extend / renew my trial (or Developer Edition) org?" (use --renew).

This skill covers trial editions, Developer Edition orgs (anything with a TrialExpirationDate), and scratch orgs (via the expirationDate from sf org list).

When NOT to use

Do not trigger this skill for:

  • Sandbox refresh timing — that is not an expiration date.
  • Creating, deleting, or switching orgs — this skill only reads expiration and prints guidance; it never creates, deletes, refreshes, or changes the active/default org. (To switch the default org, use dx-org-switch.)
  • Non-Salesforce trials — e.g. AWS free tier, Netflix, or any other vendor's trial. This skill is Salesforce-only.

How expiration is determined

  • Trial / Developer Edition orgs: the authoritative source is the org's Organization.TrialExpirationDate field, read via SOQL (sf data query). This field is null for paid/production orgs, which therefore report no trial expiration — that is expected, not an error.
  • Scratch orgs: the expirationDate reported by sf org list (no SOQL query is issued for scratch orgs).

Steps

  1. CRITICAL: Run the bundled helper script, which handles date math (days remaining, expired, expiring-soon warnings), prioritized sorting, and structured output, and works on macOS and Linux. Always invoke it by absolute path from the skill directory — never ./scripts/, which resolves against the user's current directory and will either run the wrong script or fail.

    Before executing, verify:

    • [ ] <skill_dir> is an absolute path (starts with /), not a relative path
    • [ ] The path points at this skill's own directory (the one containing this SKILL.md)
    bash "<skill_dir>/scripts/check_expiration.sh" <alias-or-username>   # one org
    bash "<skill_dir>/scripts/check_expiration.sh"                       # default org (target-org config)
    bash "<skill_dir>/scripts/check_expiration.sh" --all                 # every authenticated org
    bash "<skill_dir>/scripts/check_expiration.sh" --all --within 30     # only orgs expiring within 30 days
    

    <skill_dir> is the absolute path to the directory containing this SKILL.md.

  2. Relay the script output to the user. When an org could not be queried, surface the sf org login web command the script prints so the user can authenticate. Pick optional flags based on what the user asked for (see below): --preserve when they want to save their work, --renew when they ask how to extend, --json/--csv for automation, --fail-if-expiring for a cron/CI gate.

Options

| Flag | Purpose | |------|---------| | --all, -a | Check every authenticated org. | | --within <days>, -w | Show only orgs expiring within N days (includes already-expired; omits paid/production). --within=30 also works. | | --json | Emit a JSON array of org records (data only). | | --csv | Emit CSV rows (data only). | | --preserve | Print backup commands for expiring/expired orgs. | | --renew | Print trial/DE extension & reactivation guidance. | | --fail-if-expiring[=N] | Exit 3 if any org expires within N days (default 7). | | --no-scratch | Exclude scratch orgs (trial/DE only). | | --help, -h | Show usage. |

Flag order is flexible and flags combine (e.g. --all --within 30 --json).

Prioritized output

Human output is grouped by urgency — Expired first, then Expiring soon (within 7 days, flagged Warning), then Active, then No trial expiration, then any orgs that could not be queried — and ends with a one-line summary:

Org expiration status for all authenticated orgs:

Expired:
  old-trial                       trial/DE edition expired 2026-06-20  (EXPIRED 19 day(s) ago)

Expiring soon (within 7 day(s)):
  almost-up                       trial/DE edition expires 2026-07-14  (expires in 5 day(s)  Warning)

Active (not expiring soon):
  acme-trial                      trial/DE edition expires 2026-08-15  (expires in 37 day(s))
  my-scratch                      scratch org expires 2026-07-25  (expires in 16 day(s))

No trial expiration (paid/production):
  prod                            no trial expiration (paid/production org)

Summary: 1 expired, 1 expiring within 7 day(s), 2 active, 1 with no expiration.

Structured output for alerting and cron (--json / --csv)

For dashboards, spreadsheets, or scheduled jobs, use --json or --csv to get machine-readable records (no prose). Each record has org, kind, expirationDate, daysRemaining (negative = expired, null = no expiration), status, and orgId. This is deterministic and needs no LLM in the loop.

# JSON, filtered to orgs expiring within 30 days:
bash "<skill_dir>/scripts/check_expiration.sh" --all --within 30 --json

Cron watchdog — --fail-if-expiring[=N] exits 3 (and prints an ALERT: line to stderr) if any org expires within N days (default 7), so a scheduled job can page you before an org lapses:

# crontab: every morning at 9, alert if anything expires within 7 days
0 9 * * *  bash "<skill_dir>/scripts/check_expiration.sh" --all --fail-if-expiring 7 \
             || mail -s "Salesforce org expiring soon" me@example.com

Preserve your work before an org lapses (--preserve)

When an org expires you lose access to its metadata and data. --preserve prints ready-to-run backup commands (metadata manifest + retrieve, and a bulk data export) for each expiring or already-expired org. It only prints the commands — review and run them yourself:

bash "<skill_dir>/scripts/check_expiration.sh" my-trial --preserve

Extend or renew a trial / Developer Edition org (--renew)

--renew prints the current guidance for keeping an org alive, and surfaces the Org IDs of at-risk orgs so the steps are actionable:

  • Partners: request a Trial Org extension (up to +12 months) via partners.salesforce.com → Ask Agentforce → "I want to extend my Trial Org", providing the Org ID. Eligible while active or expired < 30 days; not for LDV orgs. (Salesforce Help article 000387818.)
  • Nonprofits: email your Account Executive with subject "Trial Extension" and the trial-starter email, Org ID, and username; AMER PowerOfUsDesk@salesforce.com, other regions myaccount@salesforce.com / 1-800-NO-SOFTWARE. Works even if already expired. (Article 004754220.)
  • Developer Edition: DE orgs have no subscription clock but are deactivated after prolonged inactivity (~180 days without a login); log in periodically. If locked (not yet deleted), open a Salesforce Customer Support case to reactivate — once permanently deleted, an org cannot be recovered.
  • To keep a standard trial's data/config, convert/subscribe to a paid edition before it lapses.

Exit codes

  • 0 success
  • 1 an org could not be queried (auth/connection error)
  • 2 bad usage or a missing dependency (sf or jq)
  • 3 --fail-if-expiring threshold breached (at least one org expiring)

When both apply, a --fail-if-expiring breach (3) takes precedence over an auth error (1): the alerting signal wins so a watchdog still fires. If your job must also detect unreachable orgs, run --json and inspect the records for status: "auth_error" in addition to checking the exit code. Note that an org whose credentials fail cannot be date-checked, so it never counts toward a --fail-if-expiring breach on its own.

--fail-if-expiring with no explicit number treats a following all-numeric argument as the day count (e.g. --fail-if-expiring 12345). In the rare case an org's alias is purely numeric, pass the org first (check_expiration.sh 12345 --fail-if-expiring 7) so it isn't mistaken for the threshold.

Authentication

If an org isn't authenticated (no saved credentials, or an expired/revoked token), the script does not fail silently — it prints the exact command to log in and then re-run:

  my-trial                       not authenticated — no saved credentials for this org

  To authenticate, run one of:
    sf org login web --alias "my-trial"
    sf org login web --alias <my-alias> --instance-url https://test.salesforce.com
  Then re-run this check. List existing logins with:  sf org list

sf org login web opens a browser to complete the OAuth flow. Use --instance-url https://test.salesforce.com for sandboxes, or a custom My Domain URL where applicable.

Manual fallback (if the script is unavailable)

# Trial/DE expiration for one org (null = not a trial / paid org):
sf data query --query "SELECT Id, TrialExpirationDate FROM Organization" --target-org <org> --json

# Scratch org expiration comes from the org list, not SOQL:
sf org list --json

Notes

  • Requires the Salesforce CLI (sf) and jq on the PATH, plus at least one authenticated org (sf org login web).
  • Avoid launching many sf commands concurrently — the CLI can be slow under contention. The script queries orgs sequentially for this reason.
  • sf org list exposes a trailExpirationDate (note the typo) field that is often null; the script does not rely on it for trial/DE orgs — it uses the SOQL TrialExpirationDate, which is reliable. It does use expirationDate from the list for scratch orgs.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/salesforce-org-expiration-check-mrzxuplb' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/salesforce-org-expiration-check-mrzxuplb/download' --output '.skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md.part' && mv '.skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md.part' '.skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Outils déclarés par l’auteur (à vérifier dans votre agent) : Read, Bash(bash), Bash(sf data query), Bash(sf org list), Bash(sf config get), Bash(jq), Bash(date)

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md' && test -s '.skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/dx-org-trial-expiration-check' && cp -R '.skill-downloads/salesforce-org-expiration-check-mrzxuplb' '.claude/skills/dx-org-trial-expiration-check'

Cursor
test -f '.skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md' && test -s '.skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/dx-org-trial-expiration-check' && cp -R '.skill-downloads/salesforce-org-expiration-check-mrzxuplb' '.cursor/skills/dx-org-trial-expiration-check'

Codex
test -f '.skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md' && test -s '.skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/dx-org-trial-expiration-check' && cp -R '.skill-downloads/salesforce-org-expiration-check-mrzxuplb' '.agents/skills/dx-org-trial-expiration-check'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/salesforce-org-expiration-check-mrzxuplb'

openskills read 'salesforce-org-expiration-check-mrzxuplb'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/salesforce-org-expiration-check-mrzxuplb/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires