Role-based dropdown not working

We have a need for role-based dropdown control around the account_type DD

Sugar introduced Role-based dropdowns circa version 7.6 and an issue was raised in August 2017 (that is over 2 years ago) - Bug 79265

This shows itself that if the user does not have access to the DD value present in the record, then the field value does not display at all - this is unacceptable.

Not mentioning my FRUSTRATION at the lack of a fix on a fundamental error which obviously got through QA over 2 years ago, does anyone have suggestions for an alternative approach please.

I have seen some posts around coded solutions which would be of interest. I suspect that might be the only route as my work with dependency files (eg SET OPTIONS) does not appear to include Role based functionality.

Thanks

Neil

Parents
  • Hi Neil Conacher 

    Definitely the Dependency SetOptions is a good strategy. Indeed we have had been configuring such features for different scenarios, including that issue.

    In order to make it working like a charm you need to setup the custom sugarLogic isUserInRoleList.

    Place the attached file into folder custom/include/Expressions/Expression/Boolean/

    Then go to Admin -> Repair -> run the following actions:

    • Quick Repair and Rebuild
    • Rebuild Sugar Logic Functions
    • Rebuild JS Grouping Files
    • Clear Additional Cache

    The sugarLogic function isUserInRoleList gets a list of roles by name and returns a bollean, example:

    isUserInRoleList(createList("Tracker", "Sales Administrator"))

    This way you are able to setup specific dropdown lists for specific roles disregarding the user within.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Easy peasy!

    • The main dropdown list (defined in the vardefs) must accomplish all options. This way Reports will be able to render any options accordingly
    • You need to define a SetOptions dependency for values Prospect, Partner and Lead: isInList($account_type, createList("Prospect", "Partner", "Lead"))
    • You need to define a SetOptions dependency for value Active Client and generic users: and(equal($account_type, "Active Client"), not(isUserInRoleList(createList("Special Role"))))
    • You need to define a SetOptions dependency for value Active Client and special users: and(equal($account_type, "Active Client"), isUserInRoleList(createList("Special Role")))
    • You need to define a SetOptions dependency for value Inactive Client: equal($account_type, "Inactive Client")

    In short words, all possible scenarios must be considered by SetOptions dependencies, the way any SetOptions scenario has its specific DD list.

    Good luck!

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi Andre,

    Thanks for your prompt response - I like the Easy Peasy part of it

    I'll give that a go.

    Just to clarify, I need to to have a separate SetOptions code block for each scenario rather than combining all the logic into one dependency block ?

    Neil

  • Pay attention that the custom expression aren't apply in the mobile app for frontend perspective.

Reply Children