<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thank you Allan. Trying this query as in the link you sent me I get the same error message.</div><div><br></div><div>Code : <br></div><div>include_once 'include/Webservices/Utils.php';<br>$crmid = '1'; // ID of Leads record.<br>$wsid = vtws_getWebserviceEntityId('Users', $crmid);<br>include_once 'include/Webservices/ModuleTypes.php';<br>$current_user = CRMEntity::getInstance('Users');<br>$current_user->retrieveCurrentUserInfoFromFile(1);</div><div><br></div><div>Error:<br></div><div>
Class "Vtiger_Module_Model" not found in /home/vtigercrm/data/CRMEntity.php:84 <br></div><div><br></div><div>Any hint what Im doing wrong?<br></div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><br></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mar, 12 dic 2023 a las 2:37, Alan Lord (<<a href="mailto:alanslists@gmail.com" target="_blank">alanslists@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You _should_ create a new user via the Server API if local, or via <br>
Webservices (which is basically the Server APIs over REST):<br>
<br>
<a href="https://community.vtiger.com/help/vtigercrm/developers/server-apis.html" rel="noreferrer" target="_blank">https://community.vtiger.com/help/vtigercrm/developers/server-apis.html</a><br>
<br>
HTH<br>
<br>
Al<br>
<br>
On 12/12/2023 08:19, Alexander Allen wrote:<br>
> I´m trying to create a user via api running this script but I get as <br>
> error " *Fatal error*: Uncaught Error: Class "Vtiger_Module_Model" not <br>
> found in ../modules/Vtiger/handlers/CheckDuplicateHandler.php:35"<br>
> <br>
> Does some one achieve this before? Im using vtiger 7.5 with php 8.1<br>
> <br>
> <?php<br>
> <br>
> require_once 'modules/Users/Users.php';<br>
> $user_email='<a href="mailto:new_user@yourdomain.com" target="_blank">new_user@yourdomain.com</a> <br>
> <mailto:<a href="mailto:new_user@yourdomain.com" target="_blank">new_user@yourdomain.com</a>>';<br>
> $role_id_to_assign='H1';<br>
> $user = new Users();<br>
> $user->column_fields["last_name"] = 'John';<br>
> $user->column_fields["user_name"] = 'Mee2';<br>
> $user->column_fields["status"] = 'Active';<br>
> $user->column_fields["is_admin"] = 'off';<br>
> $user->column_fields["user_password"] = $user_password;<br>
> $user->column_fields["tz"] = 'Europe/Berlin';<br>
> $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';<br>
> $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';<br>
> $user->column_fields["weekstart"] = '1';<br>
> $user->column_fields["namedays"] = '';<br>
> $user->column_fields["currency_id"] = 1;<br>
> $user->column_fields["reminder_interval"] = '1 Minute';<br>
> $user->column_fields["reminder_next_time"] = date('Y-m-d H:i');<br>
> $user->column_fields["date_format"] = 'dd-mm-yyyy';<br>
> $user->column_fields["hour_format"] = 'am/pm';<br>
> $user->column_fields["start_hour"] = '08:00';<br>
> $user->column_fields["end_hour"] = '23:00';<br>
> $user->column_fields["imagename"] = '';<br>
> $user->column_fields["internal_mailer"] = '1';<br>
> $user->column_fields["activity_view"] = 'This Week';<br>
> $user->column_fields["lead_view"] = 'Today';<br>
> $user->column_fields["email1"] = $user_email;<br>
> $user->column_fields["roleid"] = $role_id_to_assign;<br>
> $new_user_id = $user->save("Users");<br>
> <br>
> ?><br>
> <br>
> _______________________________________________<br>
> <a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br>
<br>
<br>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div>
</blockquote></div></div>