How to import or populate Contact on Case

Hello!

I've been learning Sugar for the past few months.

I've setup some workflows for notifying portal users when their case changes status.

This WF uses the Contact Subpanel to get the recipient to send the notificacion via email.

However when a case is created in the administrative console the subpanel is not generated in creation.

I consider there are 2 solutions:

1) Changing the workflows to check the Contact field in the Case module. And populating this field from the subpanel when a case is created from the portal.

2) Populating the Contact (Subpanel) upon creating the case in the admin console.

Any ideas on how I could link both fields to prevent WF error when sending emails?

Note: I dont have any problem on doing this with the console or editing files/code in the instance

Thanks in advance!

  • Hi José Carlos,

    I think you must to check your WF and I don´t understand fine what are you doing exactly, but you don´t must have any problem with your WF because the modules of contact and cases are relationated. The subpanels don´t make from WF. May be you must to check the relations between Cases, Contacts, Accounts.
    Even the WF has a component of activity where you can create a new case, new oportunity, etc.
    Has too a component of action where you can modify a field.
    Please check the site: support.sugarcrm.com/.../
    Regards.

  • What I meant is that when the case is created via the portal, there is no Contact field filled in the Case, only on the subpanel.

    Because of this reason the workflow checks the subpanel. Id like the field in the CASE to be linked or filled too.

    F1. Example of the case without a Contact in the module Case:

    F2. The Contacts subpanel of the same case, which Contact was taken from the user who created the case in the portal

    So I was hoping for a way to have the same contact from F2. in the red square of F1.

    Hope this was a bit more clear Slight smile

  • Ok, yes It Is clear! I think you have a problem with your relationships, You must check them. And you check too the data process, save when and where you create the contact or the case. If your relationships are ambigous the WF will be too. In this case you can execute your solutions, both. The relationship between case-contact must to be from contact to case, one to many . The WF must be builded from case to contact. The data process save, must to be retriving the contact and creating a new case but i think you are using your sugar portal app so that is okay. 

    Regards.

  • You can create the api custom/modules/Cases/clients/portal/api/CustomCasesPortalApi.php which extends default modules/Cases/clients/base/api/CasesApi.php.

    Inside custom method createRecord you can do something like that:

    Fullscreen
    1
    2
    3
    4
    5
    $contact = BeanFactory::getBean('Contacts', $_SESSION['contact_id'], ['strict_retrieve' => true]);
    if (!empty($contact)) $args['contact_id'] = $contact->id;
    return parent::createRecord($api, $args);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Mind you have to replace contact_id in args according to the name of field where Contact ID is to be saved on Cases.

    Remember to run QRR after saving such file.

    André Lopes
    Lampada Global
    Skype: andre.lampada