opportunity age calculation coding help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nishan Perera
    Active Community Member
    • Jan 2019
    • 351

    #1

    opportunity age calculation coding help


    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 opportunity stage change to closed won or closed lost.

    thread,

    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.
  • Nishan Perera
    Active Community Member
    • Jan 2019
    • 351

    #2
    hi, can anyone help me out on this ??
    Cheers!
    Nishan.

    Comment

    • Nishan Perera
      Active Community Member
      • Jan 2019
      • 351

      #3
      yuri looking for your support on this request.
      Cheers!
      Nishan.

      Comment

      • Nishan Perera
        Active Community Member
        • Jan 2019
        • 351

        #4
        Originally posted by Nishan Perera
        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 opportunity stage change to closed won or closed lost.

        thread,

        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 ??
        can someone help me on this ?
        Cheers!
        Nishan.

        Comment

        • Nishan Perera
          Active Community Member
          • Jan 2019
          • 351

          #5
          update as below and worked for me.

          for closed won only

          "select": "DATEDIFF(CASE WHEN opportunity.status = 'closed won' THEN opportunity.completed_date ELSE NOW()END, opportunity.date_identified)",
          "orderBy": "DATEDIFF(CASE WHEN opportunity.status = 'closed won' THEN opportunity.completed_date ELSE NOW() END, opportunity.date_identified ) {direction}",

          or for closed won/lost or multiple

          "select": "DATEDIFF(CASE WHEN opportunity.status IN ('Completed', 'Hold') THEN opportunity.completed_date ELSE NOW()END, opportunity.date_identified)",
          "orderBy": "DATEDIFF(CASE WHEN opportunity.status IN ('Completed', 'Hold') THEN opportunity.completed_date ELSE NOW() END, opportunity.date_identified ) {direction}",
          Cheers!
          Nishan.

          Comment

          Working...