0
votes

This is sort of a follow-up question to this one. I am trying to send web-form data through Freeform, into MS Dynamics 2011. We had an extension built to send the data into MS dynamics, and it was built in such a way that we could add additional fields as we found that we wanted to collect that data.

Thanks to several patient folks in that thread, and some more research on my part, I have now gotten it through my skull that lookup values don't have numerical values, but unique IDs (GUIDs). I even figured how to identify a lookup value's GUID. But then, when I went to build an array with the GUIDs to map the field data into MS Dynamics, it wasn't populating.

Here's some of the code:

$configData['fieldMapping'] = array(
    'first_name' => array('name' => 'firstname', 'value' => null),
    'last_name'  => array('name' => 'lastname', 'value' => null),
    'email' => array('name' => 'emailaddress1', 'value' => null),
    'email_address' => array('name' => 'emailaddress1', 'value' => null),
    'phone' => array('name' => 'telephone2', 'value' => null),
    'credit_history' => array(
        'name' => 'new_selfreportedcredithistory', 
        'value' => array(
            'excellent' => 100000000,
            'Good'          => 100000001,
            'Fair'          => 100000002,
            'Poor'          => 100000003,
            'Bad'           => 100000005,
        )
    ),
    'campaign_name' => array(
        'name' => 'campaignid', 
        'value' => array(
            'USDA' => 'B53EA05A-2C29-E211-8C3A-78E3B5101ED7',
            'Radio Ads'             => '8F254BB4-5575-E211-8AAB-78E3B510ED7',
            'Postcards'             => '4F8E216D-9C1D-E211-8DA=-78E3B508542D',
        )
    ),
    'how_referred' => array('name' => 'leadsourcecode', 'value' => null)
);

I put the quotes around the GUIDs because when I left them not in quotes, I got warnings of PHP Syntax errors from Dreamweaver. However, when I test out one of my forms and pass back one of those text values (lefthand column) in the form, with its GUID being identified here, that field is still not mapping. The credit_history field is mapping just fine - but that's going into an option set field, not a lookup field. I just copied the option set field mapping because it looked like it might work: it was building an array to "translate" what our forms might send it into a value that MS Dynamics would recognize for that field and thus know how to populate the data.

Does anyone have any ideas as to why this might not be working? Alternately, is my question a bit to vague to troubleshoot? (I know I haven't given you the full code for the extension - and while we are planning to hire this group again to make a different change to the extension, and while we could ask them to map these fields...I'd kind of like to be able to figure it out myself, if I can.)

1

1 Answers

0
votes

I know nothing about what you are doing, or how it is working, but within the CRM SDK itself, the lookup field is actually of type EntityReference, which contains both the GUID, and the entity logical name of the lookup entity type. So whatever your process is that translates your data, it will need to accept the entity logical name as well (all lower case). Which looks like campaign in your case...