my solution

vinceyoumans - July 25, 2008 - 15:32
Project:SugarCRM Webform Integration
Version:6.x-1.0
Component:Documentation
Category:support request
Priority:normal
Assigned:crdant
Status:active
Description

I can not get this system to work, but I am looking for more documentation. Is there a way to test and confirm the sugarCRM is set up properly? I am confused about where to place the override files, and especially about the setup that talks about the re-direct. thanks. Actually, I would be glad to assist in working on this project if someone gets back to me.

#1

vinceyoumans - July 25, 2008 - 16:41

i am looking more at the code.

in the \d6-module\sugarwebform\sugarcrm dir there is a file: default-leadCapture_override.php
the file has a section like this:
# set up the array of usernames and hashed password
$users = array(
'acquia.com' => array('name'=>'name-acquia.com', 'pass'=>'292636ae210da853937e52ed9fe2ed30')
);

I have some quesitons.
1... should I modify and copy THIS file to the SugarCRM site.
2... If Yes, where should it be copied? Root?

3... the 'acquia.com' - is this the source of the web form? will the form return to this site? or is this the SugarCRM location?

4... 'Name-aquia.com' : is this the user name. should there be a user in sugarCRM by this name?
5... I ask question 4 becuase question 5 is that the 'pass' looks like a password hash, but the name-acquia.com does not look like a user name.

6... in DRUPAL->webform ->sugarCRM settings. SUGARFORMs are posted to: (The URL the form will be posted to. The confirmation option above MUST be a redirect URL in order to return from SugarCRM.).
This is suppose to be the site of the SugarCRM site? Correct? What do you mean by a re-direct?
for example, if my DRUPAL site is DRUPTUBE.org and my SugarCRM installation is at: CRM.ajaja99.net
I am guessing that I would put CRM.ajaja99.net in this field?

7... Lead Source:
the next question reads: "The name SugarCRM uses to identify the source of the lead, eg. Web Site."
assuming that the drupal site is: druptube.org, I would use this value. I would also update the default-leadCapture_override.php with this value:
$users = array(
'druptube.org' => array('name'=>'name-acquia.com', 'pass'=>'292636ae210da853937e52ed9fe2ed30')
);

at anyrate... this is what I have done, all that happens is that after doing a submit, I get directed to the SugarCRM logon page. when I log on there is no lead generated.

so any hint you can give me would be very appreciated.

#2

crdant - July 25, 2008 - 19:41

Vince,

It sounds like an issue with the mapping between the credentials you are passing from Drupal to SugarCRM, which are based on the mapping that is presented. You need to edit leadCapture_override.php to provide an array that maps user names to hashed passwords, and then use a username that appears in that array as the credentials when going from Drupal to SugarCRM.

Assuming that is the name of a valid SugarCRM user who should enter the lead.

1. Connect to the Sugar database. Query the user table to find the hashed password for the user you wish to connect as. Copy the hashed password:

select user_hash from users where username = ''

2. Edit the file leadCapture_override.php to contain your new mapping:

$users = array(
'' => array('name'=>'', 'pass'=>'')
);

3. Create a webform and edit the SugarCRM settings:

SugarCRM URL: http:///leadCapture.php
Lead Source: a lead source configured in your Sugar instance ("Web Site" is on of the defaults)
Sugar CRM user: above

#3

crdant - July 25, 2008 - 19:42
Assigned to:Anonymous» crdant

#4

vinceyoumans - July 26, 2008 - 15:32
Title:documentation» ...MUST be a redirect URL...

question: on the webform in drupal, the field:
Sugar Form is posted to:
The URL the form will be posted to. The confirmation option above MUST be a redirect URL in order to return from SugarCRM.

could you explain what you mean by a redirect: I have been putting "http://crm.mydomain.com/leadcapture.php"

I get an error " system is not available..." or something like that, but it just flashes by as ir redirects to the drupal "thanks for submitting screen"

#5

vinceyoumans - July 26, 2008 - 15:47
Title:...MUST be a redirect URL...» emails

email confirmation
when I web form uses a sugrCRM module, is there also an email sent? can I have cinfirmation emails sent to site owner and to the submitter?
I aski becuase I get no emails to anyone... but then again, the SugarCRM submittions are still not working.

also, is there a way to view a log of errors. I could have the credentials wrong, but I am sending directly to the admin on sugarCRM. and the url, for the second it is up before the redirect, is the right spot.

#6

crdant - July 28, 2008 - 16:09

The current implementation replaces the email and saving from webform with the post to SugarCRM. Sugar can be configured to send email based on the new lead.

The redirect URL is where the user should be sent after posting the form. Try setting it to you home page and see if you get brought back.

The "system not available" that flashes by sounds like there might be an issue with connecting to Sugar. If you are logging into Sugar at crm.mydomain.com then it should be http://crm.mydomain.com/leadCapture.php that you are using as the SugarCRM URL. I'm not sure if it is case sensitive or not, but it might be.

#7

vinceyoumans - July 30, 2008 - 12:28

well, I hacked the code, put in some debuging stuff... and I am convinced that this is the issue.

Sugar does not like my account credentials that I have in my leadCapture_override.php
I know that this file is being called, but the i dont think I have the accounts set up properly.

I am going to try to work on this more today, but I was wondering if someone could leave a more detailed descriptions of the parameters that go in this file.
thanks

#8

walterbamert - October 12, 2008 - 21:54
Version:6.x-1.0» 5.x-1.2

i could use some help also.

i followed the directions in the install.txt file as well as any info in this thread and i have not been able to make this work.

first, my copy of sugar Version 5.1.0 (Build 4732) does not have a leadCapture_override.php file in the root directory so there was nothng to add the info your default-leadCapture_override.php to.

so i took yours and dumped it in the root.

i setup the drupal web form to point to mycrm.php?leadCapture.php and get the following:
Not A Valid Entry Point

in the default-leadCapture_override.php i'm using the admin for the Sugar CRM and copier the hash per the instructions.

since i seem to be missing the orgional sugar file: leadCapture_override.php i kind of assume this is why it's not working.

below is the entire contents of the leadCapture_override.php i put in the root directory.

what am i missing?
walt

<?php

# set up the array of usernames and hashed password
$users = array(
'drupaltest.com' => array('name'=>'admin', 'pass'=>'72f7bf3ad7d07984109ee42d5aa01044')
);

# identify the web site user by id and assigned the lead to them
$assigned_user_id = $current_user->retrieve_user_id($users[$_REQUEST['user']]['name']);
if( !isset($_POST['assigned_user_id']) || !empty($_POST['assigned_user_id']) ){
$_POST['assigned_user_id'] = $assigned_user_id;
}

# if we have an Opt-In field, we want to get rid of any Opt-Out field that we may have
if ( !empty($_POST['email_opt_in']) ) {
unset($_POST['email_opt_out']);
}

# convert opt out to an explicit binary boolean
if ( isset($_POST['email_opt_out']) ) {
$_POST['email_opt_out'] = 1;
}

#9

robbertnl - October 17, 2008 - 10:01

I am also trying to get this working.
I am using Drupal 6.5 and SugarCRM 5.1

Concerning the 'Not a valid Entry point': Sugar has changed something in the 5.1 release.
You shouldn't use leadcapture.php but index.php?entryPoint=leadCapture instead.

But now i get other error messages:

Notice: Undefined variable: sugar_config in \modules\Leads\Capture.php on line 34

Notice: Undefined variable: current_user in \leadCapture_override.php on line 9

Fatal error: Call to a member function retrieve_user_id() on a non-object in \leadCapture_override.php on line 9

I am also wondering if it is possible to automatically assign an campaign id instead of lead source.

#10

bfelix - October 23, 2008 - 13:53

also experiencing similar issues. I also discovered the new approach in Sugar 5.1, and adjusted to

index.php?entryPoint=leadCapture

instead.

But then get:

Fatal error: Call to a member function retrieve_user_id() on a non-object in /var/www/sugar-dev/leadCapture_override.php on line 11

which is:

$assigned_user_id = $current_user->retrieve_user_id($users[$_REQUEST['user']]['name']);

So, is retrieve_user_id the culprit?

For what its worth, I got it to work slightly by commenting out this portion of the leadCapture_override.php -- the issue then is that it does not record the critical details, like email, lead source, etc. Just the name. But it was nice to see it work.

I'm on Drupal 5.

brad

#11

linuxRaudi - March 25, 2009 - 08:43
Title:emails» my solution

Dear Community,

In my case. PHP brought me following error message:
PHP Fatal error: Call to a member function retrieve_user_id() on a non-object in [...]

and that's the loc within the broken file:
$assigned_user_id = $current_user->retrieve_user_id($users[$_REQUEST['user']]['name']);

That means, that $current_user is not an object and it's not possible to call the function retrieve_user_id

What I did is the following:
1.) uncomment the broken line
2.) edit $users and add 'userid'=>'xxxxx'
get the userid from the database, same procedure as done with you password
3.) add the following line below the line from point 1
$assigned_user_id = $users[$_REQUEST['user']]['userid'];

That's it, works fine in my case, hope this helps others.

Best regards
Andreas

p.s: by the way, with this version you gain some milliseconds (or less) process time ;-)

#12

vinceyoumans - March 25, 2009 - 13:56
Version:5.x-1.2» 6.x-1.0

could you list which version of DRUPAL and which version of Sugar you are using here. I am about to take another look at this issue.

#13

activedatasource - October 30, 2009 - 23:24

I'm having this Issue.

I just did a fresh install of everything
* Drupal 6.14
* webform: 6.x-2.8
* sugarwebform: 6.x.-1.0
* SugarCRM: 5.5.0beta2 Pro (the latest release.)

I'm about to try what the prior post recommends, but I thought you should know the issue occours on the latest (same codebase as SugarCE 5.5rc2).

M

#14

activedatasource - October 30, 2009 - 23:35

hah, adding:

global $current_user;

to the top appears to work, but I get:
We're sorry, the server is currently unavailable, please try again later.

Is that normal for a manual submission?

#15

Don Robertson - November 20, 2009 - 03:21

Hi all - is there any documentation on how to set this up? I have found some pages on other sites, and some issues here but they are not very clear. Some of the advice does not seem to be correct either.

Anyway - I have installed and created a test form in Drupal which adds a lead to Sugar :-)

Versions: Drupal 6.14, SugarCRM 5.5RC4, SugarCRM Webform 6.x-1.0, Webforms 6.x-2.3

1. Install and enable the Webforms and Sugar Webforms Integration modules in Drupal
2. Copy modules/sugarwebform/sugarcrm/default-leadCapture_override.php to /leadCapture_override.php
3. edit the leadCapture_override.php file
add 'global $current_user;' to the top of the file
edit the user array
$users = array(
'acquia.com' => array('name'=>'acquia.com', 'pass'=>'292636ae210da853937e52ed9fe2ed30')
);
where name is the SugarCRM user name
pass is the hashed SugarCRM password of the above user (get this from the data base)
I think the first 'acquia.com' can be anything - I used the SugarCRM user name.

4. Configure the SugarCRM Webform in Drupal.
in the Custom Fields dialog, put the SugarCRM field key and the Drupal Webform field name. eg:
first_name|Given Name
last_name|Family Name

According to this site http://www.computerminds.co.uk/how-capture-sugarcrm-leads-drupal, you can use these SugarCRM keys:

* description
* lead_source_description
* status_description
* refered_by
* salutation
* first_name
* last_name
* account_name
* title
* department
* phone_work
* phone_mobile
* phone_home
* account_name
* phone_other
* phone_fax
* email1
* email2
* do_not_call
* email_opt_out
* primary_address_street
* primary_address_city
* primary_address_state
* primary_address_postalcode
* primary_address_country
* alt_address_country
* alt_address_street
* alt_address_city
* alt_address_state
* alt_address_postalcode

5. Create the Drupal Webform, using some of the Drupal field names entered above. You do not need to use them all, but using some makes sense :-)

Webform Settings
Confirmation message or redirect URL:
Absolute URL to a Drupal page, eg:
http://www.robertson.net.nz/thanks

SugarCRM Settings
Sugar Form is posted to
Path to the Lead Capture script in the following form:
http://mysite.com/crm/index.php?entryPoint=leadCapture

Lead Source:
One of the lead sources used in the SugarCRM drop down. Web Site is a default option.

SugarCRM User:
I used the same user I used above. I don't know if this will assign the lead to another user or not. One mistake at a time is my motto.

Save and test. Good luck ;-)

#16

Don Robertson - November 20, 2009 - 03:33

Update: Seems that if you use the above SugarCRM field keys in the Drupal Webform element in the Advanced settings Field Key, you don't need to add the field keys to the Custom Fields dialog in the Drupal SugarCRM Webform configuration dialog.

don

 
 

Drupal is a registered trademark of Dries Buytaert.