OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM process.yml – Create Account/Contact for every new entry of a Custom Entity

This topic contains 9 replies, has 4 voices, and was last updated by  Bhavesh Tailor 7 years, 2 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
  • #30221

    Rodolfo
    Participant

    Hi Oro friends,

    I’m trying to modify MagentoBundle (process.yml) to create a new account/contact for every entry of my custom entity. (ERP Users).

    Here is the actual code:

    Indeed, I don’t have the field FirstName inside my custom entity, so why is it complaining? If I understood well, in order to create a contact I should just assign the value “$contact” to Contact\FirstName.

    Can someone please help me to understand it?
    Thank you

Viewing 9 replies - 1 through 9 (of 9 total)
  • Author
    Replies
  • #30222

    Yevhen Shyshkin
    Participant

    Hello, Rodolfo.

    I don’t see any issues in your definition that may cause this issue. Possible reasons:

    1) this issue caused not by this process definition, but by another one; please, check the list of processes related to this entity in DB – if you renamed definition then DB might have old outdated definition

    2) definition stored DB is outdated, i.e. you updated file but didn’t uploaded it to DB – you just need to run oro:process:configuration:load command

    If it’s none of these reasons then you can run this process job again from CLI (failed processes don’t removed from DB) and check stacktrace for this exception – it might gave you a clue.

    Please, post results of your investigation in this topic.

    #30223

    Rodolfo
    Participant

    Hi Yevhen! ( @yshyshkin )

    Thanks for your suggestion to debug that Exception. I was able to find some problems.

    I was getting a conflict with the attribute’s name for @create_entity. The same ‘$contact’ name has being used for a field name in my custom entity. So I changed to some different attribute name and the error is gone.

    So, I reduced the process.yml as you can see bellow and now I don’t have error, but the account/contact are not being created.

    Can you please verify if you can see something wrong here?

    In my logs I don’t have errors.

    [2015-11-02 11:22:18] app.DEBUG: Process executed {“definition”:”instore_customer_creation”,”event”:”create”,”entityId”:30895} []

    php app/console oro:process:execute:job –id=987835
    Process job 987835 successfully finished

    #30224

    Rodolfo
    Participant

    Found other problems. Missing many-to-one fields in my custom table. I’m creating some migration files to rename columns and create new fields in order to fix it. I’ll post here the results.

    Thanks!

    #30225

    Rodolfo
    Participant

    Hi there, indeed the problem was the missing many-to-one relation with my custom entity and accounts/contacts. All good, but now I have other question:

    If the Account or Contact exists, I want to just assign the account_id to the entity that triggered this process. Do I need to create a custom action for this?

    I’m trying to follow this idea:

    Thank you

    #30226

    Rodolfo
    Participant

    Hi guys.. Anyone with a better idea? I’m creating a custom action and trying to replicate the same idea from @create_entity but only updating it.

    #30227
    #30228

    Rodolfo
    Participant

    Hi @dkhrysev

    Thanks for your reply.

    Where is the assignment of an existing entity located? Is it here?

    - @call_method: # connect customer with Contact
    conditions:
    @empty: $new_b2bcustomer.contact
    parameters:
    object: $new_b2bcustomer
    method: setContact
    method_parameters: [$lead.contact]

    #30229

    There are two possible ways of assignment:
    – specify target field in attribute parameter
    – assign to temporary attribute that is not an entity property and then assign with @call_method action. This way may be used, for example, when you are adding new items to collection

    #30230

    Bhavesh Tailor
    Participant

    Hi ,

    I am trying to create contact from embedded web form . When receiving a form submission, the system should search by email for an existing contact record.
    1 : If a contact record is found, a Case should be created and assigned to the existing contact record.
    2: If no contact record is found, a Contact Request record should be created.
    3: From view Contact Request screen: /contact-us/view/1 we add a button for “Create Contact”. Clicking this button will create a contact record and delete the contact request record.


    Bhavesh

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

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

Back to top