Differences

This shows you the differences between two versions of the page.

Link to this comparison view

customization:lime-links [2016-03-08 12:33]
Martin Berg Page moved from customization:lime-links to relnotes:releases:customization:lime-links
customization:lime-links [2018-12-02 22:09]
Line 1: Line 1:
-====== LIME links ====== 
-LIME links are direct shortcuts to a record or a feature in LIME Pro. Examples of where LIME links are used in LIME Pro is in the "Please call" feature, Super Search results window and in action pads. 
  
-You can also build your own LIME links. The following links could for example be embedded in web page:  
- 
-<code><a href="limecrm:company.lundalogik.cosmo?command=open&name=Greenland%20Fir%20Trees%20AB">Greenland Fir Trees AB </a></code> 
- 
-<code><a href="limecrm:plant.lundalogik.cosmo?command=new">Create new spruce plantation</a></code> 
- 
-===== Format ===== 
-A LIME link follows this formatting scheme: 
- 
-<code>limecrm:CLASS.DATABASE.LIMESERVER?command=COMMAND[&PARAMETER=VALUE]</code> 
- 
-^ Parameter ^ Description ^ 
-| CLASS | Database name or label of a LIME table.| 
-| DATABASE | The name of the LIME Pro database. | 
-| LIMESERVER | The name of the LIME Pro server. | 
-| COMMAND | The command to execute. | 
-| PARAMETER | Parameter name. Every command accepts different parameters, more info below. | 
-| VALUE | The value to use for the specified parameter. | 
- 
-An example of a LIME link that opens a specific record and where CLASS refers to the database name of a table: 
-<code>limecrm:company.lundalogik.cosmo?command=open&idcompany=1001</code> 
- 
-If a table label were to be used instead the link should look like this: 
-<code>limecrm:1.lundalogik.cosmo?command=open&idcompany=1001</code> 
- 
-Executing the link will open the company record having ID 1001 in the database //Lundalogik// on the server named //cosmo//. 
- 
-===== Built-in commands ===== 
-==== Open ==== 
-The //open// command opens the specified record in LIME Pro. The record ID must be specified as a parameter having the name //id<<classname>>//, e.g. //idcompany//. 
- 
-Available parameters: 
- 
-^ Parameter ^ Description ^ 
-| idrecord/id[CLASS] | ID of the record to open. If record ID is the only parameter it does not have to be named and the LIME link can be formatted like this: ''limecrm:company?1001''. | 
-| activeexplorer | Specifies which tab that is to be set as the active tab when the record is opened. Note that it is the name of the relation field that should be specified here. | 
-| field/value pair | Use only if the record ID is not available. LIME Pro will try to search for the record to open using the information as conditions in a filter. Only the first matching record will be shown. | 
- 
-=== Examples === 
-Open the company having record ID 1001 in the //Lundalogik// database on server //cosmo//: 
-<code>limecrm:company.lundalogik.cosmo?command=open&idcompany=1001</code> 
- 
-The short version: 
-<code>limecrm:company.lundalogik.cosmo?1001</code> 
- 
-Open the company having the name //Lundalogik AB// in the city of //Lund//: 
-<code>limecrm:company.lundalogik.cosmo?command=open&name=Lundalogik%20AB&city=Lund</code> 
- 
-Note that all values need to be URI encoded. The VBA function ''Application.UriEncode'' can be used for this purpose. 
- 
-==== New ==== 
-The //new// command creates a new record and can also open it afterwards. To create a new history record associated with a company: 
- 
-<code>limecrm:history.lundalogik.cosmo?command=new&ownerclass=company&ownerid=1001</code> 
- 
-Available parameters (all optional): 
- 
-^ Parameter ^ Description ^ 
-| ownerclass | The name of the class of the parent record. | 
-| ownerid | The ID of the parent record. | 
-| ownersource | The parent record ID can be automatically set by LIME Pro. Valid values are ''activeinspector'' to specify the currently open record or ''activeexplorer'' to specify the currently selected record in a list. | 
-| ownerfield | The name of the field that links to the parent record. If not specified LIME Pro will attempt to autodetect this. | 
-| autosave | When set to ''1'' the record will be saved without showing it afterwards (if this fails it will be shown to the user anyway). When set to ''0'' the user will have to close and save the record manually. | 
-| field/value pair | Specify values for fields in the record. | 
- 
-=== Examples === 
-Create a new history record: 
- 
-<code>limecrm:history.lundalogik.cosmo?command=new</code> 
- 
-Create a new history record with the company having ID 1001 as parent: 
-<code>limecrm:history.lundalogik.cosmo?command=new&ownerclass=company&ownerid=1001</code> 
- 
-Create a new history record with the select company as the parent and the text //Talked to Lisa Johnson// as the text and the alternative //Sales call// as category: 
-<code>limecrm:history.lundalogik.cosmo?command=new&ownerclass=company&ownersource=activeexplorer&category=Sales%20call&text=Talked%20to%20mLisa%20Johnson</code> 
- 
-==== MailTo ==== 
-The //mailto// command creates a new e-mail message in the same manner as when an e-mail address is clicked by the user in LIME Pro. The following link creates an e-mail for //Nisse// at //Manpower//: 
- 
-<code>limecrm:person.lundalogik.cosmo?command=mailto&address=nisse@manpower.se</code> 
- 
-Available parameters (all optional): 
- 
-^ Parameter ^ Description ^ 
-| idrecord/id[CLASS] | Specifies the ID of the record that the recipient e-mail address should be fetched from. | 
-| field | Specifies the name of the field to fetch the recipient e-mail address from. When using this parameter ''idrecord'' must also be specified. If omitted, a suitable field will be autodetected by looking for fields with the primary e-mail field label followed by the secondary e-mail field label. If those field labels have not been set the first field found having the e-mail field type will be used. If no e-mail address field can be found an e-mail message with an empty recipient address will be created if the ''address'' parameter is not used. | 
-| address | Recipient e-mail address. | 
-| subject | E-mail message subject. | 
-| body | E-mail message body. |  
-| flags | A combination of values from the ''MailerFlagsEnum'' enumeration. The default is ''1'' (''lkMailerFlagPreview''). | 
- 
-==== CallTo ==== 
-By using the //callto// command LIME Pro is instructed to dial the specified phone number. This can typically be used to easily dial a number from an action pad. 
- 
-The following is a LIME link that dials Lundalogik Customer Support when executed: 
- 
-<code>limecrm:person.lundalogik.cosmo?command=callto&number=+46462704800</code> 
- 
-Available parameters: 
- 
-^ Parameter ^ Description ^ 
-| number | The number to dial. | 
- 
-==== Appointment ==== 
-The ''appointment'' command creates a new meeting and a to-do item in the same manner as when using the //New meeting...// command is used in LIME Pro.  
- 
-The following example creates an appointment with the person having record ID 1001 and sets the subject to //LIME Pro kick-off//: 
- 
-<code>limecrm:todo.lundalogik.cosmo?&command=appointment&ownerclass=person&ownerid=1001&subject=Lime%20kick-off</code> 
- 
-Note that the ''CLASS'' parameter is //todo// here since a to-do item will be created. 
- 
-Available parameters (all optional): 
- 
-^ Parameter ^ Beskrivning ^ 
-| ownerclass | The name of the class that the appointment concerns. Typically used with classes having the company or person labels set but can also be used with other classes. In those cases the system will attempt to autodetect a suitable name, person or company associated with the specified record. | 
-| ownerid | ID of the record that the appointment should be associated with. Supports persons and companies, otherwise the behavior specified above will be used. | 
-| subject | Appointment subject. | 
- 
-=== Examples === 
-Create a new, empty appointment: 
-<code>limecrm:todo.lundalogik.cosmo?&command=appointment</code> 
- 
-Create a new appointment with the person having record ID 1001: 
-<code>limecrm:todo.lundalogik.cosmo?&command=appointment&ownerclass=person&ownerid=1001</code> 
- 
-Create a new appointment with the company having record ID 2001: 
-<code>limecrm:todo.lundalogik.cosmo?&command=appointment&ownerclass=company&ownerid=2001</code> 
- 
-Create a new appointment with the company having record ID 2001 and set the subject to //LIME Pro kick-off//: 
-<code>limecrm:todo.lundalogik.cosmo?&command=appointment&ownerclass=company&ownerid=2001&subject=LIME%20Pro%20kickoff</code> 
- 
-Create a new appointment for an activity having record ID 3001. Note that the behavior here is completely dependent on the database structure since the //activity// table may or may not have a name field or a person or company associated with it. 
-<code>limecrm:todo.lundalogik.cosmo?&command=appointment&ownerclass=activity&ownerid=3001</code> 
- 
-==== Log ==== 
-The //log// command adds a new log record to the //Information log// tab (Administrators only). The following example creates a new log record: 
- 
-<code>limecrm:infolog.lundalogik.cosmo?command=log&type=0&source=My%20app&location=My%20method&number=1234&message=dooh</code> 
- 
-Available parameters: 
- 
-^ Parameter ^ Description ^ 
-| type | Specifies the log severity. Specify one of the following (numeric) values: 
-''0'' - Information 
-''1'' - Warning 
-''2'' - Error 
-''3'' - Audit success (default) 
-''4'' - Audit failure | 
-| source | Name the application or module reporting the error. | 
-| location | Description of where the logging was performed. | 
-| number | Error code. | 
-| message | Log message. | 
- 
-===== Custom commands ===== 
-In addition to the built-in commands it is possible to define custom commands that are processed in VBA by listening to and handling the ''Application.ExecuteURL'' event which receives the following parameters: 
- 
-^ Parameter ^ Data type ^ Description ^ 
-| Class | LDE.Class | The class that the LIME link concerns. | 
-| Command | String | The name of the command. | 
-| Parameter | String | The parameter string. | 
-| Handled | Boolean | Should be set to ''True'' in the event handler if the command could be processed. If this is not done LIME Pro will display an error message saying that the command could not be executed. | 
- 
-Given the following LIME link: 
- 
-<code>limecrm:company.MyDatabase.MyServer?command=mycommand&param1=1501&param2=1601</code> 
- 
-...the event parameters will receive the following values: 
- 
-^ Parameter ^ Value ^ 
-| Class | The ''company'' class. | 
-| Command | mycommand | 
-| Parameter | command=mycommand&param1=1501&param2=1601 | 
- 
-=== Example === 
-The following code sample shows how a custom command that opens a web browser with the URL set to the contents of any present field having the "Homepage, work" label. 
- 
-<code vb> 
-Private Sub Application_ExecuteURL(ByVal Class As LDE.IClass, ByVal Command As String, ByVal Parameters As String,                                                     Handled As Boolean) 
-  
-   ' Handle Lime shortcuts on the following format: 
-   '    limecrm:company.MyDatabase.MyServer?command=openwebsite&id=15099001 
-  
-   Dim fieldUrl As LDE.Field 
-   Dim rec As LDE.Record 
-   Dim viewUrl As LDE.View 
-   Dim i As Integer 
-   Dim parameter As String 
-   Dim parameterArray() As String 
-   Dim recordId As Long 
-  
-   If Command = "openwebsite" Then 
-     ' Find the business homepage field by looking at field labels 
-       Set fieldUrl = Class.Fields.Lookup(FieldLabelEnum.lkFieldLabelBusinessHomePage, 
-                                               LookupFieldEnum.lkLookupFieldByLabel) 
-      
-       If Not fieldUrl Is Nothing Then 
-           ' Find the id=xxxx parameter and extract the record ID 
-          
-           parameterArray = Split(LCase(Parameters), "&") 
-      
-           For i = LBound(parameterArray) To UBound(parameterArray) 
-               If Left(parameterArray(i), 3) = "id=" Then 
-                   recordId = CLng(Mid(parameterArray(i), 4)) 
-                   Exit For 
-               End If 
-           Next 
-          
-           If recordId <> 0 Then 
-               ' Open the record and retrieve the web site address 
-          
-               Set rec = New LDE.Record 
-               Set viewUrl = New LDE.View 
-          
-               viewUrl.Add fieldUrl.Name 
-          
-               rec.Open Class, recordId, viewUrl 
-              
-               If Len(rec(fieldUrl.Name)) > 0 Then 
-                   ' Launch the web browser 
-                   Shell rec(fieldUrl.Name) 
-                  
-                   ' Tell Lime that we were able to successfully handle the event 
-                   Handled = True 
-               Else 
-                   MsgBox "The specified record is not associated with a web site.", vbInformation 
-               End If 
-           End If 
-       End If 
-   End If 
-  
-End Sub 
-</code> 
- 
-===== Javascript support ===== 
-To simplify the creation and execution of LIME links Lundalogik provides a Javascript helper class that can be found in the ''scripts'' folder located in the actionpad folder. 
- 
-==== Execute ==== 
-This function can be used with all commands and has the advantage that only one call to LimeUrl needs to be done to both create and execute the link command. 
- 
-''LimeUrl.Execute = function(classname, command, options)'' 
- 
-^ Parameter ^ Description ^ 
-| classname | The class that the command should operate on. | 
-| command | The command to execute. | 
-| options | An object with parameters to the command. All parameters need to be named and have a value. This object can also have a member called ''fields'' that specifies field/value pairs for the command. | 
- 
-=== Examples === 
-Open the company record having ID 1001 and set the tab pointed to by the //employees// relation field to active: 
-<code javascript> 
-LimeUrl.Execute('company', 'open', { 
-             idrecord: '1001', 
-             activeexplorer: 'employees' 
-           }); 
-</code>            
- 
-Create a new history record and associate it with the currently selected company record:     
-<code javascript> 
-LimeUrl.Execute('history', 'new', { 
-             ownerclass: 'company', 
-             ownersource: 'activeexplorer' 
-           }); 
-</code>            
- 
-The same as above, but for embedded use in e.g. an actionpad:            
-<code html> 
-<a href="#" onclick="javascript:LimeUrl.Execute('history', 'new', { 
-             ownerclass: 'company', 
-             ownersource: 'activeexplorer' 
-           });">Skapa historik</a> 
-</code> 
-==== Create ==== 
-Creates a LIME link with the specified command as its only parameter. 
- 
-''LimeUrl.Create = function(classname, command)'' 
- 
-^ Parameter ^ Description ^ 
-| classname | Name of the class the link concerns. | 
-| command | The command that the link should execute. | 
- 
-=== Example === 
-To create a link that creates a new history record: 
-<code javascript> 
-LimeUrl.Create('history', 'new'); 
-</code> 
-This results in the following link: 
-<code> 
-limecrm:history.MyDatabase.MyServer?command=new 
-</code> 
- 
-==== AddParameter ==== 
-Adds a parameter to a link that was created using a call to ''LimeUrl.Create''. 
- 
-''LimeUrl.AddParameter = function(name, value)'' 
- 
-^ Parameter ^ Description ^ 
-| name | Name of the parameter. | 
-| value | Value of the parameter. | 
- 
-=== Example === 
-To add parent record and contact person to the link that was created in the previous example: 
- 
-<code javascript> 
-LimeUrl.AddParameter('ownerclass', 'company'); 
-LimeUrl.AddParameter('ownerid', '1001'); 
-LimeUrl.AddParameter('contactperson', 'Johnny Doe'); 
-</code> 
-This results in the following link: 
-<code> 
-limecrm:history.MyDatabase.MyServer?command=new&ownerclass=company&ownerid=1001&contactperson=Johnny%20Doe</code>  
- 
-==== Click ==== 
-Executes the LIME link created using ''LimeUrl.Create'' and optionally ''LimeUrl.AddParameter''. This method does not accept any arguments. 
- 
-=== Example === 
-<code javascript> 
-LimeUrl.Click(); 
-</code> 
  • Last modified: 5 years ago
  • (external edit)