Guest User

Untitled

a guest
May 5th, 2023
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.83 KB | None | 0 0
  1. {"$return_value":{"message":"Request failed with status code 500","name":"Error","stack":" at null.e.exports (/tmp/__pdg__/dist/code/4ef9e919b114da15d1f9c2bb4e9a4bf4ed93f5ae57f6f3df7ac4818ad961f84f/node_modules/.pnpm/[email protected]/node_modules/salesforce-webhooks/dist/index.js:1:6999)\n at null.e.exports (/tmp/__pdg__/dist/code/4ef9e919b114da15d1f9c2bb4e9a4bf4ed93f5ae57f6f3df7ac4818ad961f84f/node_modules/.pnpm/[email protected]/node_modules/salesforce-webhooks/dist/index.js:1:7822)\n at IncomingMessage.null (/tmp/__pdg__/dist/code/4ef9e919b114da15d1f9c2bb4e9a4bf4ed93f5ae57f6f3df7ac4818ad961f84f/node_modules/.pnpm/[email protected]/node_modules/salesforce-webhooks/dist/index.js:1:38018)\n at IncomingMessage.emit (events.js:412:35)\n at null.endReadableNT (internal/streams/readable.js:1333:12)\n at process.processTicksAndRejections (internal/process/task_queues.js:82:21)\n","config":{"url":"https://welcome.my.salesforce.com/services/Soap/s/50.0","method":"post","data":"<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <env:Header>\n <urn:SessionHeader xmlns:urn=\"http://soap.sforce.com/2006/08/apex\">\n <urn:sessionId>00D3t000004iBCU!ARUAQBFoGodB5fyYPTh7jpmiey46DtKGpmqy3GBZEGdehKGoj3Fh7ik7O8JX3PXHNqITCU9ublA84f4Ksi.ZSNu5k5oQSZZF</urn:sessionId>\n </urn:SessionHeader>\n </env:Header>\n <env:Body>\n <compileAndTest xmlns=\"http://soap.sforce.com/2006/08/apex\">\n <CompileAndTestRequest>\n <classes>/**\n Copyright 2011 Mavens Consulting, Inc.\n\n Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an &quot;AS IS&quot; BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n@isTest\npublic with sharing class SW_SObjectFactory_68096e24a3ddbdb6212a78 {\n public static Boolean FillAllFields &#x3D; false;\n\n // Key : SobjectAPIName For ex. Account\n // Value : Map&lt;String, Schema.SObjectField&gt;, field map (k:fieldname, v:Schema.Sobjectfield)\n public static Profile userProfile &#x3D; [\n SELECT Id\n FROM Profile\n WHERE Name &#x3D; &#x27;System Administrator&#x27;\n ];\n\n private static final Map&lt;String, Map&lt;String, Schema.SObjectField&gt;&gt; FieldMapCache &#x3D;\n new Map&lt;String, Map&lt;String, Schema.SObjectField&gt;&gt;();\n\n private static final Map&lt;String, Schema.SObjectType&gt; GlobalDescribe &#x3D;\n Schema.getGlobalDescribe();\n\n private static final Map&lt;String, SObject&gt; SObjectCache &#x3D;\n new Map&lt;String, SObject&gt;();\n\n // Default Country and State\n // When Country and State Picklists are enabled, cannot dynamically resolve which States are within a Country\n public static string DefaultCountry &#x3D; &#x27;United States&#x27;;\n public static string DefaultCountryCode &#x3D; &#x27;US&#x27;;\n public static string DefaultState &#x3D; &#x27;Pennsylvania&#x27;;\n public static string DefaultStateCode &#x3D; &#x27;PA&#x27;;\n\n // Key: sobject.field\n // Value: first picklist value\n private static final Map&lt;String, String&gt; DefaultPicklistValue &#x3D;\n new Map&lt;String, String&gt;();\n\n // can&#x27;t map by Schema.sObjectType, use object name String instead\n public static Map&lt;String, Set&lt;String&gt;&gt; ExcludedFields &#x3D; new Map&lt;String, Set&lt;String&gt;&gt; {\n &#x27;All&#x27; &#x3D;&gt; new Set&lt;String&gt; {\n &#x27;CreatedById&#x27;,\n &#x27;CreatedDate&#x27;,\n &#x27;LastModifiedById&#x27;,\n &#x27;LastModifiedDate&#x27;,\n &#x27;OwnerId&#x27;\n },\n &#x27;Account&#x27; &#x3D;&gt; new Set&lt;String&gt; {\n &#x27;FirstName&#x27;,\n &#x27;LastName&#x27;\n },\n &#x27;User&#x27; &#x3D;&gt; new Set&lt;String&gt; {\n &#x27;CallCenterId&#x27;,\n &#x27;ContactId&#x27;,\n &#x27;DelegatedApproverId&#x27;,\n &#x27;FederationIdentifier&#x27;,\n &#x27;IsActive&#x27;,\n &#x27;ManagerId&#x27;,\n &#x27;UserRoleId&#x27;\n }\n };\n\n // include nillable fields\n public static Map&lt;String, Set&lt;String&gt;&gt; IncludedFields &#x3D; new Map&lt;String, Set&lt;String&gt;&gt; {\n &#x27;ContentVersion&#x27; &#x3D;&gt; new Set&lt;String&gt; {\n &#x27;ContentUrl&#x27;\n }\n };\n\n public static SObject createSObject(String objectType) {\n return createSObject(objectType, false);\n }\n\n public static List&lt;SObject&gt; createSObjectList(\n String objectType,\n Boolean cascade,\n Integer numberOfObjects\n ) {\n return createSObjectList(objectType, cascade, 0, numberOfObjects);\n }\n\n public static List&lt;SObject&gt; createSObjectList(\n String objectType,\n Boolean cascade,\n Integer initialCounter,\n Integer numberOfObjects\n ) {\n List&lt;SObject&gt; sos &#x3D; new List&lt;SObject&gt;();\n for( Integer i &#x3D; 0; i &lt; numberOfObjects; i++ ) {\n SObjectCache.clear();\n Integer counter &#x3D; i + initialCounter;\n sos.add(createSObject(objectType, cascade, counter));\n }\n return sos;\n }\n\n private static SObject newInstance(String objectType) {\n final Schema.sObjectType token &#x3D; GlobalDescribe.get(objectType);\n if (token &#x3D;&#x3D; null) {\n throw new IllegalArgumentException(&#x27;Unsupported ObjectType &#x27; + objectType);\n } else if (!token.getDescribe().isCreateable()) {\n System.debug(String.format(\n &#x27;Type &quot;{0}&quot; is not createable, setting to &quot;null&quot;&#x27;,\n new List&lt;String&gt; {\n objectType\n }\n ));\n return null;\n }\n return token.newSObject();\n }\n\n private static SObject getSObjectFromCache(String objectType, Boolean isRoot) {\n if (!SObjectCache.containsKey(objectType)) {\n final SObject obj &#x3D; newInstance(objectType);\n SObjectCache.put(objectType, obj);\n return obj;\n }\n\n System.debug(String.format(\n &#x27;Retrieving cached instance of type {0}&#x27;,\n new List&lt;String&gt; {\n objectType\n }\n ));\n\n final SObject obj &#x3D; SObjectCache.get(objectType);\n if (obj !&#x3D; null &amp;&amp; obj.Id &#x3D;&#x3D; null &amp;&amp; !isRoot) {\n System.debug(String.format(\n &#x27;Persisting cached object of type &quot;{0}&quot; since &#x27; +\n &#x27;it\\&#x27;s only in memory and doesn\\&#x27;t have an ID yet&#x27;,\n new List&lt;String&gt; {\n objectType\n }\n ));\n insert obj;\n SObjectCache.put(objectType, obj);\n }\n\n return obj;\n }\n\n public static SObject createSObject(String objectType, Boolean cascade, Integer counter) {\n return createSObject(objectType, cascade, counter, true);\n }\n\n public static SObject createSObject(\n String objectType,\n Boolean cascade,\n Integer counter,\n Boolean isRoot\n ) {\n final SObject obj &#x3D; getSObjectFromCache(objectType, isRoot);\n if (obj &#x3D;&#x3D; null || obj.Id !&#x3D; null) {\n return obj;\n }\n\n for (Schema.SObjectField field : fieldMapFor(objectType).values()) {\n setFieldValue(obj, field, cascade, counter);\n }\n\n if (obj.Id &#x3D;&#x3D; null &amp;&amp; !isRoot) {\n System.debug(&#x27;Inserting child node &#x27; + obj);\n insert obj;\n }\n\n SObjectCache.put(objectType, obj);\n return obj;\n }\n\n public static SObject createSObject(String objectType, Boolean cascade) {\n return createSObject(objectType, cascade, 1);\n }\n\n /**\n Returns a field map for a given sobject.\n\n Note : this method is kept public for Test cases to share the same field map info, without requiring a field desribe.\n\n @param objectType sobject api name for ex. Account\n @returns FieldMap [Key:FieldName,Value:Schema.SObjectField]\n */\n public static Map&lt;String, Schema.SObjectField&gt; fieldMapFor(String objectType) {\n Map&lt;String, Schema.SObjectField&gt; fieldMap &#x3D; null;\n String normalizedObjectType &#x3D; objectType.toLowerCase();\n\n if (FieldMapCache.containsKey(normalizedObjectType)) {\n fieldMap &#x3D; FieldMapCache.get(normalizedObjectType);\n } else {\n fieldMap &#x3D; GlobalDescribe.get(objectType).getDescribe().fields.getMap();\n // cache it for next use\n FieldMapCache.put(normalizedObjectType, fieldMap);\n }\n\n return fieldMap;\n }\n\n static String getDefaultPicklistValue(SObject obj, Schema.DescribeFieldResult fieldDescribe) {\n String key &#x3D; obj.getSObjectType() + &#x27;.&#x27; + fieldDescribe.getName();\n\n if (!DefaultPicklistValue.containsKey(key)) {\n List&lt;Schema.PicklistEntry&gt; entries &#x3D; fieldDescribe.getPicklistValues();\n String value &#x3D; entries.size() &gt; 0 ? entries[0].getValue() : null;\n DefaultPicklistValue.put(key, value);\n }\n\n return DefaultPicklistValue.get(key);\n }\n\n static Boolean isExcludedField(Schema.DescribeFieldResult fieldDescribe) {\n return ExcludedFields.get(&#x27;All&#x27;).contains(fieldDescribe.getName());\n }\n\n static Boolean isExcludedField(SObject obj, Schema.DescribeFieldResult fieldDescribe) {\n Set&lt;String&gt; fields &#x3D; ExcludedFields.get(obj.getSObjectType().getDescribe().getName());\n return fields &#x3D;&#x3D; null ? false : fields.contains(fieldDescribe.getName());\n }\n\n static Boolean isIncludedField(SObject obj, Schema.DescribeFieldResult fieldDescribe) {\n Set&lt;String&gt; fields &#x3D; includedFields.get(obj.getSObjectType().getDescribe().getName());\n return fields &#x3D;&#x3D; null ? false : fields.contains(fieldDescribe.getName());\n }\n\n static Boolean isPersonAccountField(Schema.DescribeFieldResult fieldDescribe) {\n Boolean isPersonAccountEnabled &#x3D; fieldMapFor(&#x27;Account&#x27;).get(&#x27;IsPersonAccount&#x27;) !&#x3D; null;\n Set&lt;string&gt; skipPersonAccountFields &#x3D; new Set&lt;string&gt;{ &#x27;Salutation&#x27; };\n\n Boolean CustomPerson &#x3D; fieldDescribe.isCustom() &amp;&amp; fieldDescribe.getName().endsWith(&#x27;pc&#x27;);\n Boolean StandardPerson &#x3D; !fieldDescribe.isCustom() &amp;&amp; fieldDescribe.getName().startsWith(&#x27;Person&#x27;);\n\n return (\n CustomPerson ||\n StandardPerson ||\n (isPersonAccountEnabled &amp;&amp; skipPersonAccountFields.contains(fieldDescribe.getName()))\n );\n }\n\n static void setFieldValue(SObject obj, Schema.SObjectField field, Boolean cascade) {\n setFieldValue(obj, field, cascade, 0);\n }\n\n private static Boolean shouldIncludeField(\n Schema.DescribeFieldResult fieldDescribe,\n SObject obj,\n Boolean cascade\n ) {\n return (\n fieldDescribe.getName() &#x3D;&#x3D; &#x27;IsActive&#x27; ||\n (\n fieldDescribe.isCreateable() &amp;&amp;\n !fieldDescribe.isDefaultedOnCreate() &amp;&amp;\n (\n isIncludedField(obj, fieldDescribe) ||\n (\n (\n FillAllFields ||\n !fieldDescribe.isNillable() ||\n (\n // Always fill references with cascade if they are not nillable\n cascade &amp;&amp;\n fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Reference\n )\n ) &amp;&amp;\n !isExcludedField(fieldDescribe) &amp;&amp;\n !isExcludedField(obj, fieldDescribe) &amp;&amp;\n !isPersonAccountField(fieldDescribe)\n )\n )\n )\n );\n }\n\n static void setFieldValue(\n SObject obj,\n Schema.SObjectField field,\n Boolean cascade,\n Integer counter\n ) {\n Schema.DescribeFieldResult fieldDescribe &#x3D; field.getDescribe();\n if (shouldIncludeField(fieldDescribe, obj, cascade)) {\n if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Picklist) {\n // Picklist goes first, since we potential values are ready to be grabbed,\n // and we can&#x27;t really use any other value anyways.\n obj.put(field, getDefaultPicklistValue(obj, fieldDescribe));\n } else if (fieldDescribe.getName().endsWith(&#x27;Country&#x27;)) {\n obj.put(field, DefaultCountry);\n } else if (fieldDescribe.getName().endsWith(&#x27;State&#x27;)) {\n obj.put(field, DefaultState);\n } else if (fieldDescribe.getName().endsWith(&#x27;CountryCode&#x27;)) {\n obj.put(field, DefaultCountryCode);\n } else if (fieldDescribe.getName().endsWith(&#x27;StateCode&#x27;)) {\n obj.put(field, DefaultStateCode);\n } else if (\n fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.URL ||\n fieldDescribe.getName().endsWith(&#x27;Url&#x27;)\n ) {\n String value &#x3D; String.format(\n &#x27;http://test{0}.com&#x27;,\n new List&lt;String&gt; {\n counter.format()\n }\n );\n obj.put(field, value);\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.base64) {\n Integer randomComponent &#x3D; (Integer) (Math.random() * 1000);\n String value &#x3D; String.format(\n &#x27;{0}-{1}&#x27;,\n new List&lt;String&gt; {\n counter.format(),\n randomComponent.format()\n }\n );\n obj.put(field, Blob.valueOf(value));\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Boolean) {\n obj.put(field, true);\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Combobox) {\n obj.put(field, counter.format());\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Currency) {\n obj.put(field, counter);\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Date) {\n obj.put(field, Date.today());\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.DateTime) {\n obj.put(field, DateTime.now());\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Double) {\n obj.put(field, counter);\n } else if (\n fieldDescribe.getName() &#x3D;&#x3D; &#x27;Username&#x27; ||\n fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Email\n ) {\n Long randomComponent &#x3D; Math.roundToLong(Math.random() * 1000);\n String dateComponent &#x3D; String.valueOf(Datetime.now().getTime());\n String value &#x3D; String.format(\n &#x27;test{0}{1}@test.com&#x27;,\n new List&lt;String&gt; {\n randomComponent.format(),\n dateComponent\n }\n );\n obj.put(field, value);\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.EncryptedString) {\n obj.put(field, &#x27;s&#x27;);\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Id) {\n // Ignore, we don&#x27;t specify ID&#x27;s when creating objects.\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Integer) {\n Integer value &#x3D; (Integer) (Math.random() * 30);\n obj.put(field, value);\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.MultiPicklist) {\n obj.put(field, getDefaultPicklistValue(obj, fieldDescribe));\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Percent) {\n obj.put(field, counter);\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Phone) {\n obj.put(field, &#x27;123-456-7890&#x27;);\n } else if (\n fieldDescribe.getName() &#x3D;&#x3D; &#x27;CommunityNickname&#x27; &amp;&amp;\n fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.String\n ) {\n Long randomComponent &#x3D; Math.roundToLong(Math.random() * 1000);\n String value &#x3D; String.format(\n &#x27;test{0}&#x27;,\n new List&lt;String&gt; {\n randomComponent.format()\n }\n );\n obj.put(field, value);\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.String) {\n Long randomComponent &#x3D; Math.roundToLong(Math.random() * 1000);\n Integer maxLength &#x3D; fieldDescribe.getLength();\n String preliminaryValue &#x3D; String.format(\n &#x27;a{0}{1}&#x27;,\n new List&lt;String&gt; {\n counter.format(),\n randomComponent.format()\n }\n );\n Integer valueLength &#x3D; Math.min(maxLength, preliminaryValue.length());\n String value &#x3D; preliminaryValue.substring(0, valueLength);\n obj.put(field, value);\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Reference) {\n String referenceObjectType &#x3D; fieldDescribe.getReferenceTo()[0].getDescribe().getName();\n\n if (referenceObjectType &#x3D;&#x3D; &#x27;RecordType&#x27;) {\n setRecordType(obj);\n } else if (referenceObjectType &#x3D;&#x3D; &#x27;Profile&#x27;) {\n obj.put(field,userProfile.Id);\n } else if (\n cascade &amp;&amp;\n referenceObjectType !&#x3D; obj.getSObjectType().getDescribe().getName() &amp;&amp;\n referenceObjectType !&#x3D; &#x27;BusinessHours&#x27;\n ) {\n System.debug(\n String.format(\n &#x27;Creating reference to {0} for field {1}.{2}&#x27;,\n new List&lt;String&gt; {\n referenceObjectType,\n obj.getSObjectType().getDescribe().getName(),\n fieldDescribe.getName()\n }\n )\n );\n SObject reference &#x3D; createSObject(referenceObjectType, cascade, counter + 1, false);\n if (reference &#x3D;&#x3D; null) {\n System.debug(&#x27;Skipping instance of type &#x27; + referenceObjectType);\n obj.put(field, null);\n return;\n }\n\n obj.put(field, reference.Id);\n }\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.TextArea) {\n obj.put(field, counter.format());\n } else if (fieldDescribe.getType() &#x3D;&#x3D; Schema.DisplayType.Time) {\n obj.put(field, Time.newInstance(0, 0, 0, 0));\n } else {\n System.debug(&#x27;Unhandled field type &#x27; + fieldDescribe.getType());\n }\n }\n }\n\n static void setRecordType(SObject obj) {\n List&lt;Schema.RecordTypeInfo&gt; recordTypes &#x3D; obj.getSObjectType().getDescribe().getRecordTypeInfos();\n if (recordTypes.size() &gt; 1) { // All objects have default Master type\n for (Schema.RecordTypeInfo recordType : recordTypes) {\n if (recordType.isAvailable() &amp;&amp; recordType.isDefaultRecordTypeMapping()) {\n obj.put(&#x27;RecordTypeId&#x27;, recordType.getRecordTypeId());\n }\n }\n }\n }\n}\n</classes>\n <classes>public abstract class SW_Callout_b49c07ec26f0c217c9a33fd1796c {\n\n public static String jsonContent(final Map&lt;String, Object&gt; eventContent) {\n final Map&lt;String, Object&gt; content &#x3D; new Map&lt;String, Object&gt;(eventContent);\n content.put(&#x27;UserId&#x27;, UserInfo.getUserId());\n return JSON.serialize(content);\n }\n\n @future(callout&#x3D;true)\n public static void callout(final String url, final String content) {\n final HttpRequest request &#x3D; new HttpRequest();\n request.setEndpoint(url);\n request.setMethod(&#x27;POST&#x27;);\n request.setHeader(&#x27;Content-Type&#x27;, &#x27;application/json&#x27;);\n request.setHeader(&#x27;X-Webhook-Token&#x27;, &#x27;secret&#x27;);\n request.setBody(content);\n\n final Http http &#x3D; new Http();\n http.send(request);\n }\n\n}\n</classes>\n <classes>@isTest\nglobal class SW_CalloutMock_6f12a05b60982152ddf5f330 implements HttpCalloutMock {\n private String endpointUrl;\n\n global SW_CalloutMock_6f12a05b60982152ddf5f330(String endpointUrl) {\n this.endpointUrl &#x3D; endpointUrl;\n }\n\n global HTTPResponse respond(HTTPRequest req) {\n System.assertEquals(&#x27;POST&#x27;, req.getMethod());\n\n HttpResponse res &#x3D; new HttpResponse();\n res.setHeader(&#x27;Content-Type&#x27;, &#x27;application/json&#x27;);\n res.setBody(&#x27;{&quot;example&quot;: &quot;test&quot;}&#x27;);\n res.setStatusCode(200);\n return res;\n }\n}\n</classes>\n <classes>@isTest\npublic class SW_Test_f020bfc24f991495af4e28ff6cae171b {\n @isTest\n static void testBatch() {\n Test.enableChangeDataCapture();\n\n Test.setMock(HttpCalloutMock.class, new SW_CalloutMock_6f12a05b60982152ddf5f330(&#x27;https://www.unexistent-endpoint-10845209472.com&#x27;));\n List&lt;User&gt; a &#x3D;\n (List&lt;User&gt;) SW_SObjectFactory_68096e24a3ddbdb6212a78.createSObjectList(&#x27;User&#x27;, true, 4);\n insert a;\n\n Test.getEventBus().deliver();\n }\n @isTest\n static void testSingle() {\n Test.enableChangeDataCapture();\n\n Test.setMock(HttpCalloutMock.class, new SW_CalloutMock_6f12a05b60982152ddf5f330(&#x27;https://www.unexistent-endpoint-10845209472.com&#x27;));\n User a &#x3D; (User) SW_SObjectFactory_68096e24a3ddbdb6212a78.createSObject(&#x27;User&#x27;, true);\n insert a;\n\n Test.getEventBus().deliver();\n }\n}\n</classes>\n\n <triggers>trigger SW_Trigger_f35f8655a60e2cf72e0abc26174e on User (after insert) {\n final List&lt;SObjectField&gt; fields &#x3D; User.getSObjectType()\n .getDescribe()\n .fields\n .getMap()\n .values();\n final List&lt;String&gt; fieldNames &#x3D; new List&lt;String&gt;();\n for (SObjectField f : fields) {\n final String fieldName &#x3D; f.getDescribe().getName();\n fieldNames.add(fieldName);\n }\n final String joinedFieldNames &#x3D; String.join(fieldNames, &#x27;, &#x27;);\n for (SObject item : Trigger.New) {\n final String query &#x3D; String.format(\n &#x27;SELECT {0} FROM User WHERE Id &#x3D; \\&#x27;\\&#x27;{1}\\&#x27;\\&#x27;&#x27;,\n new List&lt;String&gt; {\n joinedFieldNames,\n String.valueOf(item.Id)\n }\n );\n final User itemFull &#x3D; (User) Database.query(query);\n\n final Map&lt;String, User&gt; eventData &#x3D; new Map&lt;String, User&gt;();\n eventData.put(&#x27;New&#x27;, itemFull);\n\n final String content &#x3D; SW_Callout_b49c07ec26f0c217c9a33fd1796c.jsonContent(eventData);\n SW_Callout_b49c07ec26f0c217c9a33fd1796c.callout(&#x27;https://www.unexistent-endpoint-10845209472.com&#x27;, content);\n }\n}\n</triggers>\n\n <runTestsRequest>\n <allTests>true</allTests>\n </runTestsRequest>\n </CompileAndTestRequest>\n </compileAndTest>\n </env:Body>\n</env:Envelope>\n","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"text/xml","Authorization":"Bearer 00D3t000004iBCU!ARUAQBFoGodB5fyYPTh7jpmiey46DtKGpmqy3GBZEGdehKGoj3Fh7ik7O8JX3PXHNqITCU9ublA84f4Ksi.ZSNu5k5oQSZZF","SOAPAction":"compileAndTest","User-Agent":"axios/0.21.4","Content-Length":24281},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false}}}}
Add Comment
Please, Sign In to add comment