0

Update fiscal year

by
Published Oct 17, 2025
Script zoho Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Zoho = {
3
  token: string;
4
};
5
/**
6
 * Update fiscal year
7
 *
8
 */
9
export async function main(
10
  auth: Zoho,
11
  body: {
12
    fiscal_year: {
13
      start_month:
14
        | "June"
15
        | "October"
16
        | "December"
17
        | "May"
18
        | "September"
19
        | "March"
20
        | "July"
21
        | "January"
22
        | "February"
23
        | "April"
24
        | "August"
25
        | "November";
26
      display_based_on: "start_month" | "end_month";
27
      id?: string;
28
    };
29
  },
30
) {
31
  const url = new URL(`https://zohoapis.com/crm/v8/settings/fiscal_year`);
32

33
  const response = await fetch(url, {
34
    method: "PUT",
35
    headers: {
36
      "Content-Type": "application/json",
37
      Authorization: "Zoho-oauthtoken " + auth.token,
38
    },
39
    body: JSON.stringify(body),
40
  });
41
  if (!response.ok) {
42
    const text = await response.text();
43
    throw new Error(`${response.status} ${text}`);
44
  }
45
  return await response.json();
46
}
47