Get Current User decimal digits and 1000s separator

i am currently need to create a js function to do some calculation.
So i am creating an ajax call to a custom Entrypoint which will have to retrieve UserPrefs decimal digits and 1000s separator.
So which is the best way to do in php entrypoints? I’ve starting with:

global $current_user;

but i am not able to find this info.

Many Thanks

Change call to


Seems nothing happens.
I’ve tried instead:


And seems to work, without including globals

Unfortunately too early to smile!
The Entrypoint is correct however the js function still get me undefined because of deferred ajax call .
The js function where the js file is added like an include in editviewdefs:

$(document).ready(function() {
    var test = getUserInfo();
    alert(test.tSeparator); //which should return "."

Then the getUserInfo():

function getUserInfo() {
        type: "POST",
        url: 'index.php?entryPoint=getUserInfo', // Custom EntryPoint
        //url: 'index.php?module=CDZ_Contracts_Mobile&action=getUserInfo', // Action in Custom Controller
        dataType: "json",
        success: function(data) {
            var yourDataStr = JSON.stringify(data) 
            var obj = JSON.parse(yourDataStr);
            // Run the code here that needs
            //    to access the data returned
            return obj;
        error: function() {
            alert('Error occured');

The alert in getUserInfo works as expected while alert(test.tSeparator); will return undefined.
In console i can see:
jQuery.Deferred exception: test is undefined

Any help is appreciate.

And what is the main difference between make an ajax call to a custom action in controller or to a custom Entrypoints?

Which would be better?

Many Thanks


  1. Did you registry entryproint here: custom/Extension/application/Ext/EntryPointRegistry/ (documentation:
  2. Do you sure that you entryproint return format JSON?

the entrypoint is registered and it works well and it returns valid json, this is my test code:

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
$result = get_number_separators();
$userDelimiters = array(
    'tSeparator' => $result[0],
    'dSeparator' => $result[1]
echo  json_encode($userDelimiters);

As mentioned the


inside getUserInfo function works as expected but if i call call the funciton from outside like here:
var test = getUserInfo();
and then i try to print the result like this:

It return Undefined probably because the value is returned before waiting async ajax to complete.
What do you think about?
Am i in a right way?
What needs to be changed?

Many Thanks


  1. ajax don’t return anythink (
  2. If you declared object xhr it chould return XMLHttpRequest

Is there any SuiteCRM example for that?
It could be a good starting point.

There are some simple $.getJSON Ajax calls in

which call controller functions in

which call helper functions in

ok thanks.
i will check and let you know.