OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

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 Yevhen Shyshkin 5 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #28274
    Igor Chornobay
    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
  • #28275
    Yevhen Shyshkin
    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.

    #28276
    Igor Chornobay
    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?

    #28277
    Yevhen Shyshkin
    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.

    #28278
    Igor Chornobay
    Igor Chornobay
    Participant

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

    #28279
    Yevhen Shyshkin
    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.

    #28280
    Yevhen Shyshkin
    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.

    #28281
    Igor Chornobay
    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?

    #28282
    Yevhen Shyshkin
    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)

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No