Something similar to Credentials for saving default data?


I’m writing a script that will interface with this API.

After having a user enter their API key, they need to select a default budget from the Prompt buttons that will show which are pulled the API’s Budgets endpoint:

I’d then like their choice to be saved in a similar way as Credentials so that the user doesn’t have to select this every time they use the action. Or perhaps, since these aren’t credentials, is there something else I should be using?

Here is the code after the authentication with the API:

let p = Prompt.create();
p.title = "Budget Picker"
p.message = "Please choose a default budget:"
for (let i = 0; i < budgets.length; i++) {
  let newButton = p.addButton(`${budgets[i].name}`, budgets[i].id, " ");
didSelect =;

let selectedBudget = p.buttonPressed;
if (didSelect != true) {
  alert("You will need to select a default budget before this action will run.");
  } else {
    // Not sure what to put here just yet

Does anyone have anything they can point me to about how this might be accomplished?


If you consider it confidential, or just for ease of access if you are retrieving other related data at the same time, then credentials seems like a sensible option. If you just want to store it somewhere, consider simply saving it to a file in iCloud (see FileManager in the scripting docs for examples).

1 Like