OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Workflows: Attachments/Files/Images

This topic contains 7 replies, has 3 voices, and was last updated by  mirche 9 years, 1 month ago.

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

  • Creator
    Topic
  • #24917

    Jaimy
    Participant

    Hi fellow Oro’ers,

    I’ve recently viewed the oro workflow webinar and I was quite impressed by the presentation itself. Since there was a nice demo and code example on how these workflows work as far as the configuration goes, great job Oro team!

    Since I’ve had some play time with the workflows I recently ran into some trouble. Although the workflows are very flexible and very well documented (in the workflow bundle), I came across an maybe somewhat impossible configuration.

    The workflow basically follows the same flow as the b2b_flow_sales_funnel flow only with some extended fields. The dealbreaker on this was adding an attachment/file/image type to the flow. What I basically wanted to create is when an opportunity is being approved, read close_as_won, I want to be able to add an Attachment (file/image) for future reference. Since the attachment isn’t a property path on any of the entities which live in this workflow I figured that I had to create a new entity:

    Ok so far so good, this will correctly load into the workflow. Next thing was to add an image uploader to the correct form:

    This turned out just as nice as I had in mind. The problem I’ve encountered is on saving this darn thing. I’ve tried to add a init_actions => create_entity or create_object with the sales_flow_owner as the owner of the file. I’ve tried to add a post_actions => create_entity and create_object, but it will produce the same error over and over again:A model for "Oro\Bundle\WorkflowBundle\Model\WorkflowData::approval_document" was not found

    For now I’m stuck at this error for a couple a days and to be honest don’t have the knowledge (yet) to see or create something for this. I wonder if some of you might have tried this or solved this, for me (for now) impossible error. Maybe some of you might have some ideas on what to do or explain why this is happening? I look forward to your responses!

    Kind Regards,

    Jaimy Casteleijn

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #24918

    Yevhen Shyshkin
    Participant

    Hello, Jaimy Casteleijn.

    Unfortunately, form type oro_file requires tight relation with parent entity and it can’t work without it. The only way it can be used now is by injecting whole form type of a parent entity – i.e. you have entity with form type “my_entity” that includes file field with form type “oro_file”, and in this case you should inject whole entity form type “my_entity”.

    Anyway your case is totally valid and it should be supported out of the box without any hardcoded fixes. We will improve our file processing logic so it will be able to use it separately from parent entity.

    Thank you for kind response, we are going to develop our application and make it better!

    #24919

    Jaimy
    Participant

    Hi Yevhen,

    Thank you for your fast responds. Thank you for your explanation, this makes sense since the files/attachments are being added through an extension if I understand correctly, since there is no data storage field on the entity (in this case Opportunity).

    I’m however going to try your fix by injecting the whole entity form, this would help for now and look forward to the improved logic for file processing. Keep up the good work!

    Kind Regards,

    Jaimy Casteleijn

    #24920

    Yevhen Shyshkin
    Participant

    > I’m however going to try your fix by injecting the whole entity form, this would help for now and look forward to the improved logic for file processing.

    Probably, you can create special form type that will contain only file field and use it in workflow – but this is rather hack then a real solution. Also opportunity must exists and must have file field relation.

    #24921

    Jaimy
    Participant

    Hi Yevhen,

    So basically it’s not possible without a real solution (for now). Since opportunity doesn’t have a relation with file directly, but attachment/file does have a relation with opportunity.

    So without burning my fingers for now and not getting into trouble with rewriting stuff that actually doesn’t belong, I would rather wait for a real solution instead of writing a hack to get the job done.

    This however raises a question about the Attachment/Notes solution at the moment. These two entities are connected to account/opportunity etc.. via an Extension rather than creating fields on the entities. Is there a particular reason for choosing this implementation?

    I look forward to your responds

    Kind Regards,

    Jaimy Casteleijn

    #24922

    Yevhen Shyshkin
    Participant

    I think it was implemented in this way to allow adding of attachments/notes to any entity extended entity including custom ones.

    #24923

    Jaimy
    Participant

    Hi Yevhen,

    Thanks for the responds! Maybe it’s for detaching purposes so you’re not creating any more dependencies on the entities. Otherwise you could have easily added an other Collection field of files/attachments to the entity itself, I guess. Anyway, I’ll wait patiently for attachments/files to be used in workflows.

    Kind regards,

    Jaimy Casteleijn

    #24924

    mirche
    Participant

    Hi,

    I am facing the same issue as Jaimy.
    When we could expect this to be solved?

    Regards,

    Mirjana

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

The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.

Back to top