Edits history of script submission #3787 for ' Bulk update custom field value (jira)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Bulk update custom field value
     * Updates the value of a custom field added by Connect apps on one or more issues.
    The values of up to 200 custom fields can be updated.
    
    **[Permissions](#permissions) required:** Only Connect apps can make this request
     */
    export async function main(
      auth: Jira,
      Atlassian_Transfer_Id: string,
      body: {
        updateValueList?: {
          _type:
            | "StringIssueField"
            | "NumberIssueField"
            | "RichTextIssueField"
            | "SingleSelectIssueField"
            | "MultiSelectIssueField"
            | "TextIssueField";
          fieldID: number;
          issueID: number;
          number?: number;
          optionID?: string;
          richText?: string;
          string?: string;
          text?: string;
          [k: string]: unknown;
        }[];
      }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/atlassian-connect/1/migration/field`
      );
    
      const response = await fetch(url, {
        method: "PUT",
        headers: {
          "Atlassian-Transfer-Id": Atlassian_Transfer_Id,
          "Content-Type": "application/json",
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 396 days ago

  • nativets
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Bulk update custom field value
     * Updates the value of a custom field added by Connect apps on one or more issues.
    The values of up to 200 custom fields can be updated.
    
    **[Permissions](#permissions) required:** Only Connect apps can make this request
     */
    export async function main(
      auth: Jira,
      Atlassian_Transfer_Id: string,
      body: {
        updateValueList?: {
          _type:
            | "StringIssueField"
            | "NumberIssueField"
            | "RichTextIssueField"
            | "SingleSelectIssueField"
            | "MultiSelectIssueField"
            | "TextIssueField";
          fieldID: number;
          issueID: number;
          number?: number;
          optionID?: string;
          richText?: string;
          string?: string;
          text?: string;
          [k: string]: unknown;
        }[];
      }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/atlassian-connect/1/migration/field`
      );
    
      const response = await fetch(url, {
        method: "PUT",
        headers: {
          "Atlassian-Transfer-Id": Atlassian_Transfer_Id,
          "Content-Type": "application/json",
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 823 days ago

  • nativets
    type Jira = {
      username: string;
      password: string;
      domain: string;
    };
    /**
     * Bulk update custom field value
     * Updates the value of a custom field added by Connect apps on one or more issues.
    The values of up to 200 custom fields can be updated.
    
    **[Permissions](#permissions) required:** Only Connect apps can make this request.
     */
    export async function main(
      auth: Jira,
      Atlassian_Transfer_Id: string,
      body: {
        updateValueList?: {
          _type:
            | "StringIssueField"
            | "NumberIssueField"
            | "RichTextIssueField"
            | "SingleSelectIssueField"
            | "MultiSelectIssueField"
            | "TextIssueField";
          fieldID: number;
          issueID: number;
          number?: number;
          optionID?: string;
          richText?: string;
          string?: string;
          text?: string;
          [k: string]: unknown;
        }[];
      }
    ) {
      const url = new URL(
        `https://${auth.domain}.atlassian.net/rest/atlassian-connect/1/migration/field`
      );
    
      const response = await fetch(url, {
        method: "PUT",
        headers: {
          "Atlassian-Transfer-Id": Atlassian_Transfer_Id,
          "Content-Type": "application/json",
          Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 948 days ago