Announcement

Collapse
No announcement yet.

Enhanced Dynamic Logic

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Enhanced Dynamic Logic

    Free plugin that enhances Espo's Dynamic Logic capabilities with three improvements:

    1) Ability to change a field's css specifications (background color, text color, font weight, etc) based on Dynamic Logic conditions.

    2) Ability to view the changed css in detail and in list views.

    3) Ability to use the current User attributes (isAdmin, isPortal and Team membership) as conditions to apply Dynamic Logic directives (standard like visibility, readonly, etc. or the new css specifications) to a record.

    This plug in can be downloaded here: https://github.com/telecastg/enhance...ic-for-espocrm

    See the README page for installation and use instructions.

    The enhanced Dynamic Logic capabilities are not accessible form the Administration module, they require modifications to an entity's clientDefs and record views, but hopefully the Espo development team will find these improvements useful and can integrate them into future versions.
    Last edited by telecastg; 01-03-2020, 05:28 AM.

  • #2
    I look forward to an upstream merge!

    Comment


    • #3
      Thanks telecastg
      i will try.. front-end is not my skill

      Comment


      • espcrm
        espcrm commented
        Editing a comment
        Hopefully someone will help. Reading the readme at the moment and it still it will require copy/paste or coding at this stage. Looking forward to updates.

    • #4
      Hello everyone, just released version 1.0.2 which adds the ability to use Roles as a dynamic logic condition.

      By the way, I have also been experimenting with the EXCELLENT dynamic handler feature https://github.com/espocrm/documenta...mic-handler.md and in my opinion will help a lot improving form design and user experience. I highly recommend checking on it. I am experimenting using it as a "front end" hook not just to manipulate fields appearance but also to actually modify the model on the fly based on user interactions.

      Saludos :-)

      Comment


      • #5
        Hello telecastg,
        It would be very good if the user ID was a condition for 3) .
        peter

        Comment


        • telecastg
          telecastg commented
          Editing a comment
          Hello Peter, do you mean the actual user ID record number ?. It would be possible but you would have to hard code the number in the entity's clientDefs. Can you tell me more about the business case/application that you have in mind ?.
          Last edited by telecastg; 01-15-2020, 07:34 PM.

      • #6
        I also recommend using dynamic handler: https://github.com/espocrm/documenta...mic-handler.md

        It's not planned to implement an ability to check user fields in dynamic logic. It's built in a way that only fields of the current record can be used.

        Comment


        • tothewine
          tothewine commented
          Editing a comment
          Can we have a default dynamic handler that uses ajax to make calls to a controller/service we can then extend with custom class ?
          Last edited by tothewine; 01-24-2020, 07:33 PM.

      • #7
        Hello telecastg,
        my question referred to the ID of the logged in user. Yuri has not confirmed the realization for this.

        But it would be very good if you could change the properties of the fields with formula.
        peter

        Comment


        • #8
          Hello Peter,

          As I mentioned, it would be possible to establish the current User Id as a Dynamic Logic condition, but it would require to hard code the target User Id in metadata as an input.

          Dynamic Logic (original and enhanced) are front-end (client-side) implementations so they occur immediately, before the data is sent to the server, while Formula (in my opinion) is essentially a user friendly way to write a Hook which is a back-end (server-side) implementation so it happens after the entity has been modified in the front-end but depending on the hook it can happen before or after a record has been updated in the database.

          So in that sense Dynamic Logic is client-side and Formula is server-side so they are not compatible.

          What would be desirable for Administrators not wanting to deal with coding metadata, is to be able to include the enhanced dynamic options in the field Administration facility as part of the Dynamic Logic section but that requires changes to Espo's application files and would not be "upgrade safe".
          Last edited by telecastg; 01-24-2020, 06:16 PM.

          Comment


          • tothewine
            tothewine commented
            Editing a comment
            username instead of id probably makes more sense to hardcode a 'fixed' string rather than the id

          • telecastg
            telecastg commented
            Editing a comment
            I completely agree, just would like to learn more about the end purpose (business case) for making GUI changes based on s single individual identity.

        • #9
          Hello telecastg,
          I need to exclude some options of the Enum field depending on the Current user: If CurrentUser IS NOT CreatedBy one.
          Is it a case within the topic?
          Last edited by Oleksii S.; 05-20-2020, 02:13 PM.

          Comment


          • #10
            Hello Oleksii,

            If I understand correctly, you want to change the enum options of a field based on the condition that the current user is or is not the record creator.

            You can do this with Dynamic Handler https://docs.espocrm.com/development/dynamic-handler/

            Follow the example provided in the documentation and adapt to your own entity.

            To test if a user is the same as the one who created the record, use this condition inside the function "controlFields":

            Code:
                if(this.recordView.getUser().id == this.model.attributes.createdById) {
                    // set the options for your enum field when the current user is the person that created the record
                } else {
                    // set the options for your enum field when the user is NOT the person that created the record
                }

            Comment


            • #11
              Thanks, telecastg !
              But what I asked about is your plugin.
              I`d like to see a cloud/box instance as flexible, as god`s clay, so a hard coding is a last option.
              The dynamic logic, as a tool for data restriction, lacks some power, so I wonder if your plugin could help.
              What I can see for now, I`d wish attributes-comparing operators and mentioned Current User properties.
              If this is realizable by kind of simple installation of the plugin, I`d try to use it, till Dear Developers will implement some in native.
              Or maybe, you could let it as a payable extension, for an option.

              Comment


              • #12
                You're welcome Oleksii S.

                At present the enhanced dynamic logic plugin does not cover placing restrictions on enum fields.

                The plugin only covers the same types of changes as the out-of-the-box dynamic logic:
                - Show or hide a field
                - Show or hide a Panel
                - Make a field read-only
                - Make a field required
                PLUS: Change a field's css (color, background-color,font,etc) in detail and in list display.

                Regarding the type of conditions that can be evaluated with the plug they are the same as the out-of-the-box dynamic logic:
                - The attributes of another field and comparisons (greater than, less than, contains, not contains, etc)
                PLUS the current user attributes (isAdmin, isPortal, Role membership, etc)

                Also at present, the plug-in does not have an Admin interface and requires some coding because it overrides the out-of-the-box dynamic logic. It is more of a tool for developers than an Administrator feature. I can't promise but I will check the possibility to make it more "user friendly" in the future when I have some time.

                For your current goal, I think that the new dynamic-handler is more appropriate and although it requires some simple coding it can be a very useful tool to learn.

                Comment


                • #13
                  Originally posted by telecastg View Post
                  At present the enhanced dynamic logic plugin does not cover placing restrictions on enum fields.
                  Why not? Don't forget "Conditional options".

                  Originally posted by telecastg View Post
                  …out-of-the-box dynamic logic:
                  - The attributes of another field and comparisons (greater than, less than, contains, not contains, etc)
                  … and those are restricted with implicit values. I wonder if nobody else ever wanted to compare fields one with another.

                  Originally posted by telecastg View Post
                  For your current goal, I think that the new dynamic-handler is more appropriate and although it requires some simple coding it can be a very useful tool to learn.
                  Sure it is, but I think of two-stage system deployment - quick start-up, and deep customization. And this tool is rather of the second.

                  Comment

                  Working...
                  X