Skip to content

Invalid javascript generated for custom API #33

@skfd

Description

@skfd

Latest version of the tool. I think it should drop the symbols that are valid for custom API, but invalid for javascript. Stringify the parameters.

Something else is probably wrong, I'm also getting "The request URI is not valid. The segment 'ilac_GroupBookingItemPrice' cannot include key predicates, however it may end with empty parenthesis." error...

This:

var execute_ilac_GroupBookingItemPrice_Request = {
	// Parameters
	GroupBookingItemPrice-In-ProductIds: {guid: "27a03987-69b3-ef11-a730-000d3af3976a" }, // Edm.Guid
	GroupBookingItemPrice-In-WeeksCount: 2, // Edm.Int32
	GroupBookingItemPrice-In-CurrencyId: {guid: "89de3277-03b7-ed11-a37e-002248b12501" }, // Edm.Guid

	getMetadata: function () {
		return {
			boundParameter: null,
			parameterTypes: {
				GroupBookingItemPrice-In-ProductIds: { typeName: "Edm.Guid", structuralProperty: 1 },
				GroupBookingItemPrice-In-WeeksCount: { typeName: "Edm.Int32", structuralProperty: 1 },
				GroupBookingItemPrice-In-CurrencyId: { typeName: "Edm.Guid", structuralProperty: 1 }
			},
			operationType: 1, operationName: "ilac_GroupBookingItemPrice"
		};
	}
};

Xrm.WebApi.execute(execute_ilac_GroupBookingItemPrice_Request).then(
	function success(response) {
		if (response.ok) { return response.json(); }
	}
).then(function (responseBody) {
	var result = responseBody;
	console.log(result);
	// Return Type: mscrm.ilac_GroupBookingItemPriceResponse
	// Output Parameters
	var groupbookingitemprice-out-price = result["GroupBookingItemPrice-Out-Price"]; // Edm.Decimal
}).catch(function (error) {
	console.log(error.message);
});

Should be generated like this:

var execute_ilac_GroupBookingItemPrice_Request = {
	// Parameters
	'GroupBookingItemPrice-In-ProductIds': {guid: "27a03987-69b3-ef11-a730-000d3af3976a" }, // Edm.Guid
	'GroupBookingItemPrice-In-WeeksCount': 2, // Edm.Int32
	'GroupBookingItemPrice-In-CurrencyId': {guid: "89de3277-03b7-ed11-a37e-002248b12501" }, // Edm.Guid

	getMetadata: function () {
		return {
			boundParameter: null,
			parameterTypes: {
				"GroupBookingItemPrice-In-ProductIds": { typeName: "Edm.Guid", structuralProperty: 1 },
				"GroupBookingItemPrice-In-WeeksCount": { typeName: "Edm.Int32", structuralProperty: 1 },
				"GroupBookingItemPrice-In-CurrencyId": { typeName: "Edm.Guid", structuralProperty: 1 }
			},
			operationType: 1, operationName: "ilac_GroupBookingItemPrice"
		};
	}
};

Xrm.WebApi.execute(execute_ilac_GroupBookingItemPrice_Request).then(
	function success(response) {
		if (response.ok) { return response.json(); }
	}
).then(function (responseBody) {
	var result = responseBody;
	console.log(result);
	// Return Type: mscrm.ilac_GroupBookingItemPriceResponse
	// Output Parameters
	var groupbookingitemprice_out_price = result["GroupBookingItemPrice-Out-Price"]; // Edm.Decimal
}).catch(function (error) {
	console.log(error.message);
});

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions