[Vtigercrm-developers] Ways to create bulk users
apcloic
apcloic at gmail.com
Tue Mar 17 09:33:32 GMT 2015
Hi Pranav,
The link point to old forum URL.
I remember someone on the new discussion forum found a simple way to access
old forums threads by changing URL but I don't remember the syntax.
Maybe someone else.
For CSV import, I've been using something like the following script :
<code>
<?php
include_once('vtwsclib/Vtiger/WSClient.php');
$url= 'http://your_vtiger_url';
$client = new Vtiger_WSClient($url);
$login = $client->doLogin('admin', 'your_admin_key');
if (!login) echo 'Login Incorrect';
else {
$assoc=array();
$first=true;
if (($handle = fopen("your_csv_file.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 0, ";")) !== FALSE) {
if ($first) {
$assoc=$data;
$first=false;
}
else {
$send=array();
foreach ($assoc as $key=>$name) {
$send[$name]=$data[$key];
}
// var_dump($send);
// echo '<hr/>';
$module = 'Users';
$record = $client->doCreate($module,$send);
if($record) {
$recordid = $client->getRecordId($record['id']);
print_r($recordid);
}
}
}
fclose($handle);
}
}
?>
</code>
Remember that you there is multiple mandatory fields.
Regards,
--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/Ways-to-create-bulk-users-tp7333p15639.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.
More information about the vtigercrm-developers
mailing list