This is a simplified and specialised set of code libraries that will allow easy screen customizations.
The API is based on the JQuery syntax although I must stress that knowledge of JQuery is not needed in order to use the API.
The API is included as part of the full product development cycle and therefore is part of the formal QA process. The new API is an important new option for partners developing extensions and customization that will work in the new and future releases of Sage CRM. The API provides safe and supported options for customizing the new frameless interface.
In Chrome, logon to CRM and Navigate to the page in Sage CRM with which you want to experiment.
You can see from the above example the syntax is very simple
This will return all of the fields in screen and apply a default highlighting to them.
Some more that you may want to experiment with are below
This allows a single field to be selected by calling the fields method with it’s full name as a parameter.
This allows multiple fields to be selected by sending a list separated by spaces
In this example all fields except the comp_name and comp_type field have been selected
This is a simple shortcut that allows you to select fields by calling the crm function with the selector string
You can see from the examples below how the code in browser can be changed. The business rule being implemented is
"If the company status is switched to 'Closed' then highlight the field in red".
Sage CRM v7.1
window.addEventListener("load", setStatusColor, false)
if (_Datacomp_status.innerHTML == "Closed ")
In Sage CRM v7.1 if you were not using JQuery techniques then your code would need to take into account the differences between browsers. In Sage CRM 7.2 and the new API you no longer even have to think about that and the whole job of finding the element that you wish to affect is made so much easier.
Sage CRM 7.2
if (crm("comp_status").value()== "Closed")
If you would like to experiment with the API further below are some more of the methods.
- value() – get value (code)
- text() – get text of field (translation)
- val(123) – set value
- cid() – get currency id
- caption() – get field caption
- caption('hello') –set field caption
- hide() – hides fields
- collapse() – collapses fields
- show() – shows fields
- highlight() – highlight field (defaults to yellow)
- highlight(false) – remove highlight
- bold() – embolden the text
- bold(false) – remove bold
- strike() - strikethrough
- color('blue') – set font color
- fontSize(n) – where n is an integer number of pixels
- fontSize() – remove formatting
- title('text') – make a tooltip for a field
- title() – remove the title