---
schema_version: "1"
id: b69de74bf5a235506b7c9c9fc8ae5b0cb11d3d54012a2f117163769a68b22471
title: setCanvasUrlPath(newPath)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_canvas_ApplicationContext_setCanvasUrl.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_canvas_ApplicationContext_setCanvasUrl.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: ac1ab3ea3de1d963ed0106ca6fdca3954262e7407566b1c3f3d1f4c75553c480
description: Overrides the URL of the canvas app for the current request.
---
# setCanvasUrlPath(newPath)

Overrides the URL of the canvas app for the current request.

## Signature

public void setCanvasUrlPath(String newPath)

## Parameters

- **newPath**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    The URL (not including domain) that you need to use to override the canvas app URL.

## Return Value

Type: Void

## Usage

Use this method to override the URL path and query string of the canvas app. Do not provide a fully qualified URL, because the provided URL string will be appended to the original canvas URL domain.

For example, if the current canvas app URL is https://myserver.com:6000/myAppPath and you call setCanvasUrlPath('/alternatePath/args?arg1=1&arg2=2'), the adjusted canvas app URL will be https://myserver.com:6000/alternatePath/args?arg1=1&arg2=2.

If the provided path results in a malformed URL, or a URL that exceeds 2,048 characters, a System.CanvasException will be thrown.

This method overrides the canvas app URL for the current request and does not permanently change the canvas app URL as configured in the UI for the Salesforce canvas app settings.