Formula Not working after save

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ivan2805
    Junior Member
    • Jul 2022
    • 24

    Formula Not working after save

    Hi All,

    I have a frustrating situation here.

    So I added a formula in my opportunity entity, to copy the name of the originalLeadName into the opportunity name, this is the formula code i've used:

    name=originalLeadName;
    The problem is when i tried to convert a lead into opportunity, it does not change the name, however when I tried to recalculate formula, the name changed.

    So at the moment i have to recalculate formula every day.

    Is there any input on what should i do to make this work without have to recalculate formula all the time.


    Thanks
  • lazovic
    Super Moderator
    • Jan 2022
    • 809

    #2
    Hi ivan2805,

    You can do this automatic update through Workflow (a feature from the Advanced Pack extension).

    Create a Workflow with the following parameters:

    Target Entity > Lead
    Trigger Type > After record updated

    Conditions > All (All must be met) >Status equals value > Converted

    Actions:
    Update Related Record ยป Opportunity
    Formula: name = originalLeadName;
    Last edited by lazovic; 08-11-2022, 10:27 AM.

    Comment

    • ivan2805
      Junior Member
      • Jul 2022
      • 24

      #3
      Hi lazovic

      So it means i can not achieve this using formula?

      Is there work around since i don't have advance pack yet.

      Thank you for your kind answer

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        It's a before-save-script (as it labeled on UI). The originalLeadName is not yet available before the record is saved.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • rabii
          Active Community Member
          • Jun 2016
          • 1250

          #5
          Originally posted by ivan2805
          Hi All,

          I have a frustrating situation here.

          So I added a formula in my opportunity entity, to copy the name of the originalLeadName into the opportunity name, this is the formula code i've used:



          The problem is when i tried to convert a lead into opportunity, it does not change the name, however when I tried to recalculate formula, the name changed.

          So at the moment i have to recalculate formula every day.

          Is there any input on what should i do to make this work without have to recalculate formula all the time.


          Thanks
          you can reverse the formula and use it on the lead instead so when the lead is converted into an opportunity you can then update opportunity name to be equal to the lead's name, try formula below on the lead:

          Code:
          ifThen(entity\isAttributeChanged('status') && entity\attribute('status') == "Converted" && entity\attribute('createdOpportunityId'),
          record\update('Opportunity', createdOpportunityId, 'name', entity\attribute('name'))
          )
          Rabii
          Web Dev

          Comment

          • ivan2805
            Junior Member
            • Jul 2022
            • 24

            #6
            Thank you rabii as always your a life saver

            Comment

            Working...