Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parameter formatting in ExecuteFunctions adds quotes and sometimes you don't want them #45

Open
aappddeevv opened this issue Sep 9, 2017 · 2 comments

Comments

@aappddeevv
Copy link

aappddeevv commented Sep 9, 2017

I was issuing a Rollup function call and passing in an enum type that needs to format to @pX=Microsoft.Dynamics.CRM.RollupType'Extended' but the function is adding the quotes in where it should not. Probably the best way to code this is to see if there are quotes in it already meaning that's already quoted/qualified or allow a function in its place that evaluates to the proper value to insert into the query parameter value. Otherwise, we have to use a wacky workaround. Related to #38.

Here's the code issue:

(key) {
	var val = parameters[key];
	parmvars.push(key + "=" + "@p" + parmcount.toString());
	f (typeof val === 'string' || val instanceof String) parmvalues.push("@p" + parmcount.toString() + "='" + val + "'");
	    else parmvalues.push("@p" + parmcount.toString() + "=" + val);
	parmcount++;

I worked around this by using:

 function ToString(arg) { this.toString = function() { return arg } }

Then varToPassInParameters = new ToString("blah").

@davidyack
Copy link
Owner

@aappddeevv can you share how you had formatted the API call that was causing the problem?

@aappddeevv
Copy link
Author

aappddeevv commented Sep 15, 2017

I don't have that because I used ToString hack. But I recall that it was an enum. I passed in the enum through qopts so your code would test for the string and wrap it again i quotes:

var param = "Microsoft.Dynamics.CRM.RollupType'Extended'"

makeTheCall(..., param, ...)

would become 'Microsoft.Dynamics.CRM.RollpType'Extended''

I think this was a Rollup ExecuteFunction call which requires an enum for the rollup type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants