trying to create a service activity from a button. I'm System admin so i have all the rigth needed.
here is my code for the service activity parts:
mdf.createProject.createServiceActivities = function (projectGuid, serviceActivities) {
var sa = {
"serviceid@odata.bind" : "/services(01d2bb06-6cf9-ed11-8f6d-000d3ae86452)",
"subject" : serviceActivities.subject,
"regardingobjectid_incident@odata.bind" : "/incidents(" projectGuid ")",
"statecode" : "0"
};
return new Promise(function (resolve, reject) {
Xrm.WebApi.createRecord("serviceappointment", sa).then(
function success(result){
console.log(result);
Xrm.Utility.closeProgressIndicator();
Xrm.Page.getControl('Project').refresh();
resolve(console.log("ENFIN!"))
},
function(error){
Xrm.Utility.closeProgressIndicator();
reject(console.log(error))
}
);
});
}
And the error i get:
- code: 2147746327
- errorCode: 2147746327
- message: "The requested record was not found or you do not have sufficient permissions to view it."
- raw: "{\"errorCode\":2147746327,\"message\":\"The requested record was not found or you do not have sufficient permissions to view it.\",\"code\":2147746327,\"title\":\"Record Is Unavailable\",\"raw\":\"{\\\"_errorCode\\\":2147746327,\\\"_errorFault\\\":{\\\"_responseXml\\\":null,\\\"_errorCode\\\":2147746327,\\\"_innerFault\\\":{\\\"_responseXml\\\":null,\\\"_errorCode\\\":0,\\\"_innerFault\\\":null,\\\"_callStack\\\":null,\\\"_responseText\\\":null,\\\"_annotations\\\":null,\\\"_hasCustomerInfo\\\":false,\\\"_messages\\\":[\\\"Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\"},\\\"_callStack\\\":null,\\\"_responseText\\\":\\\"{\\\\\\\"error\\\\\\\":{\\\\\\\"code\\\\\\\":\\\\\\\"0x80040217\\\\\\\",\\\\\\\"message\\\\\\\":\\\\\\\"Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\\\\\",\\\\\\\"@Microsoft.PowerApps.CDS.HelpLink\\\\\\\":\\\\\\\""@Microsoft.PowerApps.CDS.TraceText\\\\\\\":\\\\\\\"[Microsoft.Dynamics.Service.Plugins:">go.microsoft.com/.../ Microsoft.Dynamics.Service.Plugins.PreOperationServiceAppointmentCreate\\\\\\\\r\\\\\\\\n[3f95a566-54ff-e611-80e7-00155db32b08: Create of serviceappointment\\\\\\\\r\\\\\\\\nEntered Microsoft.Dynamics.Service.Plugins.PreOperationServiceAppointmentCreate.Execute(), Correlation Id: 73633c68-18ca-4296-8b90-16ed7f254cb1, Initiating User: fe68f04b-3f9c-ed11-aad1-0022483c8531\\\\\\\\r\\\\\\\\nException: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault: Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist (Fault Detail is equal to Exception details: \\\\\\\\r\\\\\\\\nErrorCode: 0x80040217\\\\\\\\r\\\\\\\\nMessage: Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\\\\\\r\\\\\\\\nTimeStamp: 2023-06-01T16:25:08.1774955Z\\\\\\\\r\\\\\\\\n--\\\\\\\\r\\\\\\\\nException details: \\\\\\\\r\\\\\\\\nErrorCode: 0x80040217\\\\\\\\r\\\\\\\\nMessage: Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\\\\\\r\\\\\\\\nTimeStamp: 2023-06-01T16:25:08.1774955Z\\\\\\\\r\\\\\\\\n--\\\\\\\\r\\\\\\\\n)., Correlation Id: 73633c68-18ca-4296-8b90-16ed7f254cb1, Initiating User: fe68f04b-3f9c-ed11-aad1-0022483c8531\\\\\\\\r\\\\\\\\nExiting Microsoft.Dynamics.Service.Plugins.PreOperationServiceAppointmentCreate.Execute(), Correlation Id: 73633c68-18ca-4296-8b90-16ed7f254cb1, Initiating User: fe68f04b-3f9c-ed11-aad1-0022483c8531\\\\\\\",\\\\\\\"@Microsoft.PowerApps.CDS.InnerError.Message\\\\\\\":\\\\\\\"Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\\\\\"}}\\\",\\\"_annotations\\\":{\\\"@Microsoft.PowerApps.CDS.HelpLink\\\":\\\""@Microsoft.PowerApps.CDS.TraceText\\\":\\\"[Microsoft.Dynamics.Service.Plugins:">go.microsoft.com/.../ Microsoft.Dynamics.Service.Plugins.PreOperationServiceAppointmentCreate\\\\r\\\\n[3f95a566-54ff-e611-80e7-00155db32b08: Create of serviceappointment\\\\r\\\\nEntered Microsoft.Dynamics.Service.Plugins.PreOperationServiceAppointmentCreate.Execute(), Correlation Id: 73633c68-18ca-4296-8b90-16ed7f254cb1, Initiating User: fe68f04b-3f9c-ed11-aad1-0022483c8531\\\\r\\\\nException: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault: Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist (Fault Detail is equal to Exception details: \\\\r\\\\nErrorCode: 0x80040217\\\\r\\\\nMessage: Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\\r\\\\nTimeStamp: 2023-06-01T16:25:08.1774955Z\\\\r\\\\n--\\\\r\\\\nException details: \\\\r\\\\nErrorCode: 0x80040217\\\\r\\\\nMessage: Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\\r\\\\nTimeStamp: 2023-06-01T16:25:08.1774955Z\\\\r\\\\n--\\\\r\\\\n)., Correlation Id: 73633c68-18ca-4296-8b90-16ed7f254cb1, Initiating User: fe68f04b-3f9c-ed11-aad1-0022483c8531\\\\r\\\\nExiting Microsoft.Dynamics.Service.Plugins.PreOperationServiceAppointmentCreate.Execute(), Correlation Id: 73633c68-18ca-4296-8b90-16ed7f254cb1, Initiating User: fe68f04b-3f9c-ed11-aad1-0022483c8531\\\",\\\"@Microsoft.PowerApps.CDS.InnerError.Message\\\":\\\"Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\"},\\\"_hasCustomerInfo\\\":false,\\\"_messages\\\":[\\\"Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\"},\\\"_message\\\":\\\"Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\",\\\"_exception\\\":null,\\\"_innerError\\\":null,\\\"_errorSource\\\":3,\\\"_blockErrorReporting\\\":false,\\\"_stack\\\":null,\\\"_faultedRequestIndex\\\":-1,\\\"_clientRequestId\\\":\\\"36331c07-113d-410f-90fe-5bb757a2226b\\\",\\\"_serverResponseId\\\":\\\"7dd7d1b0-d3ba-403d-b037-2dd3f2b93f1d, 82ec11ae-78c2-45ce-93c3-0bc049be3a1a\\\",\\\"_httpStatusCode\\\":404,\\\"_retryAfter\\\":null,\\\"_date\\\":\\\"2023-06-01T16:25:07.000Z\\\",\\\"_isRequestTooLong\\\":false,\\\"message\\\":\\\"Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist\\\",\\\"name\\\":\\\"Error\\\",\\\"stack\\\":\\\"No stack available.\\\",\\\"__action\\\":{\\\"source\\\":{\\\"actionType\\\":\\\"modernDataSource.execute.odata.async\\\",\\\"actionStack\\\":\\\"modernDataSource.execute.odata.async\\\",\\\"contextId\\\":\\\"266b8f79-ec14-49e3-9fb9-986c5d5febfe\\\"},\\\"child\\\":{\\\"actionType\\\":\\\"oData.create.async\\\",\\\"actionStack\\\":\\\"oData.create.async\\\",\\\"contextId\\\":\\\"046515b2-830e-4377-ad20-cb2d3f7f0928\\\"}}}\"}"
- title: "Record Is Unavailable"
And this one:
app.js?v=1.4.5757-2305.3:28 [storage Error Messages:
1: Entity 'serviceappointment' With Id = 480840da-9800-ee11-8f6d-000d3ae86f5e Does Not Exist
at K (mdf-carrusdev.crm3.dynamics.com/.../app.js
at new u (mdf-carrusdev.crm3.dynamics.com/.../app.js
at mdf-carrusdev.crm3.dynamics.com/.../mds.js
at mdf-carrusdev.crm3.dynamics.com/.../mds.js
at async Object.execute (mdf-carrusdev.crm3.dynamics.com/.../mds.js
Call stack hash: -2095811475
already try to clear my cache
Any idea?