Answers.Body: <p>Oli’s comment is mostly right, but I think the solution is event simpler—the method you discovered is specifically for saving the <code>GlobalSet</code> settings/definition (like its name, handle, and the fields it uses), but what you're looking for is a more generic method for saving the <code>Element</code> that contains the actual content (as though you were updating it from the main <em>Globals</em> menu in the CP):</p>
  
  <pre class="lang-php prettyprint-override"><code>// Generic save method for any Element type, including Globals:
  Craft::$app-&gt;getElements()-&gt;saveElement($giveaways);
  </code></pre>
  
  <p>✌️</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-07T18:20:46.963Z
Answers.LastActivityDate: 2020-01-07T18:20:46.963Z
Answers.UserDisplayName: August Miller
Body: <p>This is my code:</p>
  
  <pre><code>$giveaway = Craft::$app-&gt;globals-&gt;getSetByHandle('promotions');
  $giveaway-&gt;giveawayName = "New Name";
  $success = Craft::$app-&gt;globals-&gt;saveSet($giveaway);
  return($success);
  </code></pre>
  
  <p>Controller returns true, but no changes have been made to the "promotions" global set. What have I missed?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-07T16:26:46.817Z
Comments.Text: `saveSet` will save the Global's settings/fields. [See here](https://github.com/craftcms/cms/blob/develop/src/controllers/GlobalsController.php#L228) to save content.
Comments.UserDisplayName: Oli
Tags: <plugin-development><controller><globals>
Title: Updating global set from controller
ThreadText: # Updating global set from controller
  
  (Asked by: username_0 on 2020-01-07)
  
  This is my code:
  
  ```
  $giveaway = Craft::$app->globals->getSetByHandle('promotions');
  $giveaway->giveawayName = "New Name";
  $success = Craft::$app->globals->saveSet($giveaway);
  return($success);
  
  ```
  
  Controller returns true, but no changes have been made to the "promotions" global set. What have I missed?
  
  **Tags:** plugin-development, controller, globals
  
  > **Comments:**
  > **username_1**: `saveSet` will save the Global's settings/fields. [See here](https://github.com/craftcms/cms/blob/develop/src/controllers/GlobalsController.php#L228) to save content.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-01-07. Score: 2 | Accepted answer
  
  Oli’s comment is mostly right, but I think the solution is event simpler—the method you discovered is specifically for saving the `GlobalSet` settings/definition (like its name, handle, and the fields it uses), but what you're looking for is a more generic method for saving the `Element` that contains the actual content (as though you were updating it from the main *Globals* menu in the CP):
  
  ```php
  // Generic save method for any Element type, including Globals:
  Craft::$app->getElements()->saveElement($giveaways);
  
  ```
  
  ✌️
  
  
  ---
  
  