Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

WebAPI custom action calling issue

$
0
0

Hi All,

I facing issue when i try to invoke custom action from js for the custom activity entity.

Error: parameter  in the request payload is not a valid parameter for the operation

This is working for any OOB or custom entity but not for custom activity entity.

 

Code:

 function CallCustomAction() {
        var id = Xrm.Page.data.entity.getId().substring(1, 37);
        var query = "new_VIJJI(" + id.replace("}", "").replace("{", "") + ")/Microsoft.Dynamics.CRM.new_testingaction";
        query = Xrm.Page.context.getClientUrl() + "/api/data/v8.0/" + query;
        var data = {"subject": "Test description vijji"
        };
        var req = new XMLHttpRequest();
        req.open("POST", query, true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.onreadystatechange = function () {
            if (this.readyState == 4 /* complete */) {
                req.onreadystatechange = null;
                if (this.status == 200) {
                    var data = JSON.parse(this.response);
                    if (data['voutput'] != null) {
                        alert(data['voutput']);
                    }
                } else {
                    var error = JSON.parse(this.response).error;
                    alert(error.message);
                }
            }
        };
        req.send(window.JSON.stringify(data));
    }

In Custom action i have an output and assigning a value

Is it a limitation or i am i missing some thing in the code?


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>