web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

InputParameters java to plugin

(0) ShareShare
ReportReport
Posted on by 35
Hey,

Could someone help me, I'm trying to pass a parameter from javascript to a plugin, but I'm not having success.

Here are codes:

var req = {};
                req.getMetadata = function () {
                    return {
                        boundParameter: null,
                        parameterTypes: {"CNPJ": CNPJ_data_texto},
                        operationType: 0,
                        operationName: "new_TestedeProcesso"
                    };
                };



                var CNPJ = (string)context.InputParameters["CNPJ"];
                ((IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext))).InputParameters["CNPJ"] = CNPJ;
I have the same question (0)
  • Suggested answer
    Torrado Profile Picture
    1,270 on at
    RE: InputParameters java to plugin

    Hello,

    Why trying to pass the parameters from JavaScript to Plugin? I would not recommend that approach.

    If the request is coming from Client-Side or as External Web Request, please evaluate the option of calling an Action or Custom API.

    Hope this helps you.

    Please mark the answer as verified if helpful. That will help others in future.

  • Felipe Kavai Profile Picture
    35 on at
    RE: InputParameters java to plugin

    Hey,

    Thanks for the answer.

    I'm building an integration, I made the whole structure using C #, that's why I use the plugin.

    As I am creating a custom screen within the dynamics, I would like the javascript to call the plugin based on the data that users put on that screen, but the variable arrives blank and I cannot perform the query correctly.

  • Suggested answer
    Torrado Profile Picture
    1,270 on at
    RE: InputParameters java to plugin

    Hello Felipe,

    That's exactly why you should use Action or Custom API.

    The Custom APIs where created by Microsoft for that purpose, please read the official documentation. It's a component that makes use of a Plugin class to run the logic, so your C# code can be reused there.

    Please check this example about how to create Custom API: https://markcarrington.dev/2020/10/22/cds-custom-apis/ 

    Hope this helps you.

    Please mark the answer as verified if helpful. That will help others in future.

  • Verified answer
    PabloCRP Profile Picture
    1,088 on at
    RE: InputParameters java to plugin

    Hi, seems like you are not passing any value when calling your action... try this.

    var req = {};
    req.CNPJ = CNPJ_data_texto;
    req.getMetadata = function () {
        return {
            boundParameter: null,
            parameterTypes: {   
            "CNPJ": {
                        typeName: "Edm.String",//I suppose it's string
                        structuralProperty: 1
                        }
            },
            operationType: 0,
            operationName: "new_TestedeProcesso"
        };
    };

    now for store the value just use this line in C#

    var CNPJ = (string)context.InputParameters["CNPJ";

    in the backend you are right

    regards.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 78 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 57 Most Valuable Professional

#3
Anthony Blake Profile Picture

Anthony Blake 43 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans