Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

debug custom action with javscript call

Posted on by 2,397

Hi, I am trying invoke an action from javascript, but it returns error "not found", it is a global action.  how should I debug this?

 

function executeAction(){
	debugger;
	var parameters = {};
        parameters.ApplicationRef = "8B446743-C6C4-E711-A81C-005056B5FEFA";
        parameters.Amount = "300"
        parameters.AuthCode = "authcode"

    var req = new XMLHttpRequest();
        req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/recoserv_actiontest", true);
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.onreadystatechange = function() {
             if (this.readyState === 4) {
                     req.onreadystatechange = null;
             if (this.status === 200) {
                  var results = JSON.parse(this.response);
             } else {
                  Xrm.Utility.alertDialog(this.statusText);
         }
    }
};
req.send(JSON.stringify(parameters));
}

*This post is locked for comments

  • Verified answer
    sdnd2000 Profile Picture
    sdnd2000 2,397 on at
    RE: debug custom action with javscript call

    I tried activate and deactivate several times, then it looked fine now.

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: debug custom action with javscript call

    I am not sure if this will help, but take a look at this blog post by Andrew Butenko.

    community.dynamics.com/.../why-my-action-is-not-available-through-webapi

    Hope this helps.

  • sdnd2000 Profile Picture
    sdnd2000 2,397 on at
    RE: debug custom action with javscript call

    it can not find this action resource, but I can see that it is activated.

    4403.2017_2D00_11_2D00_16_5F00_0954.png

    Here is my action settings.

    4403.2017_2D00_11_2D00_16_5F00_0954.png

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: debug custom action with javscript call

    Is the name of your action recoserv_actiontest?

    Can you please verify this?

    Code seems to be OK.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans