Hi, does anyone have experience with interface Drupal with NetSuite CRM / ERP modules? Sample scenario - Users register in Drupal need to be sent to NetSuite as a customer or a contact, and when a customer or contact is disabled in NetSuite, the Drupal user gets disabled as well.

I am thinking that this can be accomplished by using webservices. Does Drupal have any out-of-box functionality to would make webservices interface development easier, or is there any other way to push and pull data from a hosted application like NetSuite?

Thanks!!

Comments

jwickersham’s picture

Have you had any success in exploring Drupal / Netsuite?

ejaincom’s picture

Hi,
Did anyone found a solution for the same,
Thanks,
abhi

Evan.Dudley’s picture

I three am also interested in finding a solution for connecting NetSuite and most Ubercart functions/actions.

travisc’s picture

I'm looking into this as well.

mrosenbaum’s picture

Has anyone made any headway on this issue?

ozecho’s picture

I'm interested in a solution to this as well...

bg1’s picture

Could a web service consumer module work for this where views and forms could interact with remote web services?

drupaledmonk’s picture

Hey I am building a module which uses the PHPToolkit of netsuite for one of clients. His use-cases are very limited, if at all anyone interested in lending a hand, we can work together.

Summit’s picture

Subscribing, interested in ecommerce/erp integration.
greetings, Martijn

lukehamilton’s picture

Any updates on this, I too am looking into this for my site?
Thanks
Luke

ozecho’s picture

I've used the PHP Toolkit to integrate a drupal site to Netsuite to do a few things like
- create Contact records in Netsuite when someone signs up on Drupal
- create sales records in Netsuite when someone donates or buys something through paypal
- extract all Netsuite CRM records and populate Drupal node records
- extract all Netsuite Records of a particular type and syncronize them (just one way).

The thing I have come to realize is that its all pretty custom. ie. as soon as you modify Netsuite in anyway and have customfields defined, the webservices requires their internal name in order to get it to work to populate those fields.

In essence to create a single module I reckon is going to be tough, because Netsuite is so customizeable.

I guess it would be possible to create one for a Vanilla version of Netsuite, but I doubt it would solve most use cases when more information is required to be passed / accepted.

Just my two cents.

drupaledmonk’s picture

Yes thats very true, to create a module to integrate is very tough with all the customizations that netsuite provides us. I completed the module for my client....but I dont think it will be of use for others. I hope some one comes up with something new.

chhavik’s picture

HI ozecho,

You said that you have implemented few things using PHP Toolkit. Will it be possible for you to share your code as it would be a great help for us to start with the Drupal-Netsuite Integration.

Regards.

Christian Le Fournis’s picture

What are the steps to connect Drupal to Netsuite with the Phptoolkit?
Do you have a quick tutorial or similar, would be greatly appreciated.

Thank you.

drupaledmonk’s picture

Import the toolkit into your custom module directory and start playing around with it in the module code.
Create a form for your self which will get data from the user in the drupal website. Then handle the data and post it to netsuite. A sample Use Case

include_once (drupaltonetsuite_path().'/PHPtoolkit.inc');
    	$myNSclient = new nsClient( nsHost::live );
	$email = "example@example.com";
	$password = "123";
	$account = "TSTDRV765234";
	$role = "3";

	// set request level credentials. (email, password, account#, internal id of role)
	$myNSclient->setPassport($email, $password, $account, $role);

        //Alternatively store it in the database and retrieve it.
	//include_once (drupaltonetsuite_path().'/login_info.inc');
	$customerFields = array (
		'isPerson'		=> false,
		'firstName'		=> $form_state['values']['first'],
		'lastName'		=> $form_state['values']['last'],
		'companyName'		=> $form_state['values']['company_name'],
		'phone'			=> $form_state['values']['phone'],
		'email'			=> $form_state['values']['email'],
		//'country' 		=> $form_state['values']['country'],
		'giveAccess'		=> false,
		'entityStatus'         => array('internalId' => '6'),
	);
	// create Customer record
	$customer = new nsComplexObject('Customer');
	// set fields
	$customer->setFields($customerFields);
	// perform add operation and store nsWriteResponse object in $addResponse variable 
	$addResponse = $myNSclient->add($customer);
	// handle add response
	if (!$addResponse->isSuccess) {
		echo "Lead couldnot be added in netsuite. Error: " .$addResponse->statusDetail[0]->message;		
	} else {
		echo "Lead has been successfully added";
	}
Andrew Udvare’s picture

Had issues with globals regarding the PHPToolkit.

'Theoretical globals': http://groups.drupal.org/node/85444

/**
 * Properly include the PHPToolkit from NetSuite.
 */
function _ns_include() {
  global $myDirectory; // Theoretical globals
  global $version;
  global $endpoint;

  include_once drupal_get_path('module', 'ns_module').'/PHPToolkit/PHP_toolkit.php';
}

/**
 * @return nsClient object.
 */
function ns_client() {
  $mail = variable_get('ns_mail', '');
  $pass = variable_get('ns_pass', '');
  $account = variable_get('ns_account', '');
  $role = variable_get('ns_role', '');

  if ($mail == '' || $pass == '' || $account == '' || ($role == '' || !is_numeric($role)) {
    return NULL;
  }

  static $client;

  if (is_null($client)) {
    try {
      $client = new nsClient();
      $client->setPassport($mail, $pass, $account, $role);
    }
    catch (SoapFault $f) {
      watchdog('netsuite', t('SOAP error while initialising client. Message: %s.'), array('%s' => $f->getMessage()), WATCHDOG_ERROR);
      return NULL;
    }
    catch (Exception $e) {
      watchdog('netsuite', t('Error occurred initialising client. Message: %s.'), array('%s' => $e->getMessage()), WATCHDOG_ERROR);
      return NULL;
    }
  }

  return $client;
}

I was also wondering whether or not it is better to keep the client 'alive' all the time as a global variable.

sime’s picture

Please note the issue queue for a possible Drupal module http://drupal.org/project/netsuite

Anyone who has done work with PHP/Drupal and NetSuite API is invited (encouraged!) to contribute learning and code samples to the issue queue.