cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Opportunity Close as Won Error | Power App

Hi All,

 

i have a custom button for Opportunity Close as Won in Dynamics 365 Mobile - custom App,

button in working properly on web client but it when a sales rep use this button in App it gives an error 


Error: The entity "WinOpportunity" cannot be found. Specify a valid query, and try again.

 

on the click of custom button i have following request. please see below

var opportunityclose = {
"opportunityid@odata.bind": "/opportunities(" + OppID + ")",
"actualrevenue": actualrevenue,
"actualend": $("#closedate").val(),
"description": " "
};
var parameters = {
"OpportunityClose": opportunityclose,
"Status": -1
};
window.opener.Xrm.WebApi.createRecord("WinOpportunity", parameters).then(
function success(result) {
window.opener.Xrm.Page.data.refresh(true);
alert("Opportunity closed as Won Successfully.");
window.close();
},
function (error) {
alert("Error: " + error.message);
}
);

 

Any help will be appriciated, 

Many Thanks

Muhammad Bilal

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Continued Contributor
Continued Contributor

Re: Opportunity Close as Won Error | Power App

I expect the issue is that WinOpportunity is not a true entity.

Rather than using the createRecord record method, I'd suggest you use the execute method. See https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-webap...  , which also gives an example to win an opportunity

View solution in original post

2 REPLIES 2
Highlighted
Continued Contributor
Continued Contributor

Re: Opportunity Close as Won Error | Power App

I expect the issue is that WinOpportunity is not a true entity.

Rather than using the createRecord record method, I'd suggest you use the execute method. See https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-webap...  , which also gives an example to win an opportunity

View solution in original post

Highlighted
Frequent Visitor

Re: Opportunity Close as Won Error | Power App

Hi @DavidJennaway 

 

Thanks for your response, issue is fixed by using your mentioned method,

Thank you soo much

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (6,029)