AnsweredAssumed Answered

Why doesn't BeanFactory("module name", id) return the record from the db?

Question asked by James Palmisano on Jul 11, 2016
Latest reply on Jul 14, 2016 by James Palmisano

Hello World, 

So I have an api call that is working.  That is I can put in the url and some argument and print out that argument. I want to get some data using beans,  I know that I am clearly doing something wrong because nothing is return what I expect it to.  For example I have this code:

 

$accountID = '1d53d7c0-5783-9a99-09a6-555e943c52cb';

$accountBean = BeanFactory::getBean("Accounts",$accountID);

//Shouldn't this return the record the db?

return $accountBean;

 

According to the documentation on the developer site when you add the ID of the bean you want the bean factory should return the record from the db. Correct?

 

https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.5/API/Classes/BeanFactory/#Retrieving…

 

 

This is the value from the db:

 

 

So shouldn't I expect to see a bean representing that record with that data that have a name property of Internal testing Team?

 

When I test the code using postman I get this instead:

As you can see I can search for the name value but nothing is there. It appears to just be the definition of the object that I returned and not the record from the database.

 

Why is this?  Can someone please shed light on my problem.

 

Best Regards

  James Palmisano

Outcomes