Answers.Body: <p>Your CraftCMS global can be accessed using the code</p>
  
  <pre><code>{{craft.globals.getSetByHandle('siteDefaults').artworksList.first.uri|default}}/{slug}
  </code></pre>
  
  <p>I believe the issue is that the Entry URL field requires you to use <code>craft.globals</code> to prevent issues with the routing custom variables.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-13T12:08:23.727Z
Answers.Text: The Craft 3 equivalent is `craft.app.getGlobals().getSetByHandle('siteDefaults')`.
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-10T06:15:16.413Z
Answers.LastActivityDate: 2017-03-10T06:15:16.413Z
Answers.UserDisplayName: Regan Lawton
Body: <p>I'm trying to use global variables in Entry URLs generated by Craft, but they seem to be empty. Not getting any errors as such, just null. </p>
  
  <p>My Entry URL format looks like this: </p>
  
  <p><code>{{siteDefaults.artworksList.first.uri|default}}/{slug}</code></p>
  
  <p>Where artworkList is an entry with a URI/URL but I'm getting "/some-entry-slug"</p>
  
  <p>Similarly, <code>{{siteDefaults.artworksList.length}}</code> returns 0 even though there is an entry there. </p>
  
  <p>Has anyone tried to use globals before in entry URLs? </p>
  
  <p>Thanks!</p>
  
Tags: <entry><url><sections><globals>
Title: Use global values in the Entry URL Format field
ThreadText: # Use global values in the Entry URL Format field
  
  (Asked by: username_0 on 2017-03-10)
  
  I'm trying to use global variables in Entry URLs generated by Craft, but they seem to be empty. Not getting any errors as such, just null.
  
  My Entry URL format looks like this:
  
  `{{siteDefaults.artworksList.first.uri|default}}/{slug}`
  
  Where artworkList is an entry with a URI/URL but I'm getting "/some-entry-slug"
  
  Similarly, `{{siteDefaults.artworksList.length}}` returns 0 even though there is an entry there.
  
  Has anyone tried to use globals before in entry URLs?
  
  Thanks!
  
  **Tags:** entry, url, sections, globals
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-03-10. Score: 5 | Accepted answer
  
  Your CraftCMS global can be accessed using the code
  
  ```
  {{craft.globals.getSetByHandle('siteDefaults').artworksList.first.uri|default}}/{slug}
  
  ```
  
  I believe the issue is that the Entry URL field requires you to use `craft.globals` to prevent issues with the routing custom variables.
  
  > **Comments:**
  > **username_2**: The Craft 3 equivalent is `craft.app.getGlobals().getSetByHandle('siteDefaults')`.  
  
  ---
  
  