web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    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

  • Syed_Faisal Profile Picture
    815 on at

    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
    Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    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)

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    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
    Community Member Profile Picture
    on at

    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);
    }

     

  • Syed_Faisal Profile Picture
    815 on at

    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

  • Syed_Faisal Profile Picture
    815 on at

    Hi,

    Anyone has answer to above question?

  • Arun Vinoth Profile Picture
    11,615 Moderator on at

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

  • Suggested answer
    Syed_Faisal Profile Picture
    815 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans