Hi Andrew,
Here is the code for generating the request.
var getOpportunity = function (action, parameters) {
this.OpportunityId = parameters.OpportunityId;
this.Lob = parameters.Lob;
this.ShowFinalAwardedRoleSelection = parameters.ShowFinalAwardedRoleSelection;
this.HasCreditFlag = parameters.HasCreditFlag;
this.IsMnpOpp = parameters.IsMnpOpp;
this.ApplicationDate = parameters.ApplicationDate;
this.IsLoanMod = parameters.IsLoanMod;
this.IsLoanOrig = parameters.IsLoanOrig;
this.getMetadata = function () {
return {
boundParameter: null,
operationType: 0,
parameterTypes: {
"OpportunityId": {
"typeName": "Edm.String",
"structuralProperty": 1 // Primitive Type
},
"Lob": {
"typeName": "Edm.String",
"structuralProperty": 1 // Primitive Type
},
"ShowFinalAwardedRoleSelection": {
"typeName": "Edm.String",
"structuralProperty": 1 // Primitive Type
},
"HasCreditFlag": {
"typeName": "Edm.String",
"structuralProperty": 1 // Primitive Type
},
"IsMnpOpp": {
"typeName": "Edm.String",
"structuralProperty": 1 // Primitive Type
},
"ApplicationDate": {
"typeName": "Edm.String",
"structuralProperty": 1 // Primitive Type
},
"IsLoanMod": {
"typeName": "Edm.String",
"structuralProperty": 1 // Primitive Type
},
"IsLoanOrig": {
"typeName": "Edm.String",
"structuralProperty": 1 // Primitive Type
},
},
operationName: action //this is the action name that is wfrv_GetOpportunity
};
};
};
var request = new getOpportunity(action, parameters);
Xrm.WebApi.online.execute(request).then(
function (result) {
if (result.ok) {
result.json().then(function (response) {
if (response.OpportunityModel) {
opportunityModelReceived = JSON.parse(response.OpportunityModel);
}
});
}
},
function (error) {
consol.log(error.message);
}
);