Announcement

Collapse
No announcement yet.

How to create a dynamicLogic for Opportunity age ??

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

  • How to create a dynamicLogic for Opportunity age ??

    Hi,

    I want a field which is to show age of a particular opportunity with dynamic logic. opportunity age field read only and should update automatically ?? how it can be done ?

    any help ??
    Cheers!
    Nishan.

  • #2
    Hi,
    If you are talking about auto-counting of the age field, you can use scheduled workflow with a report.

    Comment


    • #3
      Originally posted by Maximus View Post
      Hi,
      If you are talking about auto-counting of the age field, you can use scheduled workflow with a report.
      I tried that, But it change the data modify date and the user. is it possible to do without update those data ?
      Cheers!
      Nishan.

      Comment


      • #4
        As far as I know there is no such an ability.

        Comment


        • #5
          Create a notStorable field and define SQL in "select" in entityDefs. Example here: https://forum.espocrm.com/forum/deve...storable-bools

          You need something like this:

          Code:
          "ageDays": {
              "type": "int",
              "notStorable": true,
              "readOnly": true,
              "select": "DATEDIFF(NOW(), created_at)",
              "orderBy": "DATEDIFF(NOW(), created_at) {direction}"
          }
          Last edited by yuri; 05-27-2020, 09:23 AM.

          Comment


          • #6
            Originally posted by yurikuzn View Post
            Create a notStorable field and define SQL in "select" in entityDefs. Example here: https://forum.espocrm.com/forum/deve...storable-bools

            You need something like this:

            Code:
            "ageDays": {
            "type": "int",
            "notStorable": true,
            "readOnly": true,
            "select": "DATEDIFF(NOW(), created_at)",
            "orderBy": "DATEDIFF(NOW(), created_at) {direction}"
            }
            Thank you for the code yuri. without entering table name i'm getting "Internal server error 500".

            For me this worked

            custom\Espo\Custom\Resources\metadata\entityDefs\O pportunity.json

            Code:
            {
                "fields": {
                    "oppAge": {
                        "type": "int",
                        "notStorable": true,
                        "select": "DATEDIFF(NOW(), opportunity.created_at)",
                        "orderBy": "DATEDIFF(NOW(), opportunity.created_at) {direction}",
                        "readOnly": true,
                        "isCustom": true
                    }
                }
            }
            Thank you for the support .!
            Last edited by Nishan Perera; 06-02-2020, 06:59 PM.
            Cheers!
            Nishan.

            Comment


            • #7
              Hi yuri,

              I need some support on opportunity age calculation which is now working perfectly. Thing is I want to stop the age calculation if stage change to closed won or closed lost.

              Is this possible to achieve ? Let me know.
              Cheers!
              Nishan.

              Comment


              • #8
                Hi Maximus , Could you also advice me on above which is "stop the age calculation if stage change to closed won or closed lost."
                Cheers!
                Nishan.

                Comment


                • Maximus
                  Maximus commented
                  Editing a comment
                  Hi,
                  Sorry, can't help here. It is out of my skills.

              • #9
                yuri could you please help me on this. appreciate your support.
                Cheers!
                Nishan.

                Comment


                • #10
                  Originally posted by Nishan Perera View Post
                  yuri could you please help me on this. appreciate your support.
                  yuri Can you support me on this ?
                  Cheers!
                  Nishan.

                  Comment


                  • #11
                    Is there anyone can help me on this ?
                    Cheers!
                    Nishan.

                    Comment

                    Working...
                    X