ssossossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

Forums Forums OroCRM OroCRM – How do I? Questions Summarize fields values

This topic contains 8 replies, has 2 voices, and was last updated by  Yevhen Shyshkin 2 years, 10 months ago.

  • Creator
    Topic
  • #25471

    Igor Chornobay
    Participant

    Hello,

    For Opportunity I created two custom fields (“Сost of a license” and “Cost of implementing”).
    How to automatically summarize values of these fields, and write it into “Budget amount” fild?
    Data type of these custom fields is “money”.
    Value of “Budget amount” must be changed every time when changing value at least one of these custom fields.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #25472

    Yevhen Shyshkin
    Participant

    Hello, Igor.

    You can use processes to implement this functionality. You should create one process that will listen to Opportunity update and check whether your two fields are defined in change set, and if they are there then update sum.

    #25473

    Igor Chornobay
    Participant

    You should create one process that will listen to Opportunity update and check whether your two fields are defined in change set, and if they are there then update su

    Yevhen, do you mean I have to use Listener?
    Whether it is possible to implement in YML-files by setting workflow for Opportunity?

    #25474

    Yevhen Shyshkin
    Participant

    > Yevhen, do you mean I have to use Listener?
    I meant that you can create custom process to refresh your field. Here is example.

    Well, you can use listener too. In fact processes impelemented as a listener, so there is not much difference between these two approaches.

    > Whether it is possible to implement in YML-files by setting workflow for Opportunity?
    No sure what you mean by that… Workflow is used to manipulate entity data via transitions. In your case it would be better to create process and use it to handle updates. Here is example of existing process.

    #25475

    Igor Chornobay
    Participant

    I’m sorry, but could you give an example of summing the two values?

    #25476

    Yevhen Shyshkin
    Participant

    Here is example of such process. Of course, it doesn’t have any sense from business poin of view, but it should be just fine as a demonstraction of such functionality.

    #25477

    Yevhen Shyshkin
    Participant

    Notice: If you don’t know how to perform some action you can always create your own action, register it and use it in your configuration.

    #25478

    Igor Chornobay
    Participant

    Yevhen,
    thanks you for good example. It works!
    But now I have another problem 🙁
    This process works on our test installation, but do not works on production installation. Both installations have same version of oro/platform — 1.3.0.
    How can I debug this problem?

    #25479

    Yevhen Shyshkin
    Participant

    First – you should check whether this process is loaded and enabled – you can check that in menu System > Processes.

    Second – you can set breakpoint into Oro\Bundle\WorkflowBundle\EventListener\ProcessCollectiorListener and check whether process is scheduled and executed.

    Third – you should clear cache because data about enabled processes is stored there.

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.