locked
Visual Ribbon Editor RRS feed

  • Question

  • I am wanting to hide a button based up on a field value, so using the visual ribbon editor I set a rule for th ebutton as follows:

    Field: QuoteNumber

    Value: QUO-01860-H9C3

    The field is the name of the field in the back end database and I can see the value in the database under this field.

    If I upload this to my CRM nothing happens, the button is not displayed.

    If I change the rule to a client type and select Web the button is visible.

    So my assumption from this is that the value or field are not getting evaluated correctly, anyone give me an idea as to what I am missing?

    regards,

    Matt

    Friday, September 13, 2013 3:03 PM

All replies

  • try quotenumber

    or

    Xrm.Page.getAttribute("quotenumber").getValue() = 'QUO-01860-H9C3' ;


    Regards Faisal


    • Edited by Faisal Fiaz Friday, September 13, 2013 3:44 PM
    Friday, September 13, 2013 3:43 PM
  • Hi,

    As far i have understand , you are trying to hide a ribbon based on a field value, 

    using visual ribbon editor.

    select the ribbon --> Goto (Display Rule)  --> Value Rule 

    Try to refresh and save the   form once you have open. 

    It should work fine,.


    Monday, September 16, 2013 7:43 AM
  • I have done the following:

    Field*: Name

    Value*: QUO-01860-H9C3

    and it does not appear when that quote is selected or if any other quote is selected.

    If I invert the rule it appears for every quote.

    regards,

    Matt

    



    Monday, September 16, 2013 9:24 AM
  • Have tested the button with the  following

    alert(Xrm.Page.getAttribute("name").getValue().name);


    but when run the alert displays undefined any ideas?

    Matt

    Ignore this the jscript works with 

    alert(Xrm.Page.getAttribute("name").getValue());

    Monday, September 16, 2013 10:21 AM
  • ok somehow I have it working, but now I need it to work on a check box so I have updated it to the following:

    field*: potentrelevant

    Value*: true

    this does not work.

    If I invert the result it shows the button for all quotes, if I then click the button to display the value of the checkbox I can see it is true.

    Any ideas?

    Matt


    Monday, September 16, 2013 12:14 PM
  • I have now downloaded and installed Ribbon Workbench.

    I can now see for the buttons I want to disable that there are some custom enable rules:

    FunctionName: isActive

    Library: /_static/SFA/q/q.js

    So I assume from this that there is some form of over riding rule running, however, I cannot find the library mentioned in web resources, am I looking in the wrong location or ???

    regards

    Matt

    Tuesday, September 17, 2013 1:21 PM
  • For Check Box try like bellow

    field*: potentrelevant

    Value*: 0 (or) 1   (Check the value either 0 or 1)

    and try to apply in your visual ribbon editor Rule 

    Tuesday, September 17, 2013 1:28 PM
  • Hi

    Add Enable Rule for formstate and set state as create.

    Thanks 

    Sureh Sorde

    Tuesday, September 17, 2013 1:42 PM
  • Thanks for the reply, but whatever I seem to set I have little or no control over certain buttons, so I assume the code is over riding things.

    Matt

    Tuesday, September 17, 2013 1:43 PM
  • Hi Folks,

    Regarding the following question

    I am wanting to hide a button based up on a field value, so using the visual ribbon editor I set a rule for th e button as follows:

    Field: Name

    Value: QUO-01860-H9C3

    To hide a button, we use display rule

    To hide a button based on a value of a field on form, we use Value Rule under display rule.

    Basically we need to set the display rule as Field name != QUO-01860-H9C3

    Field: name

    Value:  QUO-01860-H9C3

    Default: true

    InvertResult: true

    This will hide the button if the value of name is QUO-01860-H9C3. Otherwise, it will show the button

    If we want to show the button if the value of name is  QUO-01860-H9C3 and hide it in other cases, 

    use InvertResult as false.

    Rameshwari

    • Proposed as answer by RameshwariSah Tuesday, September 17, 2013 6:46 PM
    Tuesday, September 17, 2013 6:42 PM
  • You can use the same step of creating the above display rule using Ribbon Workbench also. But Ribbon workbench is little slower. It takes more time in publishing the solution. 

    Its just a simple value rule with invert result "true".

    Also 1 more point: Enable rule is used to enable/disable a button. Display rule is used to show/hide a button.

    Try it. It will work :)

    Regards,

    Rameshwari

    [Please vote answer as helpful if it works]

    • Proposed as answer by RameshwariSah Tuesday, September 17, 2013 6:46 PM
    Tuesday, September 17, 2013 6:46 PM
  • As said above I have it working on one button, however I need to apply the same to three other buttons, these do not seem to react to the setting, however I can see all three buttons have custom enable rules written in code

    FunctionName: isActive

    Library: /_static/SFA/q/q.js

    I have looked through the web resources and cannot find the code that this refers to and I assume it is over riding whatever I am applying to these three buttons.

    regards,

    Matt

    Wednesday, September 18, 2013 9:08 AM
  • Thanks for that, I had seen that page before but didn't really follow it as I am new to development.

    So taking what I have said above:

    Library: /_static/SFA/q/q.js

    The code I am looking for is located in the above library, but where is the library located as it is not in a web resource as shown below:

    Library="$webresource:new_CheckFieldValue.js">

    Can anyone point me in the direction of where I need to look?

    regards,

    Matt

    Wednesday, September 18, 2013 10:47 AM
  • I am guessing the code is in a plug-in, can I view the plug-ins that are on our system if so how?

    Or is it that I cannot view the code in managed solutions?

    Matt

    Wednesday, September 18, 2013 2:17 PM
  • Well somehow I killed my buttons, the joys of CRM lol.

    Anyway these are the steps I have done so far:

    * I reimported the solution with the quote module in

    * Edited the ribbon with Ribbon Workbench

    * Created a button

    * Made it customisable

    * Created a command for it, javascript

    * created an enable command to call the same javascript code

    * Attached this to the behaviour command

    Now, have I missed a step out as the button shows in the quote area, but doesn't do anything, I have removed all the code and just added back in an alert statement and still it does nothing?

    Any ideas?

    Matt

    Tuesday, September 24, 2013 8:43 AM