Possibility to recalculate the formulas by formula?

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • shalmaxb
    replied
    telecastg thank you for your attention. No, not in the dropdown. I have entities, where I have calculations, that only recalculate when saved or after browser refresh. Sometimes need to be recalculated, which is possible only with admin rights.
    In the beginning of this thread Maximus provided a code extension to make a button in an entity. You complemented that code, so it works as desired for admin.
    But I need it for any user and wondered, if this could be possible by adapting the former code in this thread.

    I want to avoid too many clicks in different locations or even refresh the browser itself. My users would not get that. If I provide them this button, they get it.

    For admin it looks like this:
    Attached Files
    Last edited by shalmaxb; 02-19-2021, 07:30 PM.

    Leave a comment:


  • telecastg
    replied
    Hello shalmaxb We don't use formulas very much but I will try to help.

    To understand better, what you are trying to accomplish is to have an option in an entity's detail view dropdown menu that when clicked will re-calculate formulas linked to the entity ?
    Click image for larger version

Name:	tempsnip.png
Views:	1646
Size:	39.5 KB
ID:	67865

    Leave a comment:


  • shalmaxb
    replied
    Hi,
    my question complements my question in another thread -> https://forum.espocrm.com/forum/gene...to-recalculate, because the solution of this thread here about the button also does work only for admin.
    I asked myself, if it could be possible to adapt the script for the button to the possibility for a regular user use the recalculate and refresh browser button.
    This question goes mainly to our helpful friends telecastg and Maximus.

    Leave a comment:


  • shalmaxb
    commented on 's reply
    I guessed that, thank you

  • Maximus
    replied
    > I actually would even prefer this button on the bottom of my form in the detail view, but I don`t know, if that is even possible. If it would be possible, perhaps any idea, how to achieve this?

    It needs more complicated customizations as it needs to create a custom template. etc. etc.

    Leave a comment:


  • shalmaxb
    replied
    My intention actually was to have this function like a button to avoid one mouseclick (that would be necessary if this function would be in the dropdown). I would like to offer the user after having filled the form to do the recalculation immediately.
    Without wanting to be too demanding, I actually would even prefer this button on the bottom of my form in the detail view, but I don`t know, if that is even possible. If it would be possible, perhaps any idea, how to achieve this?

    Leave a comment:


  • Maximus
    replied
    For sure there is an ability to add the Recalculate Formula action to the Dropdown menu. But anyway for making such customization properly, you will need to create it somewhere in the /client/custom/... directory, and specify the path to this new view in many others JSON files https://docs.espocrm.com/development...in-detail-view.
    The task was to create a button. I believe this logic is acceptable for the dropdown menu as well.

    > But certain other default button such as "Duplicate", "Remove", "Print to PDF", I think it all use one single file handler isn't it

    Please investigate this file /client/src/views/record/detail.js.

    Leave a comment:


  • esforim
    replied
    But certain other default button such as "Duplicate", "Remove", "Print to PDF", I think it all use one single file handler isn't it, is it not possible to make it dynamic?

    Leave a comment:


  • Maximus
    replied
    Yep. You can describe such logic for all entities in one .js file, but each entity needs its own .json file with to specify the pass to this .js file.

    Leave a comment:


  • shalmaxb
    commented on 's reply
    I use it that way, every entity has its own code.

  • esforim
    commented on 's reply
    OK, after playing around with it I think (hopefully it correct) that I can answer some of my own question.

    1) Can't append multiple scope I believe. Each entity need to have a [Name].json (e.g. Contact.json)

    Button handler can't be shared either so need to be create individually for each Entity due to this code:

    "Espo.Ajax.postRequest('Basic/' +"

    Basic is the Entity name.
    Last edited by esforim; 11-11-2020, 12:03 AM.

  • esforim
    replied
    How to add this for Base Plus type? None of the code seem to mention "Base" directly.

    For example I know I need to change this section if I want to use this for Contact (which is a Base Plus? or probably Person)

    The type can be found here: https://docs.espocrm.com/development...a/scopes/#type
    But where do I add BasePlus in the code?

    Code:
    "aclScope": "Contact",
    Is it possible to append multiple aclScope?
    Code:
    "aclScope": "Contact", "Account", "Case",
    Rather than having multiple files of same code.
    Last edited by esforim; 11-10-2020, 11:51 PM.

    Leave a comment:


  • shalmaxb
    replied
    Maximus , item, telecastg,
    I can confirm, that it works now, amend only this.view.model.fetch(); to the code of Maximus, Post #7.

    I am really happy to receive that lot of help in this forum, and it is not the first time.

    Leave a comment:


  • Maximus
    replied
    item, telecastg,
    Thanks for your input. this.view.model.fetch(); works perfectly. Thanks.

    Leave a comment:


  • shalmaxb
    replied
    Hi,
    thank you for all the help, but unfortunately, so far none of them (tried also various combinations) will work.

    Leave a comment:

Working...