Hi,
We have created custom action and we are executing it using the web api (using script). When we added two output parameters in custom action then it throws following error.
Resource not found for the segment.
When we remove second output parameter then it execute without error.
Is anyone face same kind of issue and solution for it.
Thanks!
Balasaheb
Hi Goutam,
Here is the screenshot of our custom action.
Here is the web api code that we used to execute this action. When we remove string output parameter then it execute successfully when we add string output parameter then it throw error.
function executeCustomAction() {
try {
var actionObj = {
A1: "test1",
A2: "test2"
}
// call this function to execute the action
execute(actionObj, "ikl_TEST_CA()", function (data) {
alert("Success: " + data);
}, function (error) {
debugger;
alert("Error: " + error.message);
});
} catch (e) {
alert(e.message);
}
}
function execute(req, reqName, successCallback, errorCallback) {
//create AJAX request
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: encodeURI(getWebAPIPath() + reqName),
data: window.JSON.stringify(req),
beforeSend: function (xhr) {
//Specifying this header ensures that the results will be returned as JSON.
xhr.setRequestHeader("Accept", "application/json");
//xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8");
xhr.setRequestHeader("OData-MaxVersion", "4.0");
xhr.setRequestHeader("OData-Version", "4.0");
},
success: function (data, textStatus, xhr) {
//successCallback function
if (data != null && data.value != undefined) {
successCallback(data.value);
} else {
successCallback(data);
}
},
error: function (xhr, textStatus, errorThrown) {
errorCallback(Inogic.Maplytics.ApiLib.errorHandler(xhr));
}
});
}
function getWebAPIPath() {
return Xrm.Page.context.getClientUrl() + "/api/data/v8.0/";
}
Hi Gaurav,
Thanks for your reply.
I am passing same type of entity. When we pass only Entitycollection parameter then it work. But when we pass Another output parameter along with Entitycollection parameter.
Thanks
Are you passing different types of entity in collection or of one same type. I have used EntityCollection as output parameter and it works fine for me.
If you can share code maybe i can help you out
Hi,
We have troubleshoot this issue and found that when we define two output parameter out of which one is EntityCollection type and other is string then above error throws. When we define both parameter as string type then it works properly.
Is anyone face same kind of issue and have solution for it.
Thanks!
Balasaheb
This error happen when you are provide wrong parameter name ,check your parameter name , use schema name if its fields.
Also please share your code for more understanding your code if you can,
Could you provide some code for context?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156