Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Action Dialog button on Opportunity Form

(0) ShareShare
ReportReport
Posted on by 815

Hi,

On the Opportunity body form, i have created a option-set field Develop Proposal Yes/No. 

When NO then i want to create a button on the form as CLOSE the opportunity. Can i use dialog option here?

Please help, Thanks !

Regards

Faisal

*This post is locked for comments

  • Suggested answer
    Syed_Faisal Profile Picture
    815 on at
    RE: Action Dialog button on Opportunity Form

    Hi,

    I got the solution. On the status reason have added Close No-Bid.

    As per MS, they have only option Open,Close, Lost and this cannot be custom.

    Thanks & Regards

    Faisal

  • Arun Vinoth Profile Picture
    11,615 Moderator on at
    RE: Action Dialog button on Opportunity Form

    We don’t see any error in screenshot. Can you copy/paste the error, the steps you followed, expected behavior?

  • Syed_Faisal Profile Picture
    815 on at
    RE: Action Dialog button on Opportunity Form

    Hi,

    Anyone has answer to above question?

  • Syed_Faisal Profile Picture
    815 on at
    RE: Action Dialog button on Opportunity Form

    Hi Bala,

    thanks for the code, i tried based on given instruction but i am getting error when opening a lead.

    First i created JS, on the Form --> On the field even --> on change i have mapped the function Then created WF 

    but no luck,

    FYI - Screenshot

    044735.Capture.PNG

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Action Dialog button on Opportunity Form

    Hi Syed

    Step 1: Field On change  write Js.

    On change of that field trigger Js. Inside Js check the condition and makes the comments field required.

    Step 2. On save workflow will trigger , and makes the opportunity as close.

    1.  Workflow entity is opportunity, trigger field change.
    2. Workflow step , select if condition and checks the two option field value  and  comments contains data.
    3. if condition satisfies, then in action  select as Close opportunity and click on set properties. set the field values.
    4. Activate the workflow.

     

    Js Code :

    fuction proposalonchange()
    {
    try
    {
    var proposalvalue = Xrm.Page.getAttribute("twooptionschemafield") != null ? Xrm.Page.getAttribute("twooptionschemafield").getValue() : null;
    if( proposalvalue != null && proposalvalue == false)
    {
    var answer = confirmDialog("Do you want to close the Opportunity ? " );
    if( answer == true)
    {
    //Comments Field
    Xrm.Page.getControl("commentshemaname").setVisible(true);
    Xrm.Page.getAttribute("commentshemaname").setRequiredLevel("required");
    }
    else
    {
    Xrm.Page.getControl("commentshemaname").setVisible(false);
    Xrm.Page.getAttribute("commentshemaname").setRequiredLevel("none");
    }
    }

    else
    {
    Xrm.Page.getControl("commentshemaname").setVisible(false);
    Xrm.Page.getAttribute("commentshemaname").setRequiredLevel("none");
    }
    }
    catch(ex)
    {
    alert("Exception in proposalonchange : " + ex);
    }

     

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: Action Dialog button on Opportunity Form

    Yes, you can design your workfow as a child workflow and create a dialog where you can ask your set of question and further can use Call Child workflow to call your workflow.

  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    2,914 on at
    RE: Action Dialog button on Opportunity Form

    Hi,

    I think you can use:

    Xrm.Utility.confirmDialog("Are you sure want to close?", function(){ Xrm.Page.ui.close(); }, function() { console.log('cancel'); });

    docs.microsoft.com/.../xrm-utility

    docs.microsoft.com/.../gg327828(v=crm.5)

  • Syed_Faisal Profile Picture
    815 on at
    RE: Action Dialog button on Opportunity Form

    Hi,

    Thanks for sharing workflow solution, this will work for us and also before closing opportunity, we want some question to be asked, can i use dialog option here?

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: Action Dialog button on Opportunity Form

    Hi,

    You can't add button on the form, only possible option is to have a html webresource and create html button,there you can write a REST/Web Api request to close the opprotunity.

    Apart from that you can automate this using simple workflow which can run on change of the field, and if it's no, you can close the opportunity,

    github.com/.../releases

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans