Can someone assist me with a dilemma I'm facing?
Within CRM on Demand, I have a view that needs to extract values from CRM input fields to conduct a search against CRM via web service. If duplicate records are found, the view should display them.
Below is the code contained in some libraries related to CRM:
/*
* Context Helpers
*/
declare var epmcrm: any;
class context {
private getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
// The rest of the existing code will remain unchanged.
}
export = context;
In the view models, I have set up knockout observables to reflect CRM fields based on the data retrieved from HTML input elements. This data is then used to execute a search and determine whether results should be returned:
`contactSearch.ts`
The contactSearch class enables interaction with CRM data via web services.
// The remaining part of the existing code from contactSearch.ts remains unchanged.
David,
I've established observables and bound them in the HTML view model, but I'm uncertain how to pass values from HTMLInputElement to these observables.
To illustrate:
<p>Email <input data-bind="value: vEmail" />
<span data-bind="text: vEmail"></span>
Please note this file that establishes a dependency with CRM as well:
var epmcrm;
((epmcrm) => {
require.config({
// Configuration details here...
});
require(["knockout", "knockout.mapping", "koExtensions"],
(ko: KnockoutStatic, komap: KnockoutMapping) => {
ko.mapping = komap;
ko.applyBindings({}, document.getElementById("QuoteWebAppletContainer"));
});
})(epmcrm || (epmcrm = {}));