Below is a screen shot of an Opportunity Summary page. You can see that as the mouse hovered over the Company Name in the 'For' panel of the screen a tool-tip appeared that displayed the company's Status and Type. This is information that is not normally available within the browser when looking at an Opportunity record. The comp_status and comp_type fields are not present anywhere within the HTML of the page. This is data that has been retrieved from the server and added to the screen using an Ajax call.
The Sage CRM Client Side API has methods which make the retrieval and parsing of data very easy.
The code used for the example above is shown below. This can be added to the OpportunityDetailBox screen definition.
code language="javascript"]
<script>
//Custom Content - SData (Ajax) Request Example
crm.ready(function()
{
//
var compField = crm.fields("oppo_primarycompanyid");
var companyID = compField.value();
var successCompany = function(crmRecord)
{
//crm.infoMessage(crmRecord.comp_name);
compField.title("Status: "+crmRecord.comp_status +"\n Type: "+crmRecord.comp_type);
}
crm.sdata({
entity: "company",
id: companyID,
success: successCompany
});
})
</script>
[/code]
The crm.sdata() method is described in the documentation.
http://help.sagecrm.com/js-api/classes/sdata.html#method_sdata
The documentation explains the parameters that you can use which are passed to the crm.sdata() method as a JSON object. The properties of the parameter object allow you to either specify that a single record or a set of records should be returned.
The code above will grab the current value of the oppo_primarycompanyid field. It uses that value in the parameter object of the sdata() method. The function successCompany is executed if the sdata request returns without error. The crmRecord object is passed automatically to the success function.