locked
CRM 2011: Button Enable Rules Question RRS feed

  • Question

  • I'm setting up an ribbon bar button enable rule that is not working. I think I might be misunderstand how these OR rules work. Can someone offer some suggestion or maybe tell me what I am doing wrong? Any help or suggestions are much appreciated.

    Here's what I have setup.  I have a Lead where I do not want to allow it to be reactivated depending on field's value. I basically have different types of Leads.  If a user has qualified a Lead of type say 0,1 I don't want to allow those to be reactived.  But if they are of say type 2, 3, or 4 I want to allow it.  I can get that working and it's fine.  However, I also want to allow any user that has a security role of "System Administor" to be able reactive any Lead that they want.  I can also get that to work by itself.  However, if I merge these two using an OrEnableRule, they don't work well together.  Here's what I have setup as an enable rule on the "Reactive Lead" button.  Any idea why this is not working?

    Enable Rule:

    CustomRule - Fires off a JavaScript function that returns true/false depending on if the user has the admin role.

    OrEnableRule

         OrGroup

           ValueRule - type is 2

         OrGroup 

           ValueRule - type is 3   

    OrGroup

           ValueRule - type is 4

    If I remove the CustomRule, the logic works but of course it doesn't allow it for the admins and type 0, 1.  If I remove just the OrEnableRole, it works to allow it for all admins.  But if I have both, the button is always disabled.  When I test this, I am using an admin account, so it should override and allow it to be enabled.  But it does not.

    Am I using the OrGroup wrong or setting up the EnableRule incorrectly?  How might you approach something like this?


    Jon Gregory Rothlander

    Tuesday, January 6, 2015 8:23 PM

Answers

  • Hi,

    Why not do the entire check in the javascript function itself.

    Logic:-

    If ( Field value is 0 or 1)

    {

       Check User role

       If (Admin)

          {

           return true

          }

       return false

    }

    Thanks,

    Prasad

    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question

    • Marked as answer by jonrothlander Wednesday, January 7, 2015 7:12 PM
    Wednesday, January 7, 2015 6:29 AM

All replies

  • Hi,

    Why not do the entire check in the javascript function itself.

    Logic:-

    If ( Field value is 0 or 1)

    {

       Check User role

       If (Admin)

          {

           return true

          }

       return false

    }

    Thanks,

    Prasad

    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question

    • Marked as answer by jonrothlander Wednesday, January 7, 2015 7:12 PM
    Wednesday, January 7, 2015 6:29 AM
  • Yeah, that's a good idea!  I should have thought of that earlier.  I think the OR group is just being odd.  I coded it out in JavaScript in a few seconds and it works fine now.  Thanks for the suggestion.

    Jon Gregory Rothlander

    Wednesday, January 7, 2015 7:12 PM