<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using Workflow and Developer SDK to update settings.  What are my validation errors? in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/Using-Workflow-and-Developer-SDK-to-update-settings-What-are-my/m-p/258627#M1820</link>
    <description>&lt;P&gt;So&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/47376"&gt;@Fin_Ubels&lt;/a&gt;&amp;nbsp; I eventually got this working as you suggested.&amp;nbsp; &amp;nbsp;It took me ages to get the JSON object copy just right.&amp;nbsp; &amp;nbsp; Am I right in thinking this can be developed in VS Code or some other humane IDE ?&lt;/P&gt;</description>
    <pubDate>Tue, 08 Oct 2024 15:56:53 GMT</pubDate>
    <dc:creator>HeadScratcher</dc:creator>
    <dc:date>2024-10-08T15:56:53Z</dc:date>
    <item>
      <title>Using Workflow and Developer SDK to update settings.  What are my validation errors?</title>
      <link>https://community.dynatrace.com/t5/Automations/Using-Workflow-and-Developer-SDK-to-update-settings-What-are-my/m-p/258439#M1817</link>
      <description>&lt;P&gt;Hi I am creating a workflow to help manage our tenant.&amp;nbsp; I want to find any Custom Logs at that environment scope and disable them if certain criteria are met.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use the SDK to call get&amp;nbsp; const res = await settingsObjectsClient.getSettingsObjects(params); successfully which gives me a list of custom logs and&amp;nbsp; their objectIds&lt;/P&gt;
&lt;P&gt;On my environment, I only have one test custom log source and it is disabled.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So using the I want to update the object IDs&amp;nbsp; by enabling which I have chosen the method ettingsObjectsClient.putSettingsObjectByObjectId(config); but my code fails with some validation errors, as per below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Updating settings sandpit&lt;BR /&gt;config&lt;BR /&gt;{"schemaId":"builtin:logmonitoring.custom-log-source-settings","schemaVersion":"1.1","scope":"environment","objectId":"vu9U3hXa3xxxxxxxxxlYGG-71TeFdrerQ","updateToken":"vu9UxxxxxxrQ","body":{"value":{"enabled":true}}}&lt;BR /&gt;error raised. 400: &lt;STRONG&gt;Validation failed for 2 Validators.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2 questions&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;What is wrong with my code?&lt;/P&gt;
&lt;P&gt;How can I find out what the validation error might be referring to?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;import { settingsObjectsClient } from "@dynatrace-sdk/client-classic-environment-v2";


export default async function updateSettingsExample() 
{
  try{
    console.log("Updating settings");
    const config = { 
      schemaId: "builtin:logmonitoring.custom-log-source-settings",
      schemaVersion: "1.1",
      scope: "environment",
      objectId: 'vu9U3hXa3q0AAAABADBxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxidWlsdGluOlYzYtYTEyMi1iZGU1MzliNzJlMGG-71TeFdrerQ',
      updateToken: "vu9U3hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxeFdjerQ",
      
      body: { 
        value: { 
            enabled: true,
          },
      },
    };

    console.log("config");
    console.log(JSON.stringify(config));
    const data = await settingsObjectsClient.putSettingsObjectByObjectId(config);
    console.log("result");
    console.log(JSON.stringify(data));
  }
  catch (error)         
  {
    console.log(`error raised.  ${error}`);
  }
}


&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 06:30:08 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Using-Workflow-and-Developer-SDK-to-update-settings-What-are-my/m-p/258439#M1817</guid>
      <dc:creator>HeadScratcher</dc:creator>
      <dc:date>2024-10-08T06:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Workflow and Developer SDK to update settings.  What are my validation errors?</title>
      <link>https://community.dynatrace.com/t5/Automations/Using-Workflow-and-Developer-SDK-to-update-settings-What-are-my/m-p/258514#M1818</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/69708"&gt;@HeadScratcher&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I have tested this in my own environment and it looks like you need to provide the entire value for the updated setting. For example, above you are only providing "enabled: true" when in actual fact you would also need to provide the rest of the log ingestion rule. You can find what needs to be included by using the API tab on the page as seen below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fin_Ubels_1-1728357821556.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23413i6594B405D13B4301/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Fin_Ubels_1-1728357821556.png" alt="Fin_Ubels_1-1728357821556.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fin_Ubels_0-1728357749755.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/23412i6F4C3DCA1E71BE69/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Fin_Ubels_0-1728357749755.png" alt="Fin_Ubels_0-1728357749755.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;My code looked like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import { settingsObjectsClient } from "@dynatrace-sdk/client-classic-environment-v2";


export default async function updateSettingsExample() 
{
  const data = 
    await settingsObjectsClient.putSettingsObjectByObjectId({
      objectId: "vu9U3hXa3q0AAAABADBidWlsdGluOmxvZ21vbml0b3JpbmcuY3VzdG9tLWxvZy1zb3VyY2Utc2V0dGluZ3MABnRlbmFudAAGdGVuYW50ACRkZTIxNmNiNi1kNmY1LTNhOWYtYmU2Ny03ZTQyMTYzNDc1MGG-71TeFdrerQ",
      body: { 
        value: {
          "enabled":false,"config-item-title":"Test","custom-log-source":{"type":"WINDOWS_EVENT_LOG","accept-binary":null,"values-and-enrichment":[{"path":"Test","enrichment":[]}]},"context":[]
        } 
      },
    });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Going back to your original requirement, you should have the value when you get the setting using "&lt;SPAN&gt;const res = await settingsObjectsClient.getSettingsObjects(params);&lt;/SPAN&gt;" and then you should be able to modify what has returned and then just pass it back in "const data = await settingsObjectsClient.putSettingsObjectByObjectId(config);".&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 03:27:35 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Using-Workflow-and-Developer-SDK-to-update-settings-What-are-my/m-p/258514#M1818</guid>
      <dc:creator>Fin_Ubels</dc:creator>
      <dc:date>2024-10-08T03:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using Workflow and Developer SDK to update settings.  What are my validation errors?</title>
      <link>https://community.dynatrace.com/t5/Automations/Using-Workflow-and-Developer-SDK-to-update-settings-What-are-my/m-p/258562#M1819</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/47376"&gt;@Fin_Ubels&lt;/a&gt;&amp;nbsp; I understand what you are saying that does make sense so&amp;nbsp; I&amp;nbsp; will try and get that working in the next couple of days.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Extra points for mentioning the API info.&amp;nbsp; I always forget about that but it is hugely useful when using the API.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 10:37:56 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Using-Workflow-and-Developer-SDK-to-update-settings-What-are-my/m-p/258562#M1819</guid>
      <dc:creator>HeadScratcher</dc:creator>
      <dc:date>2024-10-08T10:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using Workflow and Developer SDK to update settings.  What are my validation errors?</title>
      <link>https://community.dynatrace.com/t5/Automations/Using-Workflow-and-Developer-SDK-to-update-settings-What-are-my/m-p/258627#M1820</link>
      <description>&lt;P&gt;So&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/47376"&gt;@Fin_Ubels&lt;/a&gt;&amp;nbsp; I eventually got this working as you suggested.&amp;nbsp; &amp;nbsp;It took me ages to get the JSON object copy just right.&amp;nbsp; &amp;nbsp; Am I right in thinking this can be developed in VS Code or some other humane IDE ?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 15:56:53 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Using-Workflow-and-Developer-SDK-to-update-settings-What-are-my/m-p/258627#M1820</guid>
      <dc:creator>HeadScratcher</dc:creator>
      <dc:date>2024-10-08T15:56:53Z</dc:date>
    </item>
  </channel>
</rss>

