Announcements
I am unable to update SdkMessageProcessingStepImage attribute "attributes" by code regardless I use front end (script) or back-end code (plugin). It is not issue of access permission because I still able to create new image record.
I am SysAdmin with read write access to the table:
Here is the error I have "An unexpected error occurred." code: 2147746326
Here is the error.raw:
{
"_errorCode": 2147746326,
"_errorFault": {
"_responseXml": null,
"_errorCode": 2147746326,
"_innerFault": {
"_responseXml": null,
"_errorCode": 0,
"_innerFault": null,
"_callStack": null,
"_responseText": null,
"_annotations": null,
"_messages": [
"An unexpected error occurred."
]
},
"_callStack": null,
"_responseText":
"_annotations": {
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionSourceKey": "Plugin/Microsoft.Crm.ObjectModel.SdkMessageProcessingStepImageService",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiStepKey": <removed>,
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiDepthKey": "1",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiActivityIdKey": <removed>
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiPluginSolutionNameKey": "System",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiStepSolutionNameKey": "System",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionCategory": "SystemFailure",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionMessageName": "UnExpected",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionHttpStatusCode": "400",
"@Microsoft.PowerApps.CDS.HelpLink": "">go.microsoft.com/.../
"@Microsoft.PowerApps.CDS.InnerError.Message": "An unexpected error occurred."
},
"_messages": [
"An unexpected error occurred."
]
},
"_message": "An unexpected error occurred.",
"_exception": null,
"_innerError": null,
"_errorSource": 3,
"_blockErrorReporting": false,
"_stack": null,
"_faultedRequestIndex": -1,
"_clientRequestId": "-----removed-------",
"_serverResponseId": "----removed-------",
"_httpStatusCode": 400,
"_retryAfter": null,
"_date": "2022-04-17T15:18:50.000Z",
"_isRequestTooLong": false,
"message": "An unexpected error occurred.",
"name": "Error",
"stack": "No stack available.",
"__action": {
"source": {
"actionType": "modernDataSource.execute.odata.async",
"actionStack": "modernDataSource.execute.odata.async",
"contextId": "44fdfd71-223e-4188-8bb9-b385459fbcdf"
},
"child": {
"actionType": "oData.update.async",
"actionStack": "oData.update.async",
"contextId": "e38c6209-a6d4-4a91-a923-83cb53584209"
}
}
}
The code that I used to update the SdkMessageProcessingStepImage
Xrm.WebApi.updateRecord("sdkmessageprocessingstepimage", '5c93db9d-fabc-ec11-9840-0022482af29f',{attributes:'statuscode,'}).then(
()=>{},
async (er)=>{
let json = er.raw;
json = await JSON.parse(json);
console.log(json.raw);
}
);
Similarly, the code used to udpate the table in back end:
Entity imageTable = new Entity("sdkmessageprocessingstepimage", new Guid('5c93db9d-fabc-ec11-9840-0022482af29f'));
imageTable["attributes"] = "statuscode";
service.Update(imageTable);
Thank you.
Hi,
You will have to map other attributes also when you are updating the Images.
please see below code which I tried on my instance and it worked.
Entity imageTable = new Entity("sdkmessageprocessingstepimage");
imageTable.Id = Guid.Parse("7ab65e36-01bf-ec11-983e-6045bdad3465");
imageTable["attributes"] = "statuscode";
imageTable["sdkmessageprocessingstepid"]=new EntityReference("sdkmessageprocessingstep", Guid.Parse("4d3c5818-215f-ec11-8f8f-6045bda5c934"));
imageTable["imagetype"]=new OptionSetValue(0);
imageTable["messagepropertyname"]="Target";
imageTable["name"]="PreImageUnique";
imageTable["entityalias"]="PreImageUnique";
crmSvc.Update(imageTable);
docs.microsoft.com/.../sdkmessageprocessingstepimage
imagetype -> 0 -> Preimage
Please mark my answer verified if this is helpful!
Regards,
Bipin Kumar
Follow my Blog: xrmdynamicscrm.wordpress.com/
Thanks
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156