<?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: Uncaught TypeError: C.createPostQuery is not a function in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1146720#M76436</link>
    <description>&lt;P&gt;Thank you for the update. I will give that a try. Have a good evening.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Feb 2022 21:59:54 GMT</pubDate>
    <dc:creator>RichardDuty</dc:creator>
    <dc:date>2022-02-22T21:59:54Z</dc:date>
    <item>
      <title>Uncaught TypeError: C.createPostQuery is not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1087208#M74211</link>
      <description>&lt;P&gt;I'm trying to save a layer created on client web application using JavaScript API 4.20 to the user's portal. I'm using portal.user.addItem function but get error, "Uncaught TypeError: C.createPostQuery is not a function".&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any examples of saving a layer to user's portal using portal.user.addItem? I can successfully read user's layers from the portal, and save one back (changing some values to make it unique). Is the issue that the layer is created on the client (FeatureLayer) and then saved to the portal? Any way of doing this with the JavaScript API?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any info appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 18:32:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1087208#M74211</guid>
      <dc:creator>RobertBossio</dc:creator>
      <dc:date>2021-08-09T18:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Uncaught TypeError: C.createPostQuery is not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1146703#M76433</link>
      <description>&lt;P&gt;Hello Robert, were you able to figure out what was wrong here? I currently have the same issue. I was able to save a new item at some point although it was not sending the geometries with it. Since then I've implemented some other features into my project but now that I've come back to this I get this error.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 21:30:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1146703#M76433</guid>
      <dc:creator>RichardDuty</dc:creator>
      <dc:date>2022-02-22T21:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Uncaught TypeError: C.createPostQuery is not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1146714#M76435</link>
      <description>&lt;P&gt;Hi Richard - I've since abandoned how I was doing that. The correct approach (with help from an Esri developer) to save a layer/map from Web application is to follow these 3 steps, calling the Esri RESTful API:&lt;/P&gt;&lt;P&gt;1. Create Feature Service (&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/create-service.htm)" target="_blank"&gt;https://developers.arcgis.com/rest/users-groups-and-items/create-service.htm)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2. Add to Definition (to feature service) - (&lt;A href="https://developers.arcgis.com/rest/services-reference/online/add-to-definition-feature-service-.htm" target="_blank"&gt;https://developers.arcgis.com/rest/services-reference/online/add-to-definition-feature-service-.htm&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;3. AddFeatures (adds points to definition) - (&lt;A href="https://developers.arcgis.com/rest/services-reference/enterprise/add-features.htm)" target="_blank"&gt;https://developers.arcgis.com/rest/services-reference/enterprise/add-features.htm)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Note: You have to be logged-in to an existing Esri account (ArcGIS Online or an Enterprise instance)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 21:54:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1146714#M76435</guid>
      <dc:creator>rbossio</dc:creator>
      <dc:date>2022-02-22T21:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Uncaught TypeError: C.createPostQuery is not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1146720#M76436</link>
      <description>&lt;P&gt;Thank you for the update. I will give that a try. Have a good evening.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 21:59:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1146720#M76436</guid>
      <dc:creator>RichardDuty</dc:creator>
      <dc:date>2022-02-22T21:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Uncaught TypeError: C.createPostQuery is not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1147199#M76459</link>
      <description>&lt;P&gt;I was finally able to get the service created through the method that you shared but I am a little lost on what the URLs should look like for the other two steps. Can you provide any insight on those?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 20:08:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1147199#M76459</guid>
      <dc:creator>RichardDuty</dc:creator>
      <dc:date>2022-02-23T20:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Uncaught TypeError: C.createPostQuery is not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1155887#M76733</link>
      <description>&lt;P&gt;Hi Richard - sorry for the delay as I'm just now noticing your request. Here's example URLs. Hope this helps if you haven't already figured it out:&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;1. CreateFeatureLayer&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;var createParameters = {&lt;BR /&gt;"name": `some unique name`,&lt;BR /&gt;"hasStaticData": false,&lt;BR /&gt;"maxRecordCount": 1000000,&lt;BR /&gt;"supportedQueryFormats": "JSON",&lt;BR /&gt;"capabilities": "Create,Delete,Query,Update,Editing",&lt;BR /&gt;"description": description,&lt;BR /&gt;"copyrightText": "&amp;amp;copy;2021 Company",&lt;BR /&gt;"spatialReference": {&lt;BR /&gt;"wkid": 102100,&lt;BR /&gt;"latestWkid": 102100&lt;BR /&gt;},&lt;BR /&gt;"minScale": 0,&lt;BR /&gt;"maxScale": 0,&lt;BR /&gt;"allowGeometryUpdates": true,&lt;BR /&gt;"units": "esriMeters",&lt;BR /&gt;"xssPreventionInfo": {&lt;BR /&gt;"xssPreventionEnabled": true,&lt;BR /&gt;"xssPreventionRule": "input",&lt;BR /&gt;"xssInputRule": "rejectInvalid"&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;const settings = {&lt;BR /&gt;"url": portal.user.userContentUrl + "/createservice",&lt;BR /&gt;"method": "POST",&lt;BR /&gt;"timeout": 0,&lt;BR /&gt;"headers": {&lt;BR /&gt;"Content-Type": "application/x-www-form-urlencoded"&lt;BR /&gt;},&lt;BR /&gt;"data": {&lt;BR /&gt;"createparameters": JSON.stringify(createParameters),&lt;BR /&gt;"f": "json",&lt;BR /&gt;"token": portal.credential.token,&lt;BR /&gt;"outputtype": "featureService",&lt;BR /&gt;"description": "some Description",&lt;BR /&gt;"tags": "tag",&lt;BR /&gt;"snippet": "some snippet info"&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;$.ajax(settings)&lt;BR /&gt;.done(function (response) {&lt;BR /&gt;try {&lt;BR /&gt;if (response.success) {&lt;BR /&gt;return resolve(response);&lt;BR /&gt;} else {&lt;BR /&gt;return reject(response);&lt;BR /&gt;}&lt;BR /&gt;} catch (error) {&lt;BR /&gt;return reject(error);&lt;BR /&gt;}&lt;BR /&gt;}).fail(function (xhr, status, error) {&lt;BR /&gt;return reject(error);&lt;BR /&gt;});&lt;BR /&gt;} catch (error) {&lt;BR /&gt;return reject(error);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;2. addToDefinition&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;const YOUR_TOKEN = portal.credential.token;&lt;BR /&gt;const SERVICE_NAME = serviceName; // returned from CreateFeatureLayer&lt;BR /&gt;const HOST = host; // returned from CreateFeatureLayer, something like Service7&lt;BR /&gt;const INSTANCE = portal.id; // Something like: d9R4ThD32qsG1Wu4&lt;BR /&gt;let apiUrl = `https://${HOST}.arcgis.com/${INSTANCE}/arcgis/rest/admin/services/${SERVICE_NAME}/FeatureServer/addToDefinition`;&lt;/P&gt;&lt;P&gt;var layerDefinition = {&lt;BR /&gt;layers: [&lt;BR /&gt;{&lt;BR /&gt;"id": 0,&lt;BR /&gt;"name": "Unique Name",&lt;BR /&gt;"type": "Feature Layer",&lt;BR /&gt;"allowGeometryUpdates": true,&lt;BR /&gt;"description": "Feature Layer that contains relative statistcal / analytical data",&lt;BR /&gt;"summary": "Feature layer summary",&lt;BR /&gt;"copyrightText": "&amp;amp;copy;2021 Company",&lt;BR /&gt;"defaultVisiblity": true,&lt;BR /&gt;"visibilityField": "visible",&lt;BR /&gt;"capabilities": "Query,Create,Delete,Update,Editing",&lt;BR /&gt;"geometryType": "esriGeometryPoint",&lt;BR /&gt;"editingInfo": { "lastEditDate": null },&lt;BR /&gt;"hasAttachments": false,&lt;BR /&gt;"hasStaticData": false,&lt;BR /&gt;"hasM": false,&lt;BR /&gt;"hasZ": false,&lt;BR /&gt;"htmlPopupType": "esriServerHTMLPopupTypeAsHTMLText",&lt;BR /&gt;"isDataVersioned": false,&lt;BR /&gt;"maxRecordCount": 100000,&lt;BR /&gt;"standardMaxRecordCount": 100000,&lt;BR /&gt;"tileMaxRecordCount": 8000,&lt;BR /&gt;"maxRecordCountFactor": 1,&lt;BR /&gt;"exceedsLimitFactor": 1,&lt;BR /&gt;"globalIdField": "globalid",&lt;BR /&gt;"objectIdField": "fid",&lt;BR /&gt;"uniqueIdField": {&lt;BR /&gt;"name": "fid",&lt;BR /&gt;"isSystemMaintained": true&lt;BR /&gt;},&lt;BR /&gt;"hasStaticData": false,&lt;BR /&gt;"ownershipBasedAccessControlForFeatures": true,&lt;BR /&gt;"allowTrueCurvesUpdates": true,&lt;BR /&gt;"onlyAllowTrueCurveUpdatesByTrueCurveClients": true,&lt;BR /&gt;"supportedQueryFormats": "JSON, geoJSON",&lt;BR /&gt;"supportsRollbackOnFailureParameter": true,&lt;BR /&gt;"supportsAppend": true,&lt;BR /&gt;"supportsCalculate": true,&lt;BR /&gt;"supportsTruncate": true,&lt;BR /&gt;"supportsAttachmentsResizing": true,&lt;BR /&gt;"supportsStatistics": true,&lt;BR /&gt;"supportsValidateSql": true,&lt;BR /&gt;"supportsCoordinatesQuantization": true,&lt;BR /&gt;"supportsApplyEditsWithGlobalIds": false,&lt;BR /&gt;"supportsAttachmentsByUploadId": true,&lt;BR /&gt;"useStandardizedQueries": true,&lt;BR /&gt;"supportsAdvancedQueries": true,&lt;BR /&gt;"advancedQueryCapabilities": {&lt;BR /&gt;"supportsPagination": true,&lt;BR /&gt;"supportsPaginationOnAggregatedQueries": true,&lt;BR /&gt;"supportsQueryRelatedPagination": true,&lt;BR /&gt;"supportsQueryWithDistance": true,&lt;BR /&gt;"supportsReturningQueryExtent": true,&lt;BR /&gt;"supportsStatistics": true,&lt;BR /&gt;"supportsOrderBy": true,&lt;BR /&gt;"supportsDistinct": true,&lt;BR /&gt;"supportsQueryWithResultType": true,&lt;BR /&gt;"supportsSqlExpression": true,&lt;BR /&gt;"supportsAdvancedQueryRelated": true,&lt;BR /&gt;"supportsCountDistinct": true,&lt;BR /&gt;"supportsLod": true,&lt;BR /&gt;"supportsReturningGeometryCentroid": false,&lt;BR /&gt;"supportsQueryWithDatumTransformation": true,&lt;BR /&gt;"supportsHavingClause": true,&lt;BR /&gt;"supportsOutFieldSQLExpression": true&lt;BR /&gt;},&lt;BR /&gt;"typeIdField": null,&lt;BR /&gt;"indexes": [],&lt;BR /&gt;"types": [],&lt;BR /&gt;"relationships": [],&lt;BR /&gt;"drawingInfo": {&lt;BR /&gt;"renderer": layer.renderer,&lt;BR /&gt;"transparency": 0,&lt;BR /&gt;},&lt;BR /&gt;"extent": {&lt;BR /&gt;"xmin": extent.xmin,&lt;BR /&gt;"ymin": extent.ymin,&lt;BR /&gt;"xmax": extent.xmax,&lt;BR /&gt;"ymax": extent.ymax,&lt;BR /&gt;"spatialReference": {&lt;BR /&gt;"wkid": 102100,&lt;BR /&gt;"latestWkid": 102100&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"fields": [&lt;BR /&gt;{&lt;BR /&gt;"name": "fieldname",&lt;BR /&gt;"alias": "fieldnamealias",&lt;BR /&gt;"type": "esriFieldTypeString",&lt;BR /&gt;"sqlType": "sqlTypeNVarchar",&lt;BR /&gt;"length": 256,&lt;BR /&gt;"nullable": true,&lt;BR /&gt;"editable": true,&lt;BR /&gt;"domain": null,&lt;BR /&gt;"defaultValue": null&lt;BR /&gt;}, .... more fields ....,&lt;BR /&gt;],&lt;BR /&gt;"templates": [&lt;BR /&gt;{&lt;BR /&gt;"name": "New Feature",&lt;BR /&gt;"description": "New Feature Layer",&lt;BR /&gt;"drawingTool": "esriFeatureEditToolPoint",&lt;BR /&gt;"prototype": {&lt;BR /&gt;"attributes": {&lt;BR /&gt;"fieldname": null,&lt;BR /&gt;...more field names...&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;tables: []&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;const settings = {&lt;BR /&gt;"url": apiUrl,&lt;BR /&gt;"method": "POST",&lt;BR /&gt;"timeout": 0,&lt;BR /&gt;"headers": {&lt;BR /&gt;"Content-Type": "application/x-www-form-urlencoded"&lt;BR /&gt;},&lt;BR /&gt;"data": {&lt;BR /&gt;"addToDefinition": JSON.stringify(layerDefinition),&lt;BR /&gt;"f": "json",&lt;BR /&gt;"token": YOUR_TOKEN&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;$.ajax(settings)&lt;BR /&gt;.done(function (response) {&lt;BR /&gt;try {&lt;BR /&gt;if (response.success) {&lt;BR /&gt;return resolve(response);&lt;BR /&gt;} else {&lt;BR /&gt;return reject(response);&lt;BR /&gt;}&lt;BR /&gt;} catch (error) {&lt;BR /&gt;return reject(error);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}).fail(function (xhr, status, error) {&lt;BR /&gt;return reject(error);&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;} catch (error) {&lt;BR /&gt;return reject(error);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;3. Add Features to Layer&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;let serviceUrl = featureServiceURL; //from CreateFeatureLayer response&lt;BR /&gt;let featureSet = features[]; //array of features to add to layer&lt;BR /&gt;const settings = {&lt;BR /&gt;"url": serviceUrl + "/0/addFeatures",&lt;BR /&gt;"method": "POST",&lt;BR /&gt;"timeout": 0,&lt;BR /&gt;"headers": {&lt;BR /&gt;"Content-Type": "application/x-www-form-urlencoded"&lt;BR /&gt;},&lt;BR /&gt;"data": {&lt;BR /&gt;"features": JSON.stringify(featureSet),&lt;BR /&gt;"f": "json",&lt;BR /&gt;"token": token&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;$.ajax(settings)&lt;BR /&gt;.done(function (response) {&lt;BR /&gt;//need to handle for an error coming back as string&lt;BR /&gt;let errorMessage;&lt;BR /&gt;try {&lt;BR /&gt;let responseObj = $.parseJSON(response);&lt;BR /&gt;if (responseObj.error)&lt;BR /&gt;errorMessage = responseObj.error.message;&lt;BR /&gt;} catch (error) {&lt;BR /&gt;//display error&lt;BR /&gt;}&lt;BR /&gt;})&lt;BR /&gt;.fail(function (xhr, status, error) {&lt;BR /&gt;//display error&lt;BR /&gt;});&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 21:00:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-c-createpostquery-is-not-a/m-p/1155887#M76733</guid>
      <dc:creator>rbossio</dc:creator>
      <dc:date>2022-03-21T21:00:09Z</dc:date>
    </item>
  </channel>
</rss>

