locked
Writing a tip to the user? RRS feed

  • Question

  • Hello,

    My organisation marks different Sales Stages as a percentage. I want to display this tip under my "Sales Stage" field: "Please insert correct percentages using this guide: Lead/Prospect/Lost - 0%, Draft Proposal - 25%, Sent Proposal - 50%, Negotiating - 75%, Accepted Proposal - 90%". So, this note should not be modifiable, it should be visible all the time and "Sales Stage" will be Text Only field.

     Could you tell me how can I do it?

    Thank you

    Monday, July 9, 2012 2:57 PM

Answers

  • Hi,

    I find that embedding html web resources in forms are a nice way to display instructions like this to the user. Follow this blog post I wrote and you will end up with something like this;

    Happy to help,

    Rob


    Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011

    Monday, July 9, 2012 8:08 PM
    Answerer
  • Hi Emil,

    Calculations and reporting should not pose any problems since you will simply be filling the probability field with the same numeric value that would otherwise be keyed in by the user.

    You could use something similar to the code below to call from the OnChange event of the salesstagecode field:

    function setProbability()
    {
      var salesstage= Xrm.Page.data.entity.attributes.get('salesstagecode').getValue();
      var probability;
    
      switch (salesstage)
      {
        case 100000000 :             //Lead & Prospect
        case 100000005 :             //Lost
            probability = 0;
            break;
        case 100000001 :             //Draft Proposal
            probability = 25;
            break;
        case 100000002 :             //Sent Proposal
            probability = 50;
            break;
        case 100000003 :             //Negotiating
            probability = 75;
            break;
        case 100000004 :             //Accepted Proposal
            probability = 90;
      }
        
      Xrm.Page.data.entity.attributes.get('closeprobability').setValue(probability);
    }

    Hope this helps.

    Regards,

    Sven

    Thursday, July 12, 2012 7:41 AM
  • Alternatively, you could add a simple workflow that fires onchange of your new option set and updates the numeric probability % field accordingly, which could be hidden from the form. With that approach, you aren't relying on the form being opened in order to fire the JScript should the field be changed by any other method (i.e. another workflow, dialog, web service, Excel import etc)

    Rob


    Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011

    Thursday, July 12, 2012 9:12 PM
    Answerer

All replies

  • Hi,

    I find that embedding html web resources in forms are a nice way to display instructions like this to the user. Follow this blog post I wrote and you will end up with something like this;

    Happy to help,

    Rob


    Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011

    Monday, July 9, 2012 8:08 PM
    Answerer
  • Hi,

    Looking at this from a different perspective...

    Why not implement this using a combination of a Sales Stage field that uses an option set in which the various sales stages are defined, and have the probability field made read-only, and automatically updated with the correct probability through scripting in the OnChange event of the Sales Stage field?

    This would avoid a situation in which a user mistakenly enters a wrong probability percentage.

    Regards,

    Sven

    Tuesday, July 10, 2012 2:01 PM
  • Oh, yes, this sounds good! Will it be possible, though, use the correct percentages for calculations later?

    Thanks.

    Wednesday, July 11, 2012 3:10 PM
  • Hi Emil,

    Calculations and reporting should not pose any problems since you will simply be filling the probability field with the same numeric value that would otherwise be keyed in by the user.

    You could use something similar to the code below to call from the OnChange event of the salesstagecode field:

    function setProbability()
    {
      var salesstage= Xrm.Page.data.entity.attributes.get('salesstagecode').getValue();
      var probability;
    
      switch (salesstage)
      {
        case 100000000 :             //Lead & Prospect
        case 100000005 :             //Lost
            probability = 0;
            break;
        case 100000001 :             //Draft Proposal
            probability = 25;
            break;
        case 100000002 :             //Sent Proposal
            probability = 50;
            break;
        case 100000003 :             //Negotiating
            probability = 75;
            break;
        case 100000004 :             //Accepted Proposal
            probability = 90;
      }
        
      Xrm.Page.data.entity.attributes.get('closeprobability').setValue(probability);
    }

    Hope this helps.

    Regards,

    Sven

    Thursday, July 12, 2012 7:41 AM
  • Alternatively, you could add a simple workflow that fires onchange of your new option set and updates the numeric probability % field accordingly, which could be hidden from the form. With that approach, you aren't relying on the form being opened in order to fire the JScript should the field be changed by any other method (i.e. another workflow, dialog, web service, Excel import etc)

    Rob


    Microsoft Certified Technology Specialist (CRM) GAP Consulting Ltd Microsoft Community Contributor Award 2011

    Thursday, July 12, 2012 9:12 PM
    Answerer