ServiceNow - Move or Copy Attachment

ServiceNow - Move or Copy Attachment moves or copies the attachment from a ServiceNow record to a record in a specified destination table for:

  • Assets returned by the selected query or assets selected on the relevant Assets page.
📘

Note

There is a fundamental difference between moving and copying an attachment. The Copy action is more complex.

Each flow begins by identifying both the attachment and its intended destination:

  1. Retrieve the attachment ID from the endpoint:

    • endpoint: table/sys_attachment
    • sysparam_query: table_sys_id={table_sys_id}^table_name={table_name}
  2. Retrieve the destination record sys_id using a query mapped with Dynamic Values.

    • endpoint: table/{table}
    • sysparam_query: number=INC00001

For each attachment, the subsequent steps vary based on whether you're moving or copying the attachment.

Move flow:

  1. Change the attachment record destination by putting in a new value.

    • endpoint: table/sys_attachment/{attachment_sys_id}
    • body params: table_name=new_table_name, table_sys_id=new_table_sys_id
  2. Check if the destination record contains the moved attachment.

    • endpoint: table/sys_attachment
    • sysparam_query: table_sys_id={table_sys_id}^table_name={table_name}

Copy flow:

  1. Download the attachment file to Axonius.

    • endpoint: attachment/{attachment_sys_id}/file
  2. Upload the attachment file to the destination record.

    • endpoint: attachment/file
    • URL parameters: table_name=table_name, table_sys_id=table_sys_id, file_name=file_name
    • body: File content

See Creating Enforcement Sets to learn more about adding Enforcement Actions to Enforcement Sets.

📘

Note:

Required Fields

These fields must be configured to run the Enforcement Set.

  • Action name - The name of this Enforcement Action. The system sets a default name. You can change the name.
  • Configure Dynamic Values - Toggle on to enter a Dynamic Value statement. See Creating Enforcement Action Dynamic Value Statements to learn more about Dynamic Value statement syntax.
  • Use stored credentials from the ServiceNow adapter - Select this option to use credentials from the adapter connection. By default, the first connection is selected.

    • When you select this option, the Select Adapter Connection drop-down becomes available. Select the adapter connection to use for this Enforcement Action.

    📘

    Note

    To use this option, you must successfully configure a ServiceNow adapter connection.

  • Attachment Action - From the dropdown, select one of the following:

    • Copy - Copies the attachment from a ServiceNow incident record to a record in the destination table.
    • Move - Moves the attachment from a ServiceNow incident record to a record in the destination table.
  • Destination table name - The name of the table where you want to copy or move the attachment.

  • Destination table query - Do not enter anything in this field. Using a Dynamic Value statement, set the ServiceNow sysparm_query to filter and bring a single incident record from ServiceNow. See an example of the statement configured using the Wizard and its syntax:

DestinationTalleQuery.png
ticket all then form.destination_table_query set_value concat("number=" ,[ticket.specific_data.data.display_id] ,"^sys_updated_onONThisMonth@javascript:gs.beginningOfThisMonth()@javascript:gs.endOfThisMonth()")

Additional Fields

💡

Connection and Credentials

When Use stored credentials from the adapter is toggled off, some of the connection fields below are required to create the connection, while other fields are optional.

  • ServiceNow Domain - URL for the ServiceNow admin panel.

  • User Name and Password - To connect to ServiceNow, you will need to create a user with action privileges.

  • Client ID and Client Secret - The OAuth Client ID and Client Secret for OAuth access to ServiceNow. Refer to OAuth 2.0 with Inbound REST for full details on how to obtain the OAuth Token.

  • Refresh Token - When using the OAuth method of authentication, enter the value of the Refresh Token issued by a ServiceNow instance.

  • Apigee URL - The URL of the domain that the get request is sent to for acquiring Apigee token.

  • Resource Apigee - The resources you want the Apigee to access.

  • Verify SSL - Select whether to verify the SSL certificate of the server against the CA database inside of Axonius. For more details, see SSL Trust & CA Settings.

  • HTTPS Proxy - Connect the adapter to a proxy instead of directly connecting it to the domain.

Gateway Name - Select the Gateway through which to connect to perform the action.


For more details about other Enforcement Actions available, see Action Library.