ssossossosso

Forums

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

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

  • Creator
    Topic
  • #7585
    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
  • #7612
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    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.

    #7652
    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?

    #7655
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    > 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.

    #7696
    Igor Chornobay
    Igor Chornobay
    Participant

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

    #7713
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    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.

    #7716
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    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.

    #8253
    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?

    #8254
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    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.