VB.NET API: Difference between revisions
No edit summary |
|||
(27 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
= Disclaimer = | = Disclaimer = | ||
This documentation refers to | This documentation refers to RangerMSP 5.6 or later version and assumes RangerMSP is installed and accessible on the local computer. | ||
<br> | <br> | ||
= Introduction = | = Introduction = | ||
This document demonstrates how to use the | This document demonstrates how to use the RangerMSP VB.NET API library in order to programmatically connect to your RangerMSP server and query or manipulate the RangerMSP database. | ||
<br> | <br> | ||
Line 14: | Line 14: | ||
= System Requirements = | = System Requirements = | ||
* | * RangerMSP 5.6 or later. | ||
* Visual Basic .NET 2008 or Visual Basic .NET 2010. | * Visual Basic .NET 2008 or Visual Basic .NET 2010. | ||
* | * CRMLib.dll (the RangerMSP VB.NET compiled library). | ||
= Getting Started = | = Getting Started = | ||
Line 24: | Line 24: | ||
==Start Basic Program== | ==Start Basic Program== | ||
After you create your VB.NET project, you'll need to add a reference to the ''' | After you create your VB.NET project, you'll need to add a reference to the '''CRMLib.dll''' file, in order to have access to the RangerMSP library classes. | ||
Each application using the library will have to initialize on startup the ''' | Each application using the library will have to initialize on startup the '''CRM.Application''' object and terminate it on exit. | ||
Initialization method requires that you pass an object instance of ''' | Initialization method requires that you pass an object instance of '''CRM.Config''' class. | ||
Connecting to the RangerMSP database can be done in two ways: | |||
# Using a Local Server - run your program on the same server where the RangerMSP Server runs. | |||
# Using Web API - run your program anywhere and connect to a remote RangerMSP server over Web services interface. | |||
Connection parameters vary between these options. See the variations below: | |||
===Local Server=== | |||
For connections to a local RangerMSP server configure the following settings: | |||
* '''AppName''' | * '''AppName''' | ||
: This is free text, preferably the name of your application. | : This is free text, preferably the name of your application. | ||
* ''' | * '''DllFolder''' | ||
: Behind the scenes the library uses the two | : Behind the scenes the library uses the two RangerMSP API dlls: '''CmtDbEng.dll''' and '''CmtDbQry.dll'''. | ||
: In the default | : In the default RangerMSP installation you'll find these files in <span style="color: #963A46;">'C:\RangerMSP\ThirdParty\UserDev'</span>. | ||
: '''Important Note''': Always point to this folder and do '''not''' copy the dll files elsewhere. This is because when the | : '''Important Note''': Always point to this folder and do '''not''' copy the dll files elsewhere. This is because when the RangerMSP version upgrade runs it also upgrades the dll files stored in this folder. This verifies that you will always be using the latest release. | ||
* ''' | * '''DbFolder''' | ||
: Path to the | : Path to the RangerMSP database, default is <span style="color: #963A46;">'C:\RangerMSP\db'</span>. | ||
Assuming these default values, we can configure the ''' | Assuming these default values, we can configure the '''CRM.Config''' object like this: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #3A3AFF;">Dim</span> config <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> config <span style="color: #3A3AFF;">As New</span> CRM.Config | ||
config.AppName = <span style="color: #963A46;">"VB.NET Demo"</span> | config.AppName = <span style="color: #963A46;">"VB.NET Demo"</span> | ||
config. | config.DllFolder = <span style="color: #963A46;">"C:\RangerMSP\ThirdParty\UserDev"</span> | ||
config. | config.DbFolder = <span style="color: #963A46;">"C:\RangerMSP\db"</span> | ||
</font> | </font> | ||
You should of course | You should of course ensure these paths are correct on your disk and modify the values accordingly. | ||
===Remote Server (Web API)=== | |||
To connect to a remote RangerMSP server with the Web API, configure the following settings: | |||
* '''AppName''' | |||
: This is free text, preferably the name of your application. | |||
* '''WebAPIUrl''' | |||
: Url to the RangerMSP server running the Web API, either local or remote. <br>Url '''must include''' the http:// or https:// prefix, otherwise the API will not be able to connect.<br>Valid examples include http://localhost:4964/ and https://webapi.mycrmserver.com/. | |||
* '''Password''' | |||
: Your authorization password/token | |||
* '''UseWebAPI''' | |||
: Boolean value, must be set to True to use the Web API | |||
Assuming these default values, we can configure the '''CRM.Config''' object like this: | |||
<font face="courier new" size="3"> | |||
Now we can initialize the ''' | <span style="color: #3A3AFF;">Dim</span> config <span style="color: #3A3AFF;">As New</span> CRM.Config | ||
config.AppName = <span style="color: #963A46;">"VB.NET Demo"</span> | |||
config.WebAPIUrl = <span style="color: #963A46;">"http://localhost:4964/"</span> | |||
config.Password = <span style="color: #963A46;">"yourpassword"</span> | |||
config.UseWebAPI = <span style="color: #3A3AFF;">True</span> | |||
</font> | |||
===Initialization=== | |||
The configuration settings explained above are the only differences between connecting to a local RangerMSP server or remote RangerMSP server running the Web API. | |||
Now we can initialize the '''CRM.Application''' object with these settings: | |||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #66AD3A;">' | <span style="color: #66AD3A;">'CRM.Application.Initialize must be the first call before invoking any other RangerMSP library method | ||
'and it should be done <span style="color: #963A46;">only once</span> in the program's lifetime.</span> | 'and it should be done <span style="color: #963A46;">only once</span> in the program's lifetime.</span> | ||
CRM.Application.Initialize(config) | |||
</font> | </font> | ||
If anything goes wrong, the above line will throw an exception of the ''' | If anything goes wrong, the above line will throw an exception of the '''CRM.Exception''' class. | ||
To prevent unexpected termination of the program execution, we recommend having any call to the | To prevent unexpected termination of the program execution, we recommend having any call to the RangerMSP library enclosed in a '''Try/Catch''' block. | ||
Before exit, we terminate the ''' | Before exit, we terminate the '''CRM.Application''' object: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #66AD3A;">'Before exit we should call | <span style="color: #66AD3A;">'Before exit we should call CRM.Application.Terminate to gracefully release all application resources | ||
'and this should be done <span style="color: #963A46;">only once</span> in the program's lifetime.</span> | 'and this should be done <span style="color: #963A46;">only once</span> in the program's lifetime.</span> | ||
CRM.Application.Terminate() | |||
</font> | </font> | ||
The most basic VB.NET application that just connects to | The most basic VB.NET application that just connects to RangerMSP and terminates could look something like this: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #3A3AFF;">Try</span> | <span style="color: #3A3AFF;">Try</span> | ||
<span style="color: #3A3AFF;">Dim</span> config <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> config <span style="color: #3A3AFF;">As New</span> CRM.Config | ||
config.AppName = <span style="color: #963A46;">"VB.NET Demo"</span> | config.AppName = <span style="color: #963A46;">"VB.NET Demo"</span> | ||
config. | config.DllFolder = <span style="color: #963A46;">"C:\RangerMSP\ThirdParty\UserDev"</span> | ||
config. | config.DbFolder = <span style="color: #963A46;">"C:\RangerMSP\db"</span> | ||
CRM.Application.Initialize(config) | |||
<span style="color: #66AD3A;">'At this point we have successfully initialized the | <span style="color: #66AD3A;">'At this point we have successfully initialized the CRM.Application | ||
'and can start using the other library classes</span> | 'and can start using the other library classes</span> | ||
<span style="color: #3A3AFF;">Catch</span> ex <span style="color: #3A3AFF;">As</span> Exception | <span style="color: #3A3AFF;">Catch</span> ex <span style="color: #3A3AFF;">As</span> Exception | ||
Console.Out.Write(ex.Message) | Console.Out.Write(ex.Message) | ||
<span style="color: #3A3AFF;">Finally</span> | <span style="color: #3A3AFF;">Finally</span> | ||
CRM.Application.Terminate() | |||
<span style="color: #3A3AFF;">End Try</span> | <span style="color: #3A3AFF;">End Try</span> | ||
</font> | </font> | ||
Now that we have confirmed the connectivity to the RangerMSP server (if the above code successfully runs), | |||
Now that we have confirmed the connectivity to the | |||
we can continue adding more functionality to the example. | we can continue adding more functionality to the example. | ||
The library exposes as VB.NET classes the same | The library exposes as VB.NET classes the same RangerMSP objects (Account, Ticket etc.) available through the native RangerMSP API and you can refer to the | ||
[[API_Reference_Manual#Database_Field_Listing|API Reference Manual]] for database fields reference. | [[API_Reference_Manual#Database_Field_Listing|API Reference Manual]] for database fields reference. | ||
Line 99: | Line 135: | ||
With any of these objects you can: | With any of these objects you can: | ||
* Search and query for objects with ''' | * Search and query for objects with '''CRM.ObjectQuery''' that satisfy certain criteria. | ||
* Read and display the properties of the retrieved objects. | * Read and display the properties of the retrieved objects. | ||
* Update and save the properties of the retrieved objects. | * Update and save the properties of the retrieved objects. | ||
Line 105: | Line 141: | ||
Now let's see how we can search for ''' | Now let's see how we can search for '''CRM.Account''' objects. | ||
We instantiate an object of the ''' | We instantiate an object of the '''CRM.ObjectQuery''' class and pass '''CRM.Account''' class as generics parameter. | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #3A3AFF;">Dim</span> accountSearch <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> accountSearch <span style="color: #3A3AFF;">As New</span> CRM.ObjectQuery(<span style="color: #3A3AFF;">Of</span> CRM.Account) | ||
</font> | </font> | ||
''' | '''CRM.ObjectQuery''' class can accept any of the RangerMSP objects in this parameter, but we want to search for accounts now. | ||
Next, we need to set criteria (or more than one) we want to search for: | Next, we need to set criteria (or more than one) we want to search for: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
accountSearch.AddCriteria( | accountSearch.AddCriteria(CRM.Ticket.Fields.City, CRM.OperatorEnum.opEqual, <span style="color: #963A46;">"New York"</span>) | ||
</font> | </font> | ||
The first parameter to the '''AddCriteria''' method is either a Shared object instance of ''' | The first parameter to the '''AddCriteria''' method is either a Shared object instance of '''CRM.CrmField''' class representing the field we want to look in or the internal API field name. Refer to the '''API Field Name''' column in the [[VB.NET_API#Account_Class|Account Class]] | ||
table for a complete list of the available fields for the ''' | table for a complete list of the available fields for the '''CRM.Account''' class. | ||
The second parameter is a compare operator. We here use the ''' | The second parameter is a compare operator. We here use the '''CRM.OperatorEnum.opEqual''' to get only exact matches. | ||
In order to get a broader match in the results you can use ''' | In order to get a broader match in the results you can use '''CRM.OperatorEnum.opLike''' operator. | ||
The third parameter is the value we want to find. Prepending and/or appending % (percent) sign at the beginning and/or at the end while using ''' | The third parameter is the value we want to find. Prepending and/or appending % (percent) sign at the beginning and/or at the end while using '''CRM.OperatorEnum.opLike''' operator, | ||
will match the phrase even if in the middle of a sentence. | will match the phrase even if in the middle of a sentence. | ||
Now we can execute the search and retrieve the ''' | Now we can execute the search and retrieve the '''CRM.Account''' objects (if any): | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #3A3AFF;">Dim</span> accounts <span style="color: #3A3AFF;">As</span> List(<span style="color: #3A3AFF;">Of</span> | <span style="color: #3A3AFF;">Dim</span> accounts <span style="color: #3A3AFF;">As</span> List(<span style="color: #3A3AFF;">Of</span> CRM.Account) = accountSearch.FetchObjects() | ||
</font> | </font> | ||
The above line will populate the List ('''System.Collections.Generic.List''') with all ''' | The above line will populate the List ('''System.Collections.Generic.List''') with all '''CRM.Account''' objects that were found. | ||
Now we can use '''For Each - Next''' statement to iterate through the accounts: | Now we can use '''For Each - Next''' statement to iterate through the accounts: | ||
Line 154: | Line 191: | ||
</font> | </font> | ||
We invoke the ''' | We invoke the '''CRM.Account's''' Save method on both new or existing accounts. For a new account, invoking the Save method would insert a new account in the RangerMSP database. | ||
For an existing account, invoking the Save method would update the fields we modified in the existing account. This rule applies to all | For an existing account, invoking the Save method would update the fields we modified in the existing account. This rule applies to all RangerMSP objects. | ||
Another option is to add a new ticket for each of the accounts: | Another option is to add a new ticket for each of the accounts: | ||
Line 161: | Line 198: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #3A3AFF;">For Each</span> account <span style="color: #3A3AFF;">In</span> accounts | <span style="color: #3A3AFF;">For Each</span> account <span style="color: #3A3AFF;">In</span> accounts | ||
<span style="color: #3A3AFF;">Dim</span> ticket <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> ticket <span style="color: #3A3AFF;">As New</span> CRM.Ticket | ||
ticket.AccountREC_ID = account.AccountREC_ID | ticket.AccountREC_ID = account.AccountREC_ID | ||
ticket.Description = <span style="color: #963A46;">"Sample ticket for a NewYork account"</span> | ticket.Description = <span style="color: #963A46;">"Sample ticket for a NewYork account"</span> | ||
Line 170: | Line 207: | ||
= GetFieldValue and SetFieldValue methods = | = GetFieldValue and SetFieldValue methods = | ||
Each of the | Each of the RangerMSP library objects have a set of properties that are exposed as VB.NET properties that you can directly manipulate or read from. | ||
You already saw few examples of these properties in the above examples, as: '''account.Zip''' or '''ticket.Description'''. This is the preferred and more intuitive way of accessing the | You already saw few examples of these properties in the above examples, as: '''account.Zip''' or '''ticket.Description'''. This is the preferred and more intuitive way of accessing the RangerMSP fields. | ||
<br>However, there is also another way of achieving the same results, by invoking '''GetFieldValue''' and '''SetFieldValue''' and specifying the internal field name. These methods should only be used if necessary, for example, when updating user-defined custom fields which are not part of the class predefined basic fields. | <br>However, there is also another way of achieving the same results, by invoking '''GetFieldValue''' and '''SetFieldValue''' and specifying the internal field name. These methods should only be used if necessary, for example, when updating user-defined custom fields which are not part of the class predefined basic fields. | ||
Line 179: | Line 216: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #3A3AFF;">For Each</span> account <span style="color: #3A3AFF;">In</span> accounts | <span style="color: #3A3AFF;">For Each</span> account <span style="color: #3A3AFF;">In</span> accounts | ||
<span style="color: #3A3AFF;">Dim</span> ticket <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> ticket <span style="color: #3A3AFF;">As New</span> CRM.Ticket | ||
ticket.SetFieldValue(<span style="color: #963A46;">"FLDTKTCARDID"</span>, account.GetFieldValue(<span style="color: #963A46;">"FLDCRDRECID"</span>)) | ticket.SetFieldValue(<span style="color: #963A46;">"FLDTKTCARDID"</span>, account.GetFieldValue(<span style="color: #963A46;">"FLDCRDRECID"</span>)) | ||
ticket.SetFieldValue(<span style="color: #963A46;">"FLDTKTPROBLEM"</span>, <span style="color: #963A46;">"Sample ticket for a NewYork account"</span>) | ticket.SetFieldValue(<span style="color: #963A46;">"FLDTKTPROBLEM"</span>, <span style="color: #963A46;">"Sample ticket for a NewYork account"</span>) | ||
Line 186: | Line 223: | ||
</font> | </font> | ||
All internal field names are listed in [[ | All internal field names are listed in [[VB.NET_API#Classes_and_Objects|Classes and Objects]] below. | ||
= Exception Handling = | = Exception Handling = | ||
While working with the | While working with the RangerMSP VB.NET library, some operations can fail. In this case the library will throw an exception of the '''CRM.Exception''' class. | ||
We recommend enclosing all calls to the | We recommend enclosing all calls to the RangerMSP library in a '''Try/Catch''' block. | ||
To find out more about the exact error that ocured when an exception is thrown, you can inspect the ''' | To find out more about the exact error that ocured when an exception is thrown, you can inspect the '''CRM.Exception.Status''' property that holds the last RangerMSP '''Status''' value, | ||
or inspect the list of ''' | or inspect the list of '''CRM.Exception.Codes''' (if any). Please refer to [[API_Reference_Manual#Error_Codes_Description|Error Codes Description]] for the description of these values. | ||
= Complete Program Sample = | = Complete Program Sample = | ||
Line 204: | Line 241: | ||
<span style="color: #3A3AFF;">Try</span> | <span style="color: #3A3AFF;">Try</span> | ||
<span style="color: #66AD3A;">'Setup the | <span style="color: #66AD3A;">'Setup the CRM.Config object</span> | ||
<span style="color: #3A3AFF;">Dim</span> config <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> config <span style="color: #3A3AFF;">As New</span> CRM.Config | ||
config.AppName = <span style="color: #963A46;">"VB.NET Demo"</span> | config.AppName = <span style="color: #963A46;">"VB.NET Demo"</span> | ||
config. | config.DllFolder = <span style="color: #963A46;">"C:\RangerMSP\ThirdParty\UserDev"</span> | ||
config. | config.DbFolder = <span style="color: #963A46;">"C:\RangerMSP\db"</span> | ||
<span style="color: #66AD3A;">'Initialize the | <span style="color: #66AD3A;">'Initialize the CRM.Application</span> | ||
CRM.Application.Initialize(config) | |||
<span style="color: #66AD3A;">'At this point we have successfully initialized the | <span style="color: #66AD3A;">'At this point we have successfully initialized the CRM.Application | ||
'and can start using the other library classes</span> | 'and can start using the other library classes</span> | ||
<span style="color: #66AD3A;">'search for "New York" in the FLDCRDCITY field</span> | <span style="color: #66AD3A;">'search for "New York" in the FLDCRDCITY field</span> | ||
<span style="color: #3A3AFF;">Dim</span> accountSearch <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> accountSearch <span style="color: #3A3AFF;">As New</span> CRM.ObjectQuery(<span style="color: #3A3AFF;">Of</span> CRM.Account) | ||
accountSearch.AddCriteria(<span style="color: #963A46;">"FLDCRDCITY"</span>, | accountSearch.AddCriteria(<span style="color: #963A46;">"FLDCRDCITY"</span>, CRM.OperatorEnum.opEqual, <span style="color: #963A46;">"New York"</span>) | ||
<span style="color: #3A3AFF;">Dim</span> accounts <span style="color: #3A3AFF;">As</span> List(<span style="color: #3A3AFF;">Of</span> | <span style="color: #3A3AFF;">Dim</span> accounts <span style="color: #3A3AFF;">As</span> List(<span style="color: #3A3AFF;">Of</span> CRM.Account) = accountSearch.FetchObjects() | ||
<span style="color: #66AD3A;">'loop through the retrieved accounts and output the CompanyName</span> | <span style="color: #66AD3A;">'loop through the retrieved accounts and output the CompanyName</span> | ||
Line 226: | Line 263: | ||
<span style="color: #3A3AFF;">Next</span> | <span style="color: #3A3AFF;">Next</span> | ||
<span style="color: #3A3AFF;">Catch</span> ex <span style="color: #3A3AFF;">As</span> | <span style="color: #3A3AFF;">Catch</span> ex <span style="color: #3A3AFF;">As</span> CRM.Exception <span style="color: #66AD3A;">'here we catch RangerMSP specific error | ||
'we can inspect the | 'we can inspect the RangerMSP status (exc.Status) | ||
'exc.Codes contains all error codes last call generated | 'exc.Codes contains all error codes last call generated | ||
Line 236: | Line 273: | ||
Console.Out.Write(ex.Message) | Console.Out.Write(ex.Message) | ||
<span style="color: #3A3AFF;">Finally</span> | <span style="color: #3A3AFF;">Finally</span> | ||
CRM.Application.Terminate() | |||
<span style="color: #3A3AFF;">End Try</span> | <span style="color: #3A3AFF;">End Try</span> | ||
<span style="color: #3A3AFF;">End Sub</span> | <span style="color: #3A3AFF;">End Sub</span> | ||
Line 244: | Line 281: | ||
= Classes and Objects = | = Classes and Objects = | ||
The | The RangerMSP VB.NET API provides easy access to all objects using a class for each entity in the system (such as Account, Ticket, Asset, etc.). | ||
All classes include: | All classes include: | ||
# API functions and routines (which are derived from the base ''' | # API functions and routines (which are derived from the base '''CRM.Object''' class). | ||
# Class data fields, providing an easy way to update the object's data. | # Class data fields, providing an easy way to update the object's data. | ||
<br> | <br> | ||
All | All RangerMSP's objects should be updated by setting the class data fields (properties) and then calling the '''Save''' method. For example, to create a new account programmatically (assuming CRM.Application was initialized successfully), one would use the following code snippet: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #3A3AFF;">Dim</span> account <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> account <span style="color: #3A3AFF;">As New</span> CRM.Account | ||
account.FileAs = <span style="color: #963A46;">"ACME Company"</span> | account.FileAs = <span style="color: #963A46;">"ACME Company"</span> | ||
account.Dear = <span style="color: #963A46;">"Mr."</span> | account.Dear = <span style="color: #963A46;">"Mr."</span> | ||
Line 266: | Line 303: | ||
== Object Class == | == Object Class == | ||
The ''' | The '''CRM.Object''' class is the base class for all RangerMSP accessible objects (as Ticket, Account, Asset, etc.). The public routines and functions exposed by the CRM.Object class are available to the derived classes. | ||
<br><br> | <br><br> | ||
'''Object Method Reference Table''' | '''Object Method Reference Table''' | ||
Line 310: | Line 347: | ||
== Object derived classes == | == Object derived classes == | ||
Classes explained in this section are derived from ''' | Classes explained in this section are derived from '''CRM.Object''' class and map directly to a native RangerMSP object (Account, Ticket, etc.). | ||
=== Account Class === | === Account Class === | ||
The ''' | The '''CRM.Account''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Account_Fields|Account Fields]]. | ||
The following table lists all exposed ''' | The following table lists all exposed '''CRM.Account''' properties. | ||
'''Account Properties Reference Table''' | '''Account Properties Reference Table''' | ||
Line 349: | Line 386: | ||
| As String | | As String | ||
| 40 | | 40 | ||
|- | |||
| Public ReadOnly Property | |||
| '''Status''' | |||
| FLDCRDSUBCONTSTATUS | |||
| As String | |||
| 1 | |||
|- | |- | ||
| Public Property | | Public Property | ||
Line 653: | Line 696: | ||
=== Ticket Class === | === Ticket Class === | ||
The ''' | The '''CRM.Ticket''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Ticket_Fields|Ticket Fields]]. | ||
The following table lists all exposed ''' | The following table lists all exposed '''CRM.Ticket''' properties. | ||
'''Ticket Properties Reference Table''' | '''Ticket Properties Reference Table''' | ||
Line 776: | Line 819: | ||
=== Asset Class === | === Asset Class === | ||
The ''' | The '''CRM.Asset''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Asset_Fields|Asset Fields]]. | ||
The following table lists all exposed ''' | The following table lists all exposed '''CRM.Asset''' properties. | ||
'''Asset Properties Reference Table''' | '''Asset Properties Reference Table''' | ||
Line 1,055: | Line 1,098: | ||
=== Calendar Class === | === Calendar Class === | ||
The ''' | The '''CRM.Calendar''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Calendar_Fields|Calendar Fields]] of event type Appointment. | ||
The following table lists all exposed ''' | The following table lists all exposed '''CRM.Calendar''' properties. | ||
'''Calendar Properties Reference Table''' | '''Calendar Properties Reference Table''' | ||
Line 1,188: | Line 1,231: | ||
|} | |} | ||
=== | === Task Class === | ||
The ''' | The '''CRM.Task''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Calendar_Fields|Calendar Fields]] of event type Task. | ||
The following table lists all exposed ''' | The following table lists all exposed '''CRM.Task''' properties. | ||
''' | '''Task Properties Reference Table''' | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 1,203: | Line 1,246: | ||
|- | |- | ||
| Public ReadOnly Property | | Public ReadOnly Property | ||
| ''' | | '''TaskREC_ID''' | ||
| | | FLDEVTRECID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''EventType''' | ||
| | | FLDEVTWRITETOID | ||
| As Integer | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''EmployeeREC_ID''' | |||
| FLDEVTWORKERID | |||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''PrivateUser''' | ||
| | | FLDEVTPRIVATEID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''AccountREC_ID''' | ||
| | | FLDEVTCARDID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''ContactREC_ID''' | ||
| | | FLDEVTCONTACTID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''DocumentREC_ID''' | ||
| | | FLDEVTDOCID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |||
| Public Property | |||
| '''DoneIndication''' | |||
| FLDEVTDONE | |||
| As Boolean | |||
| N/A | |||
|- | |- | ||
| Public Property | | Public Property | ||
| '''[Date]''' | | '''[Date]''' | ||
| | | FLDEVTEVENTDATE | ||
| As DateTime | | As DateTime | ||
| N/A | | N/A | ||
Line 1,246: | Line 1,301: | ||
| Public Property | | Public Property | ||
| '''Description''' | | '''Description''' | ||
| | | FLDEVTFREETEXT | ||
| As String | | As String | ||
| Unlimited | | Unlimited | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''TimeStart''' | ||
| | | FLDEVTFROMTIME | ||
| As | | As String | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''RelLinkREC_ID''' | ||
| | | FLDEVTLINKRECID | ||
| As | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Field1''' | ||
| | | FLDEVTFAMILY | ||
| As | | As String | ||
| | | 50 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Field2''' | ||
| | | FLDEVTACTION | ||
| As | | As String | ||
| | | 50 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Field3''' | ||
| | | FLDEVTPLACE | ||
| As String | | As String | ||
| | | 40 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Field4''' | ||
| | | FLDEVTPLACE1 | ||
| As String | | As String | ||
| | | 30 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Field5''' | ||
| | | FLDEVTPLACE2 | ||
| As | | As String | ||
| | | 30 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''CreatedByUser''' | ||
| | | FLDEVTCREATEUSERID | ||
| As String | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''LastUpdateByUser''' | ||
| | | FLDEVTUPDATEUSER | ||
| As String | | As String | ||
| 20 | | 20 | ||
|} | |} | ||
=== | === Charge Class === | ||
The ''' | The '''CRM.Charge''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Charge_Fields|Charge Fields]]. | ||
The following table lists all exposed ''' | The following table lists all exposed '''CRM.Charge''' properties. | ||
''' | '''Charge Properties Reference Table''' | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 1,332: | Line 1,375: | ||
|- | |- | ||
| Public ReadOnly Property | | Public ReadOnly Property | ||
| ''' | | '''ChargeREC_ID''' | ||
| | | FLDSLPRECID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''AccountREC_ID''' | ||
| | | FLDSLPCARDID | ||
| As | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''EmployeeREC_ID''' | ||
| | | FLDSLPWORKERID | ||
| As String | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''ChargedItem''' | ||
| | | FLDSLPITEMID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''ContractREC_ID''' | ||
| | | FLDSLPBCRECID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''TicketREC_ID''' | ||
| | | FLDSLPTICKETID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''[Date]''' | ||
| | | FLDSLPSLIPDATE | ||
| As | | As DateTime | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Description''' | ||
| | | FLDSLPDESC | ||
| As String | | As String | ||
| | | Unlimited | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Units_Hours''' | ||
| | | FLDSLPQUANTITY | ||
| As | | As Double | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''HourlyBased''' | ||
| | | FLDSLPITEMUNITISHOUR | ||
| As | | As Boolean | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''AdjustAmount''' | ||
| | | FLDSLPADJUSTAMOUNT | ||
| As | | As Double | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''AdjustPercent''' | ||
| | | FLDSLPADJUSTPERCENT | ||
| As Double | |||
| N/A | |||
|- | |||
|Public | |||
| '''AdjustType''' | |||
| FLDSLPADJUSTTYPE | |||
| As String | | As String | ||
| | | 1 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''FromTime''' | ||
| | | FLDSLPSTARTTIME | ||
| As String | | As String | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''ToTime''' | ||
| | | FLDSLPENDTIME | ||
| As String | | As String | ||
| | | N/A | ||
|- | |- | ||
| Public Property | |||
| '''Price_Rate''' | |||
| FLDSLPPRICE | |||
| As Double | |||
| N/A | |||
|- | |- | ||
| Public | | Public Property | ||
| ''' | | '''Billable''' | ||
| | | FLDSLPBILLKIND | ||
| As String | | As String | ||
| | | 1 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Billed''' | ||
| | | FLDSLPSTAGE | ||
| As | | As String | ||
| | | 1 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Field1''' | ||
| | | FLDSLPUSER1 | ||
| As String | | As String | ||
| | | 25 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''CreateUser''' | ||
| | | FLDSLPCREATEUSER | ||
| As String | | As String | ||
| 20 | | 20 | ||
|} | |||
=== Quote Class === | |||
The '''CRM.Quote''' class derives from '''CRM.Object'''. The following table lists all exposed '''CRM.Quote''' properties. | |||
'''Quote Properties Reference Table''' | |||
{| class="wikitable" | |||
|- | |- | ||
! '''Access modifier''' | |||
! '''Property''' | |||
! '''API Field Name''' | |||
! '''Return value''' | |||
! '''Field length''' | |||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''QuoteREC_ID''' | ||
| | | FLDQTERECID | ||
| As String | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''AccountREC_ID''' | ||
| | | FLDQTEACCOUNTRECID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Status''' | ||
| | | FLDQTESTATUS | ||
| As String | |||
| 1 | |||
|- | |||
| Public Property | |||
| '''BillToAddress''' | |||
| FLDQTEBILLTOADDRESS | |||
| As String | |||
| Unlimited | |||
|- | |||
| Public Property | |||
| '''BillToContactREC_ID''' | |||
| FLDQTECONTACTRECID | |||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''QuoteDate''' | ||
| | | FLDQTEQUOTEDATE | ||
| As DateTime | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''ShipToContactREC_ID''' | |||
| FLDQTESHIPTOCONTACT | |||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''ShipToAddress''' | ||
| | | FLDQTESHIPTOADDRESS | ||
| As String | | As String | ||
| | | Unlimited | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''ContractREC_ID''' | ||
| | | FLDQTEBCRECID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''HeaderNotes''' | ||
| | | FLDQTEHEADERNOTES | ||
| As String | | As String | ||
| | | Unlimited | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''FooterNotes''' | ||
| | | FLDQTEFOOTERNOTES | ||
| As String | | As String | ||
| | | Unlimited | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''TotalAfterTax''' | ||
| | | FLDQTETOTALAFTERTAX | ||
| As | | As Double | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''TotalTax1''' | ||
| | | FLDQTETOTALTAX1 | ||
| As Double | | As Double | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''TotalTax2''' | ||
| | | FLDQTETOTALTAX2 | ||
| As Double | | As Double | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| '''Tax1''' | | '''Tax1''' | ||
| | | FLDQTETAX1 | ||
| As | | As Double | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| '''Tax2''' | | '''Tax2''' | ||
| | | FLDQTETAX2 | ||
| As | | As Double | ||
| | | N/A | ||
|- | |||
| Public ReadOnly Property | |||
| '''TotalAfterDiscount''' | |||
| FLDQTETOTALAFTERDISC | |||
| As Double | |||
| N/A | |||
|- | |||
| Public ReadOnly Property | |||
| '''Discount''' | |||
| FLDQTEDISCOUNT | |||
| As Double | |||
| N/A | |||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''TotalForCustomer''' | ||
| | | FLDQTETOTAL4CUSTOMER | ||
| As | | As Double | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''IsPublic''' | ||
| | | FLDQTEISPUBLIC | ||
| As | | As Boolean | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Audit''' | ||
| | | FLDQTEAUDIT | ||
| As String | | As String | ||
| Unlimited | | Unlimited | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''QuoteNumber''' | ||
| | | FLDQTEQUOTENO | ||
| As | | As Integer | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''QuoteName''' | ||
| | | FLDQTEQUOTENAME | ||
| As String | | As String | ||
| | | 100 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''QuoteReference''' | ||
| | | FLDQTEREFERENCE | ||
| As String | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''ManagerRec_ID''' | ||
| | | FLDQTEWORKERID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | |||
| '''QuoteUserField1''' | |||
| FLDQTEUSER1 | |||
| As String | |||
| 30 | |||
|- | |- | ||
| Public | | Public Property | ||
| ''' | | '''QuoteUserField2''' | ||
| | | FLDQTEUSER2 | ||
| As String | | As String | ||
| | | 30 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''QuoteUserField3''' | ||
| | | FLDQTEUSER3 | ||
| As String | | As String | ||
| | | 30 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''QuoteNotes''' | ||
| | | FLDQTENOTES | ||
| As String | | As String | ||
| Unlimited | | Unlimited | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''WonConvertedTo''' | ||
| | | FLDQTEWONCONVERTEDTO | ||
| As String | | As String | ||
| 1 | | 1 | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''SignatureEmail''' | ||
| | | FLDQTECAFREEEMAIL | ||
| As String | | As String | ||
| 100 | | 100 | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''SignatureName''' | ||
| | | FLDQTECAFREENAME | ||
| As String | |||
| 50 | |||
|- | |||
| Public ReadOnly Property | |||
| '''SignatureText''' | |||
| FLDQTECAFREESIGNATRE | |||
| As String | |||
| 30 | |||
|- | |||
| Public ReadOnly Property | |||
| '''SignatureIPAddress''' | |||
| FLDQTECAIPADDRESS | |||
| As String | |||
| 15 | |||
|- | |||
| Public ReadOnly Property | |||
| '''SignatureDateAndTime''' | |||
| FLDQTECATIMESTAMP | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public ReadOnly Property | |||
| '''SignatureWebUserName''' | |||
| FLDQTECAWEBUSERNAME | |||
| As String | |||
| 70 | |||
|- | |||
| Public ReadOnly Property | |||
| '''SignatureWebUserREC_ID''' | |||
| FLDQTECAWEBUSERRECID | |||
| As String | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| '''CreatedByUser''' | | '''CreatedByUser''' | ||
| | | FLDQTECREATEUSER | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| '''LastUpdateByUser''' | | '''LastUpdateByUser''' | ||
| | | FLDQTEUPDATEUSER | ||
| As String | | As String | ||
| 20 | | 20 | ||
|} | |- | ||
| Public ReadOnly Property | |||
| '''CreatedDate''' | |||
| FLDQTECREATEDATE | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public ReadOnly Property | |||
| '''UpdateDate''' | |||
| FLDQTEUPDATEDATE | |||
| As DateTime | |||
| N/A | |||
|} | |||
=== | === QuoteLine Class === | ||
The ''' | The '''CRM.QuoteLine''' class derives from '''CRM.Object'''. The following table lists all exposed '''CRM.QuoteLine''' properties. | ||
The following table lists all exposed ''' | |||
''' | '''QuoteLine Properties Reference Table''' | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 1,704: | Line 1,770: | ||
|- | |- | ||
| Public ReadOnly Property | | Public ReadOnly Property | ||
| ''' | | '''QuoteLineREC_ID''' | ||
| | | FLDQTLRECID | ||
| As String | | As String | ||
| 20 | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''QuoteREC_ID''' | ||
| | | FLDQTLQUOTERECID | ||
| As String | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''ItemREC_ID''' | ||
| | | FLDQTLITEMRECID | ||
| As String | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''ItemGroup''' | ||
| | | FLDQTLITEMTYPEGROUP | ||
| As String | | As String | ||
| | | 1 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Quantity''' | ||
| | | FLDQTLQUANTITY | ||
| As | | As Double | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Price''' | ||
| | | FLDQTLPRICE | ||
| As | | As Double | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''DiscountMarkup''' | ||
| | | FLDQTLADJUST | ||
| As String | | As String | ||
| | | 1 | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''DiscountTotalAmountForCustomer''' | ||
| | | FLDQTLADJAMTDIS4CUST | ||
| As | | As Double | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''DiscountPercentageForCustomer''' | ||
| | | FLDQTLADJPERDIS4CUST | ||
| As | | As Double | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''LineTotal''' | ||
| | | FLDQTLBILLTOTAL | ||
| As Double | | As Double | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''LineTotalForCustomer''' | ||
| | | FLDQTLTOTAL4CUSTOMER | ||
| As Double | | As Double | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''LineType''' | ||
| | | FLDQTLLINETYPE | ||
| As String | | As String | ||
| | | 1 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''LineSortOrder''' | ||
| | | FLDQTLORDER | ||
| As Integer | | As Integer | ||
| N/A | |||
|- | |||
| Public ReadOnly Property | |||
| '''PriceForCustomerAfterMarkup''' | |||
| FLDQTLPRICE4CUSTOMER | |||
| As Double | |||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''AdjustAmount''' | ||
| | | FLDQTLADJUSTAMOUNT | ||
| As Double | | As Double | ||
| N/A | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''AdjustPercent''' | ||
| | | FLDQTLADJUSTPERCENT | ||
| As | | As Double | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''AdjustType''' | ||
| | | FLDQTLADJUSTTYPE | ||
| As String | | As String | ||
| | | 1 | ||
|- | |- | ||
| Public Property | | Public Property | ||
| ''' | | '''Description''' | ||
| | | FLDQTLDESCRIPTION | ||
| As String | | As String | ||
| Unlimited | | Unlimited | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''CreatedByUser''' | ||
| | | FLDQTLCREATEUSER | ||
| As String | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''LastUpdateByUser''' | ||
| | | FLDQTLUPDATEUSER | ||
| As String | | As String | ||
| | | 20 | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| ''' | | '''CreatedDate''' | ||
| | | FLDQTLCREATEDATE | ||
| As | | As DateTime | ||
| | | N/A | ||
|- | |- | ||
| Public Property | | Public ReadOnly Property | ||
| '''Field3''' | | '''UpdateDate''' | ||
| FLDOPPUSER3 | | FLDQTLUPDATEDATE | ||
| As String | | As DateTime | ||
| 30 | | N/A | ||
|- | |} | ||
| Public Property | |||
| '''CreatedByUser''' | ==== QuoteLine Helper Methods ==== | ||
| FLDOPPCREATEUSER | |||
| As String | Besides the get/set properties, QuoteLine supports number of helper methods. | ||
| 20 | |||
|- | '''QuoteLine Helper Methods Table''' | ||
| Public Property | {| class="wikitable" | ||
| '''LastUpdateByUser''' | |- | ||
| FLDOPPUPDATEUSER | ! '''Access modifier''' | ||
| As String | ! '''Return value''' | ||
| 20 | ! '''Property''' | ||
|} | | '''Arguments''' | ||
! '''Description''' | |||
== Config Class == | |- | ||
| Public | |||
''' | | Sub | ||
| '''SetQuoteLineItem''' | |||
{| class="wikitable" | | (ByVal sItemREC_ID As String, ByVal dblQuantity As Double, ByVal dblPrice As Double) | ||
|- | | Fills the appropriate fields for inserting Item type QuoteLine. | ||
! '''Property''' | |- | ||
! '''Type''' | | Public | ||
! '''Required''' | | Sub | ||
! '''Description''' | | '''SetQuoteLineItemWithDiscount''' | ||
|- | | (ByVal sItemREC_ID As String, ByVal dblQuantity As Double, ByVal dblPrice As Double, ByVal dblDiscount As Double, ByVal bByPercent As Boolean) | ||
| '''AppName''' | | Fills the appropriate fields for inserting Item type QuoteLine specifying a discount. | ||
| String | |- | ||
| '''Yes''' | | Public | ||
| Maximum 15 chars, string that best identifies your application. | | Sub | ||
|- | | '''SetQuoteLineItemWithMarkup''' | ||
| ''' | | (ByVal sItemREC_ID As String, ByVal dblQuantity As Double, ByVal dblPrice As Double, ByVal dblMarkup As Double, ByVal bByPercent As Boolean) | ||
| String | | Fills the appropriate fields for inserting Item type QuoteLine specifying a markup. | ||
| '''Yes''' | |- | ||
| Exact path to the folder where | | Public | ||
|- | | Sub | ||
| ''' | | '''SetQuoteLineText''' | ||
| String | | (ByVal sText As String) | ||
| '''Yes''' | | Sets the appropriate field for inserting Text type QuoteLine. | ||
| Exact path to the folder where | |- | ||
|- | | Public | ||
| ''' | | Sub | ||
| Boolean | | '''MoveLineAboveLine''' | ||
| No | | (ByVal lnAbove As QuoteLine) | ||
| Initializes the '''CmtDbEng.dll''' file, which is required for proper functioning of all update functions. True by default (recommended setting). Set it to False only if you know what you are doing. | | Moves the QuoteLine position above the lnAbove position. The QuoteLine in lnAbove must point to an existing QuoteLine. This method essentially assigns the LineSortOrder property to the same value lnAbove holds and lnAbove is pushed down. You must call '''Save''' for the change to become effective. | ||
|- | |- | ||
| ''' | | Public | ||
| Boolean | | Sub | ||
| '''MoveToBottom''' | |||
| () | |||
| Moves the QuoteLine position at the bottom of the Quote. This method essentially assigns the LineSortOrder property to '''-999''' which is the value for the last position in the Quote. You must call '''Save''' for the change to become effective. | |||
|- | |||
| Public | |||
| Sub | |||
| '''Delete''' | |||
| () | |||
| Deletes the QuoteLine. | |||
|} | |||
=== Document Class === | |||
The '''CRM.Document''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Document_Fields|Document Fields]]. | |||
The following table lists all exposed '''CRM.Document''' properties. | |||
'''Document Properties Reference Table''' | |||
{| class="wikitable" | |||
|- | |||
! '''Access modifier''' | |||
! '''Property''' | |||
! '''API Field Name''' | |||
! '''Return value''' | |||
! '''Field length''' | |||
|- | |||
| Public ReadOnly Property | |||
| '''DocumentREC_ID''' | |||
| FLDDOCRECID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''DocumentDate''' | |||
| FLDDOCDOCDATE | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Subject''' | |||
| FLDDOCDOCUMENTDESC | |||
| As String | |||
| 100 | |||
|- | |||
| Public Property | |||
| '''RelLinkREC_ID''' | |||
| FLDDOCLINKRECID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''AccountREC_ID''' | |||
| FLDDOCCARDID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''ContactREC_ID''' | |||
| FLDDOCCONTACTID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''Field1''' | |||
| FLDDOCTRANSPORT | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''Field2''' | |||
| FLDDOCFOLDER | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''Field3''' | |||
| FLDDOCUMENTPLACE | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''FilePathAndName''' | |||
| FLDDOCDOCUMENTNAME | |||
| As String | |||
| 240 | |||
|- | |||
| Public Property | |||
| '''Category''' | |||
| FLDDOCTREEID | |||
| As Integer | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''EmployeeREC_ID''' | |||
| FLDDOCWORKERID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''CreatedByUser''' | |||
| FLDDOCCREATEUSER | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''LastUpdateByUser''' | |||
| FLDDOCUPDATEUSER | |||
| As String | |||
| 20 | |||
|} | |||
=== HistoryNote Class === | |||
The '''CRM.HistoryNote''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#History_Note_Fields|History Note Fields]]. | |||
The following table lists all exposed '''CRM.HistoryNote''' properties. | |||
'''HistoryNote Properties Reference Table''' | |||
{| class="wikitable" | |||
|- | |||
! '''Access modifier''' | |||
! '''Property''' | |||
! '''API Field Name''' | |||
! '''Return value''' | |||
! '''Field length''' | |||
|- | |||
| Public ReadOnly Property | |||
| '''HistoryNoteREC_ID''' | |||
| FLDHISRECID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''[Date]''' | |||
| FLDHISNOTEDATETIME | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Description''' | |||
| FLDHISDESCRIPTION | |||
| As String | |||
| Unlimited | |||
|- | |||
| Public Property | |||
| '''RelLinkREC_ID''' | |||
| FLDHISLINKRECID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''Field''' | |||
| FLDHISUSER1 | |||
| As String | |||
| 25 | |||
|- | |||
| Public Property | |||
| '''About''' | |||
| FLDHISKIND | |||
| As String | |||
| 15 | |||
|- | |||
| Public Property | |||
| '''EmployeeREC_ID''' | |||
| FLDHISWORKERID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''AccountREC_ID''' | |||
| FLDHISCARDID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''Contact''' | |||
| FLDHISCONTACTID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''DocumentREC_ID''' | |||
| FLDHISDOCID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''CreatedByUser''' | |||
| FLDHISCREATEUSER | |||
| As String | |||
| 20 | |||
|} | |||
=== Item Class === | |||
The '''CRM.Item''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Item_Fields|Item Fields]]. | |||
The following table lists all exposed '''CRM.Item''' properties. | |||
'''Item Properties Reference Table''' | |||
{| class="wikitable" | |||
|- | |||
! '''Access modifier''' | |||
! '''Property''' | |||
! '''API Field Name''' | |||
! '''Return value''' | |||
! '''Field length''' | |||
|- | |||
| Public ReadOnly Property | |||
| '''ItemREC_ID''' | |||
| FLDITMRECID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''ItemGroup''' | |||
| FLDITMITEMTYPEGROUP | |||
| As String | |||
| 1 | |||
|- | |||
| Public Property | |||
| '''ItemCode''' | |||
| FLDITMITEMNO | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''ItemName''' | |||
| FLDITMNAME | |||
| As String | |||
| 60 | |||
|- | |||
| Public Property | |||
| '''PriceSource''' | |||
| FLDITMPRICESOURCE | |||
| As String | |||
| 1 | |||
|- | |||
| Public Property | |||
| '''PricePerHour_Unit''' | |||
| FLDITMUNITISHOUR | |||
| As String | |||
| 1 | |||
|- | |||
| Public Property | |||
| '''Price''' | |||
| FLDITMUNITPRICE | |||
| As Double | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Cost''' | |||
| FLDITMSTANDARDCOST | |||
| As Double | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Tax1''' | |||
| FLDITMTAXCODE1 | |||
| As String | |||
| 3 | |||
|- | |||
| Public Property | |||
| '''Tax2''' | |||
| FLDITMTAXCODE2 | |||
| As String | |||
| 3 | |||
|- | |||
| Public Property | |||
| '''Tax3''' | |||
| FLDITMTAXCODE3 | |||
| As String | |||
| 3 | |||
|- | |||
| Public Property | |||
| '''DescriptionByName''' | |||
| FLDITMDESCBYNAME | |||
| As String | |||
| 1 | |||
|- | |||
| Public Property | |||
| '''Description''' | |||
| FLDITMDESC | |||
| As String | |||
| Unlimited | |||
|- | |||
| Public Property | |||
| '''Suspend''' | |||
| FLDITMSUSPENDED | |||
| As String | |||
| 1 | |||
|- | |||
| Public Property | |||
| '''Notes''' | |||
| FLDITMNOTES | |||
| As String | |||
| Unlimited | |||
|- | |||
| Public Property | |||
| '''Field1''' | |||
| FLDITMUSER1 | |||
| As String | |||
| 25 | |||
|- | |||
| Public Property | |||
| '''CreateUser''' | |||
| FLDITMCREATEUSER | |||
| As String | |||
| 20 | |||
|} | |||
=== KnowledgeBaseArticle Class === | |||
The '''CRM.KnowledgeBaseArticle''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Knowledge_Base_Article_Fields|Knowledge Base Article Fields]]. | |||
The following table lists all exposed '''CRM.KnowledgeBaseArticle''' properties. | |||
'''KnowledgeBaseArticle Properties Reference Table''' | |||
{| class="wikitable" | |||
|- | |||
! '''Access modifier''' | |||
! '''Property''' | |||
! '''API Field Name''' | |||
! '''Return value''' | |||
! '''Field length''' | |||
|- | |||
| Public ReadOnly Property | |||
| '''KnowledgeBaseArticleREC_ID''' | |||
| FLDKBARECID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''DocumentDate''' | |||
| FLDKBACREATEDATE | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Title''' | |||
| FLDKBATITLE | |||
| As String | |||
| 250 | |||
|- | |||
| Public Property | |||
| '''Problem''' | |||
| FLDKBAPROBLEM | |||
| As String | |||
| Unlimited | |||
|- | |||
| Public Property | |||
| '''Solution''' | |||
| FLDKBASOLUTION | |||
| As String | |||
| Unlimited | |||
|- | |||
| Public Property | |||
| '''Status''' | |||
| FLDKBASTATUS | |||
| As String | |||
| 1 | |||
|- | |||
| Public Property | |||
| '''Category''' | |||
| FLDKBACATEGORY | |||
| As String | |||
| 100 | |||
|- | |||
| Public Property | |||
| '''[Public]''' | |||
| FLDKBAISPUBLIC | |||
| As String | |||
| 1 | |||
|- | |||
| Public Property | |||
| '''CreatedByUser''' | |||
| FLDKBACREATEUSER | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''LastUpdateByUser''' | |||
| FLDKBAUPDATEUSER | |||
| As String | |||
| 20 | |||
|} | |||
=== Opportunity Class === | |||
The '''CRM.Opportunity''' class derives from '''CRM.Object''' and encapsulates the [[API_Reference_Manual#Opportunity_Fields|Opportunity Fields]]. | |||
The following table lists all exposed '''CRM.Opportunity''' properties. | |||
'''Opportunity Properties Reference Table''' | |||
{| class="wikitable" | |||
|- | |||
! '''Access modifier''' | |||
! '''Property''' | |||
! '''API Field Name''' | |||
! '''Return value''' | |||
! '''Field length''' | |||
|- | |||
| Public ReadOnly Property | |||
| '''OpportunityREC_ID''' | |||
| FLDOPPRECID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''OpportunityName''' | |||
| FLDOPPNAME | |||
| As String | |||
| 50 | |||
|- | |||
| Public Property | |||
| '''OpportunityID''' | |||
| FLDOPPUSERID | |||
| As String | |||
| 15 | |||
|- | |||
| Public Property | |||
| '''AccountREC_ID''' | |||
| FLDOPPCARDID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''Source''' | |||
| FLDOPPSOURCE | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''CloseDate''' | |||
| FLDOPPCLOSEDATE | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Manager''' | |||
| FLDOPPWORKERID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''OpenDate''' | |||
| FLDOPPOPENDATE | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''CloseByDate''' | |||
| FLDOPPESTDATE | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Amount''' | |||
| FLDOPPAMOUNT | |||
| As Double | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Probability''' | |||
| FLDOPPPROBABILITY | |||
| As Double | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Stage''' | |||
| FLDOPPSTAGE | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''Status''' | |||
| FLDOPPSTATUS | |||
| As Integer | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''ClosingAmount''' | |||
| FLDOPPCLOSEAMOUNT | |||
| As Double | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Description''' | |||
| FLDOPPDESCRIPTION | |||
| As String | |||
| Unlimited | |||
|- | |||
| Public Property | |||
| '''OpportunityType''' | |||
| FLDOPPKIND | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''OpportunityReason''' | |||
| FLDOPPREASON | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''Note''' | |||
| FLDOPPNOTES | |||
| As String | |||
| Unlimited | |||
|- | |||
| Public Property | |||
| '''Territory''' | |||
| FLDOPPREGION | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''Field1''' | |||
| FLDOPPUSER1 | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''Field2''' | |||
| FLDOPPUSER2 | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''Field3''' | |||
| FLDOPPUSER3 | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''CreatedByUser''' | |||
| FLDOPPCREATEUSER | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''LastUpdateByUser''' | |||
| FLDOPPUPDATEUSER | |||
| As String | |||
| 20 | |||
|} | |||
=== Contact Class === | |||
The '''CRM.Contact''' class derives from '''CRM.Object''' and it represents the secondary contacts to a '''CRM.Account'''. | |||
The following table lists all exposed '''CRM.Contact''' properties. | |||
'''Contact Properties Reference Table''' | |||
{| class="wikitable" | |||
|- | |||
! '''Access modifier''' | |||
! '''Property''' | |||
! '''API Field Name''' | |||
! '''Return value''' | |||
! '''Field length''' | |||
|- | |||
| Public ReadOnly Property | |||
| '''ContactREC_ID''' | |||
| FLDCRDRECID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''ParentAccountREC_ID''' | |||
| FLDCRDASSIGNCARDID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''AccountType''' | |||
| FLDCRDENTITYKIND | |||
| As Integer | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''CompanyName''' | |||
| FLDCRDCOMPANY | |||
| As String | |||
| 60 | |||
|- | |||
| Public Property | |||
| '''Contact''' | |||
| FLDCRDCONTACT | |||
| As String | |||
| 40 | |||
|- | |||
| Public Property | |||
| '''Salutation''' | |||
| FLDCRDSUFFIX | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''Title''' | |||
| FLDCRDTITLE | |||
| As String | |||
|- | |||
| Public Property | |||
| '''Department''' | |||
| FLDCRDDEPARTMENT | |||
| As String | |||
| 35 | |||
|- | |||
| Public Property | |||
| '''Dear''' | |||
| FLDCRDDEAR | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''LastName''' | |||
| FLDCRDLASTNAME | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''AddressLine1''' | |||
| FLDCRDADDRESS1 | |||
| As String | |||
| 40 | |||
|- | |||
| Public Property | |||
| '''AddressLine2''' | |||
| FLDCRDADDRESS2 | |||
| As String | |||
| 40 | |||
|- | |||
| Public Property | |||
| '''AddressLine3''' | |||
| FLDCRDADDRESS3 | |||
| As String | |||
| 40 | |||
|- | |||
| Public Property | |||
| '''City''' | |||
| FLDCRDCITY | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''Country''' | |||
| FLDCRDCOUNTRY | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''Zip''' | |||
| FLDCRDZIP | |||
| As String | |||
| 15 | |||
|- | |||
| Public Property | |||
| '''State''' | |||
| FLDCRDSTATE | |||
| As String | |||
| 30 | |||
|- | |||
| Public Property | |||
| '''EmailAddress1''' | |||
| FLDCRDEMAIL1 | |||
| As String | |||
| 70 | |||
|- | |||
| Public Property | |||
| '''Phone1''' | |||
| FLDCRDPHONE1 | |||
| As String | |||
| 25 | |||
|- | |||
| Public Property | |||
| '''Phone2''' | |||
| FLDCRDPHONE2 | |||
| As String | |||
| 25 | |||
|- | |||
| Public Property | |||
| '''FaxNumber''' | |||
| FLDCRDFAX1 | |||
| As String | |||
| 25 | |||
|- | |||
| Public Property | |||
| '''Phone1Ext''' | |||
| FLDCRDPHNDESC1 | |||
| As String | |||
| 40 | |||
|- | |||
| Public Property | |||
| '''Phone2Ext''' | |||
| FLDCRDPHNDESC2 | |||
| As String | |||
| 40 | |||
|- | |||
| Public Property | |||
| '''FaxNumberExt''' | |||
| FLDCRDFAXDESC1 | |||
| As String | |||
| 15 | |||
|- | |||
| Public Property | |||
| '''SubContractCode''' | |||
| FLDCRDSUBCODE | |||
| As String | |||
| 15 | |||
|- | |||
| Public Property | |||
| '''Birthday''' | |||
| FLDCRDBIRTHDAY | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''Notes''' | |||
| FLDCRDNOTES | |||
| As String | |||
| Unlimited | |||
|- | |||
| Public Property | |||
| '''CreationDate''' | |||
| FLDCRDCREATEDATE | |||
| As DateTime | |||
| N/A | |||
|- | |||
| Public Property | |||
| '''CreatedByUser''' | |||
| FLDCRDCREATEUSERID | |||
| As String | |||
| 20 | |||
|- | |||
| Public Property | |||
| '''LastUpdatedBy''' | |||
| FLDCRDUPDATEUSERID | |||
| As String | |||
| 20 | |||
|} | |||
== Config Class == | |||
'''CRM.Config''' class is used to pass the global configuration settings to the '''CRM.Application Initialize''' method. | |||
{| class="wikitable" | |||
|- | |||
! '''Property''' | |||
! '''Type''' | |||
! '''Required''' | |||
! '''Description''' | |||
|- | |||
| '''AppName''' | |||
| String | |||
| '''Yes''' | |||
| Maximum 15 chars, string that best identifies your application. | |||
|- | |||
| '''DllFolder''' | |||
| String | |||
| '''Yes''' | |||
| Exact path to the folder where RangerMSP API DLLs are located ('''CmtDbEng.dll''' and '''CmtDbQry.dll''', usually '''"C:\RangerMSP\ThirdParty\UserDev"'''). | |||
|- | |||
| '''DbFolder''' | |||
| String | |||
| '''Yes''' | |||
| Exact path to the folder where RangerMSP database is located (usually '''"C:\RangerMSP\db"'''). | |||
|- | |||
| '''InitCRMApiDll''' | |||
| Boolean | |||
| No | |||
| Initializes the '''CmtDbEng.dll''' file, which is required for proper functioning of all update functions. True by default (recommended setting). Set it to False only if you know what you are doing. | |||
|- | |||
| '''InitCRMQryDll''' | |||
| Boolean | |||
| No | | No | ||
| Initializes the '''CmtDbQry.dll''' file which is required for proper functioning of all search/query functions. True by default (recommended setting). Set it to False only if you know what you are doing. | | Initializes the '''CmtDbQry.dll''' file which is required for proper functioning of all search/query functions. True by default (recommended setting). Set it to False only if you know what you are doing. | ||
Line 1,897: | Line 2,732: | ||
== Application Class == | == Application Class == | ||
The | The CRM.Application class implements a [http://en.wikipedia.org/wiki/Singleton_pattern Singleton pattern] that hold all global defined application settings and is used for easy access to these settings. Once the main CRM.Application object is initialized, you can refer to this instance by writing: CRM.Application.instance(). | ||
Table below lists the | Table below lists the CRM.Application properties. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,909: | Line 2,744: | ||
| '''config''' | | '''config''' | ||
| Config | | Config | ||
| Access to the | | Access to the CRM.Config object passed in CRM.Application.Initialize method. | ||
|- | |- | ||
| '''CmtDateFormat''' | | '''CmtDateFormat''' | ||
| String | | String | ||
| Global | | Global RangerMSP date format (as dd/mm/yyyy or mm/dd/yyyy). You'll need to refer to this setting if you are directly manipulating DateTime field (using SetFieldValue method). | ||
|- | |- | ||
| '''CmtDateSeparator''' | | '''CmtDateSeparator''' | ||
Line 1,921: | Line 2,756: | ||
| '''CmtTimeFormat''' | | '''CmtTimeFormat''' | ||
| String | | String | ||
| Global | | Global RangerMSP time format. | ||
|- | |- | ||
| '''CmtIsTimeFormatAMPMInUse''' | | '''CmtIsTimeFormatAMPMInUse''' | ||
Line 1,928: | Line 2,763: | ||
|} | |} | ||
Table below list the | Table below list the CRM.Application methods. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 1,942: | Line 2,777: | ||
| () | | () | ||
| Application | | Application | ||
| Method that returns the singleton object. Use it to access all | | Method that returns the singleton object. Use it to access all CRM.Application properties/methods. | ||
|- | |- | ||
| Public Shared Sub | | Public Shared Sub | ||
Line 1,948: | Line 2,783: | ||
| (ByVal c As Config) | | (ByVal c As Config) | ||
| | | | ||
| Method that initializes the internal | | Method that initializes the internal RangerMSP API DLLs. Must be the first call before using any other RangerMSP library calls. | ||
|- | |- | ||
| Public Shared Sub | | Public Shared Sub | ||
Line 1,954: | Line 2,789: | ||
| () | | () | ||
| | | | ||
| Terminates all | | Terminates all RangerMSP internal resources. You should call this method before exit from your application. | ||
|} | |} | ||
== | == CrmField Class == | ||
The ''' | The '''CRM.CrmField''' class holds the basic attributes for each database field. For each of the classes that represent RangerMSP objects (Account, Ticket, etc.) there is a preinitialized set of shared '''CRM.CrmField''' objects that correspond to the properties defined for the class. For example, the '''CRM.Account''' class has a property '''FileAs''' ('''CRM.Account.FileAs'''). To this property corresponds one shared object instance of the '''CRM.CrmField''' class accessible through '''CRM.Account.Fields.FileAs'''. To the property '''LastName''' ('''CRM.Account.LastName'''), corresponds the shared object '''CRM.Account.Fields.LastName''' of type '''CRM.CrmField'''. And so on, for each property in each class. | ||
Below is a table that lists the properties available in the ''' | Below is a table that lists the properties available in the '''CRM.CrmField''' class. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 2,005: | Line 2,840: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #66AD3A;">'charge is of type ''' | <span style="color: #66AD3A;">'charge is of type '''CRM.Charge''' and is previously initialized</span> | ||
Console.Out.Write(charge.AdjustAmount.ToString() + | Console.Out.Write(charge.AdjustAmount.ToString() + CRM.Charge.Fields.AdjustAmount.DisplaySymbol) | ||
</font> | </font> | ||
== ObjectQuery Class == | == ObjectQuery Class == | ||
''' | '''CRM.ObjectQuery''' is a generics class that can operate with any of the '''CRM.Object''' derived classes. It is used to query for objects of certain type (Account, Ticket, etc.). For example, the following code snippet searches for all tickets of an account updated since certain date: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #3A3AFF;">Dim</span> ticketSearch <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> ticketSearch <span style="color: #3A3AFF;">As New</span> CRM.ObjectQuery(<span style="color: #3A3AFF;">Of</span> CRM.Ticket) | ||
<span style="color: #66AD3A;">'account is previously initialized</span> | <span style="color: #66AD3A;">'account is previously initialized</span> | ||
ticketSearch.AddCriteria( | ticketSearch.AddCriteria(CRM.Ticket.Fields.AccountREC_ID, CRM.OperatorEnum.opEqual, account.AccountREC_ID) | ||
ticketSearch.AddCriteria( | ticketSearch.AddCriteria(CRM.Ticket.Fields.UpdateDate, CRM.OperatorEnum.opGreaterThanOrEqual, DateTime.Parse(<span style="color: #963A46;">"01 Jan 2011"</span>)) | ||
<span style="color: #3A3AFF;">Dim</span> tickets <span style="color: #3A3AFF;">As</span> List(<span style="color: #3A3AFF;">Of</span> | <span style="color: #3A3AFF;">Dim</span> tickets <span style="color: #3A3AFF;">As</span> List(<span style="color: #3A3AFF;">Of</span> CRM.Ticket) = ticketSearch.FetchObjects() | ||
<span style="color: #66AD3A;">'tickets now contains all | <span style="color: #66AD3A;">'tickets now contains all CRM.Ticket objects that satisfy the above criteria.</span> | ||
</font> | |||
By default, '''CRM.ObjectQuery.AddCriteria''' method uses the logical AND operator to link the conditions. Thus, in case more than one condition are added, all have to be satisfied in order for an object to get into the search results. | |||
In case we want to search for objects and it is enough to satisfy any of the criteria, we can use the OR operator, as in the example below: | |||
<font face="courier new" size="3"> | |||
<span style="color: #3A3AFF;">Dim</span> accountSearch <span style="color: #3A3AFF;">As New</span> CRM.ObjectQuery(<span style="color: #3A3AFF;">Of</span> CRM.Account)(CRM.LinkEnum.linkOR) | |||
accountSearch.AddCriteria(CRM.Account.Fields.City, CRM.OperatorEnum.opEqual, <span style="color: #963A46;">"New York"</span>) | |||
accountSearch.AddCriteria(CRM.Account.Fields.City, CRM.OperatorEnum.opEqual, <span style="color: #963A46;">"Chicago"</span>) | |||
<span style="color: #3A3AFF;">Dim</span> accounts <span style="color: #3A3AFF;">As</span> List(<span style="color: #3A3AFF;">Of</span> CRM.Account) = accountSearch.FetchObjects() | |||
<span style="color: #66AD3A;">'accounts now contains all CRM.Account objects that satisfy any of the above criteria.</span> | |||
</font> | |||
If our search returns lots of objects, it may take some time to get the results back. If not all of the object's fields are need for the given task, we can pass a comma separated string with the field names to the '''CRM.ObjectQuery.FetchObjects''' and the objects in the results will have only those fields populated. | |||
<font face="courier new" size="3"> | |||
<span style="color: #3A3AFF;">Dim</span> accountSearch <span style="color: #3A3AFF;">As New</span> CRM.ObjectQuery(<span style="color: #3A3AFF;">Of</span> CRM.Account)(CRM.LinkEnum.linkOR) | |||
accountSearch.AddCriteria(CRM.Account.Fields.City, CRM.OperatorEnum.opEqual, <span style="color: #963A46;">"New York"</span>) | |||
accountSearch.AddCriteria(CRM.Account.Fields.City, CRM.OperatorEnum.opEqual, <span style="color: #963A46;">"Chicago"</span>) | |||
<span style="color: #3A3AFF;">Dim</span> accounts <span style="color: #3A3AFF;">As</span> List(<span style="color: #3A3AFF;">Of</span> CRM.Account) = accountSearch.FetchObjects(CRM.Account.Fields.AccountREC_ID.Key & "," & CRM.Account.Fields.City.Key) | |||
<span style="color: #66AD3A;">'CRM.Account objects in the accounts list now contain only the AccountREC_ID and City fields.</span> | |||
</font> | </font> | ||
The table below explains the important methods of the ''' | The table below explains the important methods of the '''CRM.ObjectQuery''' class: | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 2,036: | Line 2,895: | ||
| (ByVal sField As String, ByVal opEnum As OperatorEnum, ByVal sValue As String) | | (ByVal sField As String, ByVal opEnum As OperatorEnum, ByVal sValue As String) | ||
| | | | ||
| Adds one criteria to the initialized ''' | | Adds one criteria to the initialized '''CRM.ObjectQuery''' object instance. | ||
First parameter is the internal field name (column '''API Field name''' in the Object derived classes tables), | First parameter is the internal field name (column '''API Field name''' in the Object derived classes tables), | ||
second parameter is the criteria operator (see the table below) | second parameter is the criteria operator (see the table below) | ||
Line 2,043: | Line 2,902: | ||
| Public Sub | | Public Sub | ||
| '''AddCriteria''' | | '''AddCriteria''' | ||
| (ByVal field As | | (ByVal field As CrmField, ByVal opEnum As OperatorEnum, ByVal sValue As String) | ||
| | | | ||
| Adds one criteria to the initialized ''' | | Adds one criteria to the initialized '''CRM.ObjectQuery''' object instance. | ||
First parameter is one of the ''' | First parameter is one of the '''CRM.CrmField''' preinitialized objects included in Fields class in each of the '''CRM.Object''' derived classes, | ||
second parameter is the criteria operator (see the table below) | second parameter is the criteria operator (see the table below) | ||
and third parameter is the value ('''System.String''') to search for. This variation (or the one variations with the '''System.DateTime''' or '''System.Double''' as third parameter) of the '''AddCriteria''' method is the preferred way of adding criteria, unless there is no preinitialized ''' | and third parameter is the value ('''System.String''') to search for. This variation (or the one variations with the '''System.DateTime''' or '''System.Double''' as third parameter) of the '''AddCriteria''' method is the preferred way of adding criteria, unless there is no preinitialized '''CRM.CrmField''' object for the field. | ||
|- | |- | ||
| Public Sub | | Public Sub | ||
| '''AddCriteria''' | | '''AddCriteria''' | ||
| (ByVal field As | | (ByVal field As CrmField, ByVal opEnum As OperatorEnum, ByVal dtValue As DateTime) | ||
| | | | ||
| Adds one criteria to the initialized ''' | | Adds one criteria to the initialized '''CRM.ObjectQuery''' object instance. | ||
First parameter is one of the ''' | First parameter is one of the '''CRM.CrmField''' preinitialized objects included in Fields class in each of the '''CRM.Object''' derived classes, | ||
second parameter is the criteria operator (see the table below) | second parameter is the criteria operator (see the table below) | ||
and third parameter is the value ('''System.DateTime''') to search for. Use this variation to search in fields that are of '''DateTime''' type. | and third parameter is the value ('''System.DateTime''') to search for. Use this variation to search in fields that are of '''DateTime''' type. | ||
Line 2,061: | Line 2,920: | ||
| Public Sub | | Public Sub | ||
| '''AddCriteria''' | | '''AddCriteria''' | ||
| (ByVal field As | | (ByVal field As CrmField, ByVal opEnum As OperatorEnum, ByVal nValue As Integer) | ||
| | | | ||
| Adds one criteria to the initialized ''' | | Adds one criteria to the initialized '''CRM.ObjectQuery''' object instance. | ||
First parameter is one of the ''' | First parameter is one of the '''CRM.CrmField''' preinitialized objects included in Fields class in each of the '''CRM.Object''' derived classes, | ||
second parameter is the criteria operator (see the table below) | second parameter is the criteria operator (see the table below) | ||
and third parameter is the value ('''System.Integer''') to search for. Use this variation to search in fields that are of '''Integer''' type. | and third parameter is the value ('''System.Integer''') to search for. Use this variation to search in fields that are of '''Integer''' type. | ||
Line 2,070: | Line 2,929: | ||
| Public Sub | | Public Sub | ||
| '''AddCriteria''' | | '''AddCriteria''' | ||
| (ByVal field As | | (ByVal field As CrmField, ByVal opEnum As OperatorEnum, ByVal nValue As Double) | ||
| | | | ||
| Adds one criteria to the initialized ''' | | Adds one criteria to the initialized '''CRM.ObjectQuery''' object instance. | ||
First parameter is one of the ''' | First parameter is one of the '''CRM.CrmField''' preinitialized objects included in Fields class in each of the '''CRM.Object''' derived classes, | ||
second parameter is the criteria operator (see the table below) | second parameter is the criteria operator (see the table below) | ||
and third parameter is the value ('''System.Double''') to search for. Use this variation to search in fields that are of '''Double''' type. | and third parameter is the value ('''System.Double''') to search for. Use this variation to search in fields that are of '''Double''' type. | ||
Line 2,081: | Line 2,940: | ||
| (ByVal sField As String, ByVal sortEnum As SortDirectionEnum) | | (ByVal sField As String, ByVal sortEnum As SortDirectionEnum) | ||
| | | | ||
| Adds a sort expression to the initialized ''' | | Adds a sort expression to the initialized '''CRM.ObjectQuery''' object instance. | ||
First parameter is the internal field name (column '''API Field name''' in the Object derived classes tables), | First parameter is the internal field name (column '''API Field name''' in the Object derived classes tables), | ||
second parameter is ''' | second parameter is '''CRM.SortDirectionEnum''' ('''sortASC''' or '''sortDESC'''). | ||
|- | |- | ||
| Public Sub | | Public Sub | ||
| '''AddSortExpression''' | | '''AddSortExpression''' | ||
| (ByVal field As | | (ByVal field As CrmField, ByVal sortEnum As SortDirectionEnum) | ||
| | | | ||
| Adds a sort expression to the initialized ''' | | Adds a sort expression to the initialized '''CRM.ObjectQuery''' object instance. | ||
First parameter is one of the ''' | First parameter is one of the '''CRM.CrmField''' preinitialized objects included in Fields class in each of the '''CRM.Object''' derived classes, | ||
second parameter is ''' | second parameter is '''CRM.SortDirectionEnum''' ('''sortASC''' or '''sortDESC'''). | ||
|- | |- | ||
| Public Function | | Public Function | ||
Line 2,097: | Line 2,956: | ||
| () | | () | ||
| As List(Of T) | | As List(Of T) | ||
| Executes the constructed query and returns a list of objects (of type '''T''' where T is any of the ''' | | Executes the constructed query and returns a list of objects (of type '''T''' where T is any of the '''CRM.Object''' derived classes) that satisfies the criteria. | ||
|} | |} | ||
Below is the table with the available operators (''' | Below is the table with the available operators ('''CRM.OperatorEnum''') used in the AddCriteria methods. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 2,107: | Line 2,966: | ||
! Description | ! Description | ||
|- | |- | ||
| ''' | | '''CRM.OperatorEnum.opEqual''' | ||
| Searches for objects using the exact match (equals) operator | | Searches for objects using the exact match (equals) operator | ||
|- | |- | ||
| ''' | | '''CRM.OperatorEnum.opGreaterThan''' | ||
| Searches for objects whose value is greater than the value passed in the third parameter in AddCriteria method. | | Searches for objects whose value is greater than the value passed in the third parameter in AddCriteria method. | ||
|- | |- | ||
| ''' | | '''CRM.OperatorEnum.opGreaterThanOrEqual''' | ||
| Searches for objects whose value is greater or equal than the value passed in the third parameter in AddCriteria method. | | Searches for objects whose value is greater or equal than the value passed in the third parameter in AddCriteria method. | ||
|- | |- | ||
| ''' | | '''CRM.OperatorEnum.opLessThan''' | ||
| Searches for objects whose value is less than the value passed in the third parameter in AddCriteria method. | | Searches for objects whose value is less than the value passed in the third parameter in AddCriteria method. | ||
|- | |- | ||
| ''' | | '''CRM.OperatorEnum.opLessThanOrEqual''' | ||
| Searches for objects whose value is less than or equal the value passed in the third parameter in AddCriteria method. | | Searches for objects whose value is less than or equal the value passed in the third parameter in AddCriteria method. | ||
|- | |- | ||
| ''' | | '''CRM.OperatorEnum.opLike''' | ||
| Combined with % (percent sign) in the value passed in the third parameter in AddCriteria method can be used for search with broader match. | | Combined with % (percent sign) in the value passed in the third parameter in AddCriteria method can be used for search with broader match. | ||
|- | |- | ||
| ''' | | '''CRM.OperatorEnum.opNot''' | ||
| Searches for objects whose value differs from the one passed in the third parameter in AddCriteria method. | | Searches for objects whose value differs from the one passed in the third parameter in AddCriteria method. | ||
|- | |- | ||
| ''' | | '''CRM.OperatorEnum.opNotLike''' | ||
| | | | ||
|} | |} | ||
Line 2,134: | Line 2,993: | ||
= Field length limitations = | = Field length limitations = | ||
Most of the database fields (analogous the properties mapped to these fields) have limits on data length that can be accepted. If more than the allowed length is assigned to a field, data is truncated to the length the field is capable of holding and the rest is discarded. Depending on the ''' | Most of the database fields (analogous the properties mapped to these fields) have limits on data length that can be accepted. If more than the allowed length is assigned to a field, data is truncated to the length the field is capable of holding and the rest is discarded. Depending on the '''CRM.Config.RaiseExceptionIfDatabaseFieldTruncated''' setting ('''True/False'''), the operation could raise an exception alerting you that not all of the data was accepted. By default this setting is off ('''False''') resulting in silent truncation of the extra data. Set the '''CRM.Config.RaiseExceptionIfDatabaseFieldTruncated''' to '''True''' if this behavior is not acceptable. | ||
Below is an example of how to switch this setting ON: | Below is an example of how to switch this setting ON: | ||
<font face="courier new" size="3"> | <font face="courier new" size="3"> | ||
<span style="color: #3A3AFF;">Dim</span> config <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> config <span style="color: #3A3AFF;">As New</span> CRM.Config | ||
config.AppName = <span style="color: #963A46;">"VB.NET Demo"</span> | config.AppName = <span style="color: #963A46;">"VB.NET Demo"</span> | ||
config. | config.DllFolder = <span style="color: #963A46;">"C:\RangerMSP\ThirdParty\UserDev"</span> | ||
config. | config.DbFolder = <span style="color: #963A46;">"C:\RangerMSP\db"</span> | ||
config.RaiseExceptionIfDatabaseFieldTruncated = <span style="color: #3A3AFF;">True</span><span style="color: #66AD3A;">'the setting is ON now</span> | config.RaiseExceptionIfDatabaseFieldTruncated = <span style="color: #3A3AFF;">True</span><span style="color: #66AD3A;">'the setting is ON now</span> | ||
<span style="color: #66AD3A;">'Initialize the | <span style="color: #66AD3A;">'Initialize the CRM.Application</span> | ||
CRM.Application.Initialize(config) | |||
<span style="color: #3A3AFF;">Dim</span> account <span style="color: #3A3AFF;">As New</span> | <span style="color: #3A3AFF;">Dim</span> account <span style="color: #3A3AFF;">As New</span> CRM.Account | ||
account.FileAs = <span style="color: #963A46;">"ACME Company"</span> | account.FileAs = <span style="color: #963A46;">"ACME Company"</span> | ||
account.Dear = <span style="color: #963A46;">"Mr."</span> | account.Dear = <span style="color: #963A46;">"Mr."</span> | ||
Line 2,158: | Line 3,017: | ||
= See Also = | = See Also = | ||
*[[ | *[[API Developers Guide|RangerMSP API Developers Guide]] | ||
*[[API Reference Manual]] | *[[API Reference Manual]] | ||
[[Category:User Manuals]] | [[Category:User Manuals]] | ||
[[Category:Integration]] | [[Category:Integration]] |
Latest revision as of 10:25, 9 July 2020
Disclaimer
This documentation refers to RangerMSP 5.6 or later version and assumes RangerMSP is installed and accessible on the local computer.
Introduction
This document demonstrates how to use the RangerMSP VB.NET API library in order to programmatically connect to your RangerMSP server and query or manipulate the RangerMSP database.
System Requirements
- RangerMSP 5.6 or later.
- Visual Basic .NET 2008 or Visual Basic .NET 2010.
- CRMLib.dll (the RangerMSP VB.NET compiled library).
Getting Started
Libraries Setup
To download, compile and setup the libraries, please refer to VB.NET API Library Setup.
Start Basic Program
After you create your VB.NET project, you'll need to add a reference to the CRMLib.dll file, in order to have access to the RangerMSP library classes.
Each application using the library will have to initialize on startup the CRM.Application object and terminate it on exit. Initialization method requires that you pass an object instance of CRM.Config class.
Connecting to the RangerMSP database can be done in two ways:
- Using a Local Server - run your program on the same server where the RangerMSP Server runs.
- Using Web API - run your program anywhere and connect to a remote RangerMSP server over Web services interface.
Connection parameters vary between these options. See the variations below:
Local Server
For connections to a local RangerMSP server configure the following settings:
- AppName
- This is free text, preferably the name of your application.
- DllFolder
- Behind the scenes the library uses the two RangerMSP API dlls: CmtDbEng.dll and CmtDbQry.dll.
- In the default RangerMSP installation you'll find these files in 'C:\RangerMSP\ThirdParty\UserDev'.
- Important Note: Always point to this folder and do not copy the dll files elsewhere. This is because when the RangerMSP version upgrade runs it also upgrades the dll files stored in this folder. This verifies that you will always be using the latest release.
- DbFolder
- Path to the RangerMSP database, default is 'C:\RangerMSP\db'.
Assuming these default values, we can configure the CRM.Config object like this:
Dim config As New CRM.Config config.AppName = "VB.NET Demo" config.DllFolder = "C:\RangerMSP\ThirdParty\UserDev" config.DbFolder = "C:\RangerMSP\db"
You should of course ensure these paths are correct on your disk and modify the values accordingly.
Remote Server (Web API)
To connect to a remote RangerMSP server with the Web API, configure the following settings:
- AppName
- This is free text, preferably the name of your application.
- WebAPIUrl
- Url to the RangerMSP server running the Web API, either local or remote.
Url must include the http:// or https:// prefix, otherwise the API will not be able to connect.
Valid examples include http://localhost:4964/ and https://webapi.mycrmserver.com/.
- Password
- Your authorization password/token
- UseWebAPI
- Boolean value, must be set to True to use the Web API
Assuming these default values, we can configure the CRM.Config object like this:
Dim config As New CRM.Config config.AppName = "VB.NET Demo" config.WebAPIUrl = "http://localhost:4964/" config.Password = "yourpassword" config.UseWebAPI = True
Initialization
The configuration settings explained above are the only differences between connecting to a local RangerMSP server or remote RangerMSP server running the Web API.
Now we can initialize the CRM.Application object with these settings:
'CRM.Application.Initialize must be the first call before invoking any other RangerMSP library method
'and it should be done only once in the program's lifetime.
CRM.Application.Initialize(config)
If anything goes wrong, the above line will throw an exception of the CRM.Exception class. To prevent unexpected termination of the program execution, we recommend having any call to the RangerMSP library enclosed in a Try/Catch block.
Before exit, we terminate the CRM.Application object:
'Before exit we should call CRM.Application.Terminate to gracefully release all application resources
'and this should be done only once in the program's lifetime.
CRM.Application.Terminate()
The most basic VB.NET application that just connects to RangerMSP and terminates could look something like this:
Try Dim config As New CRM.Config config.AppName = "VB.NET Demo" config.DllFolder = "C:\RangerMSP\ThirdParty\UserDev" config.DbFolder = "C:\RangerMSP\db" CRM.Application.Initialize(config) 'At this point we have successfully initialized the CRM.Application 'and can start using the other library classes Catch ex As Exception Console.Out.Write(ex.Message) Finally CRM.Application.Terminate() End Try
Now that we have confirmed the connectivity to the RangerMSP server (if the above code successfully runs), we can continue adding more functionality to the example.
The library exposes as VB.NET classes the same RangerMSP objects (Account, Ticket etc.) available through the native RangerMSP API and you can refer to the API Reference Manual for database fields reference.
With any of these objects you can:
- Search and query for objects with CRM.ObjectQuery that satisfy certain criteria.
- Read and display the properties of the retrieved objects.
- Update and save the properties of the retrieved objects.
- Create and save new objects.
Now let's see how we can search for CRM.Account objects.
We instantiate an object of the CRM.ObjectQuery class and pass CRM.Account class as generics parameter.
Dim accountSearch As New CRM.ObjectQuery(Of CRM.Account)
CRM.ObjectQuery class can accept any of the RangerMSP objects in this parameter, but we want to search for accounts now.
Next, we need to set criteria (or more than one) we want to search for:
accountSearch.AddCriteria(CRM.Ticket.Fields.City, CRM.OperatorEnum.opEqual, "New York")
The first parameter to the AddCriteria method is either a Shared object instance of CRM.CrmField class representing the field we want to look in or the internal API field name. Refer to the API Field Name column in the Account Class table for a complete list of the available fields for the CRM.Account class.
The second parameter is a compare operator. We here use the CRM.OperatorEnum.opEqual to get only exact matches. In order to get a broader match in the results you can use CRM.OperatorEnum.opLike operator.
The third parameter is the value we want to find. Prepending and/or appending % (percent) sign at the beginning and/or at the end while using CRM.OperatorEnum.opLike operator, will match the phrase even if in the middle of a sentence.
Now we can execute the search and retrieve the CRM.Account objects (if any):
Dim accounts As List(Of CRM.Account) = accountSearch.FetchObjects()
The above line will populate the List (System.Collections.Generic.List) with all CRM.Account objects that were found. Now we can use For Each - Next statement to iterate through the accounts:
For Each account In accounts Console.Out.WriteLine(account.CompanyName) Next
Or we can manipulate these accounts:
For Each account In accounts If account.Zip.Length = 0 Then account.Zip = "10001" account.Save() End If Next
We invoke the CRM.Account's Save method on both new or existing accounts. For a new account, invoking the Save method would insert a new account in the RangerMSP database. For an existing account, invoking the Save method would update the fields we modified in the existing account. This rule applies to all RangerMSP objects.
Another option is to add a new ticket for each of the accounts:
For Each account In accounts Dim ticket As New CRM.Ticket ticket.AccountREC_ID = account.AccountREC_ID ticket.Description = "Sample ticket for a NewYork account" ticket.Save() Next
GetFieldValue and SetFieldValue methods
Each of the RangerMSP library objects have a set of properties that are exposed as VB.NET properties that you can directly manipulate or read from. You already saw few examples of these properties in the above examples, as: account.Zip or ticket.Description. This is the preferred and more intuitive way of accessing the RangerMSP fields.
However, there is also another way of achieving the same results, by invoking GetFieldValue and SetFieldValue and specifying the internal field name. These methods should only be used if necessary, for example, when updating user-defined custom fields which are not part of the class predefined basic fields.
Here is an equivalent of the above example that uses these two generic methods, instead of the object's properties:
For Each account In accounts Dim ticket As New CRM.Ticket ticket.SetFieldValue("FLDTKTCARDID", account.GetFieldValue("FLDCRDRECID")) ticket.SetFieldValue("FLDTKTPROBLEM", "Sample ticket for a NewYork account") ticket.Save() Next
All internal field names are listed in Classes and Objects below.
Exception Handling
While working with the RangerMSP VB.NET library, some operations can fail. In this case the library will throw an exception of the CRM.Exception class. We recommend enclosing all calls to the RangerMSP library in a Try/Catch block.
To find out more about the exact error that ocured when an exception is thrown, you can inspect the CRM.Exception.Status property that holds the last RangerMSP Status value, or inspect the list of CRM.Exception.Codes (if any). Please refer to Error Codes Description for the description of these values.
Complete Program Sample
Module Module1 Sub Main() Try 'Setup the CRM.Config object Dim config As New CRM.Config config.AppName = "VB.NET Demo" config.DllFolder = "C:\RangerMSP\ThirdParty\UserDev" config.DbFolder = "C:\RangerMSP\db" 'Initialize the CRM.Application CRM.Application.Initialize(config) 'At this point we have successfully initialized the CRM.Application 'and can start using the other library classes 'search for "New York" in the FLDCRDCITY field Dim accountSearch As New CRM.ObjectQuery(Of CRM.Account) accountSearch.AddCriteria("FLDCRDCITY", CRM.OperatorEnum.opEqual, "New York") Dim accounts As List(Of CRM.Account) = accountSearch.FetchObjects() 'loop through the retrieved accounts and output the CompanyName For Each account In accounts Console.Out.WriteLine(account.CompanyName) Next Catch ex As CRM.Exception 'here we catch RangerMSP specific error 'we can inspect the RangerMSP status (exc.Status) 'exc.Codes contains all error codes last call generated 'here we show the error message Console.Out.Write(ex.Message) Catch ex As Exception Console.Out.Write(ex.Message) Finally CRM.Application.Terminate() End Try End Sub End Module
Classes and Objects
The RangerMSP VB.NET API provides easy access to all objects using a class for each entity in the system (such as Account, Ticket, Asset, etc.).
All classes include:
- API functions and routines (which are derived from the base CRM.Object class).
- Class data fields, providing an easy way to update the object's data.
All RangerMSP's objects should be updated by setting the class data fields (properties) and then calling the Save method. For example, to create a new account programmatically (assuming CRM.Application was initialized successfully), one would use the following code snippet:
Dim account As New CRM.Account account.FileAs = "ACME Company" account.Dear = "Mr." account.Contact = "John Doe" account.Save()
Another option is using SetFieldData and GetFieldData as mentioned earlier, which provide low-level access to data fields. This option should only be used if necessary, for example, when updating user-defined fields which are not part of the class basic fields.
Object Class
The CRM.Object class is the base class for all RangerMSP accessible objects (as Ticket, Account, Asset, etc.). The public routines and functions exposed by the CRM.Object class are available to the derived classes.
Object Method Reference Table
Access modifier | Method | Arguments | Return value | Description |
---|---|---|---|---|
Public Sub | SetFieldValue | (sKey As String, sValue As String) | Assigns the value (sValue) of the field passed in sKey argument. Save must be called for the change to take effect. Use this method to access user-defined custom fields. | |
Public Function | GetFieldValue | (sKey As String) | As String | Retrieves the value of the field passed in sKey argument. Use this method to access user-defined custom fields. |
Public Sub | Reload | () | Reloads the Object values from the database. The value of the object unique identifier (REC_ID, the exact name depends on the concrete derived object class) | |
Public Sub | Reinit | (sID As String) | Same as Reload except the unique identifier is passed as argument. | |
Public Sub | Save | () | Saves all modified properties of the object to the database. |
Object derived classes
Classes explained in this section are derived from CRM.Object class and map directly to a native RangerMSP object (Account, Ticket, etc.).
Account Class
The CRM.Account class derives from CRM.Object and encapsulates the Account Fields. The following table lists all exposed CRM.Account properties.
Account Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | AccountREC_ID | FLDCRDRECID | As String | 20 |
Public Property | AccountManager | FLDCRDASSIGNCARDID | As String | 20 |
Public Property | CompanyName | FLDCRDCOMPANY | As String | 60 |
Public Property | Contact | FLDCRDCONTACT | As String | 40 |
Public ReadOnly Property | Status | FLDCRDSUBCONTSTATUS | As String | 1 |
Public Property | Assistant | FLDCRDASSISTANT | As String | 20 |
Public Property | ContractREC_ID | FLDCRDBCRECID | As String | 20 |
Public Property | AccountNumber | FLDCRDCARDID2 | As String | 15 |
Public Property | ID | FLDCRDCARDID3 | As String | 15 |
Public Property | PopupMessage | FLDCRDCARDMESSAGE | As String | Unlimited |
Public Property | AddressLine1 | FLDCRDADDRESS1 | As String | 40 |
Public Property | AddressLine2 | FLDCRDADDRESS2 | As String | 40 |
Public Property | AddressLine3 | FLDCRDADDRESS3 | As String | 40 |
Public Property | City | FLDCRDCITY | As String | 30 |
Public Property | Country | FLDCRDCOUNTRY | As String | 20 |
Public Property | State | FLDCRDSTATE | As String | 30 |
Public Property | Zip | FLDCRDZIP | As String | 15 |
Public Property | CreationDate | FLDCRDCREATEDATE | As DateTime | N/A |
Public Property | CreatedByUser | FLDCRDCREATEUSERID | As String | 20 |
Public Property | Dear | FLDCRDDEAR | As String | 20 |
Public Property | Department | FLDCRDDEPARTMENT | As String | 35 |
Public Property | DocumentsStoreDirectory | FLDCRDDOCSFOLDER | As String | 100 |
Public Property | EmailAddress1 | FLDCRDEMAIL1 | As String | 70 |
Public Property | EmailAddress2 | FLDCRDEMAIL2 | As String | 70 |
Public Property | AccountType | FLDCRDENTITYKIND | As Integer | N/A |
Public Property | FaxNumber | FLDCRDFAX1 | As String | 25 |
Public Property | FaxNumberExt | FLDCRDFAXDESC1 | As String | 15 |
Public Property | FileAs | FLDCRDFULLNAME | As String | 60 |
Public Property | Type | FLDCRDKIND | As String | 30 |
Public Property | LastName | FLDCRDLASTNAME | As String | 20 |
Public Property | Notes | FLDCRDNOTES | As String | Unlimited |
Public Property | Field | FLDCRDPERSONID | As String | 20 |
Public Property | Phone1Ext | FLDCRDPHNDESC1 | As String | 40 |
Public Property | Phone2Ext | FLDCRDPHNDESC2 | As String | 40 |
Public Property | Phone3Ext | FLDCRDPHNDESC3 | As String | 15 |
Public Property | Phone4Ext | FLDCRDPHNDESC4 | As String | 15 |
Public Property | Phone1 | FLDCRDPHONE1 | As String | 25 |
Public Property | Phone2 | FLDCRDPHONE2 | As String | 25 |
Public Property | Phone3 | FLDCRDPHONE3 | As String | 25 |
Public Property | Phone4 | FLDCRDPHONE4 | As String | 25 |
Public Property | Region | FLDCRDREGIONCODE | As String | 15 |
Public Property | PopupMessageDisplayIndication | FLDCRDSHOWMESSAGE | As String | 1 |
Public Property | SubContractCode | FLDCRDSUBCODE | As String | 15 |
Public Property | Salutation | FLDCRDSUFFIX | As String | 20 |
Public Property | Tax1 | FLDCRDTAXCODE1 | As String | 3 |
Public Property | Tax2 | FLDCRDTAXCODE2 | As String | 3 |
Public Property | Title | FLDCRDTITLE | As String | 30 |
Public Property | LastUpdatedBy | FLDCRDUPDATEUSERID | As String | 20 |
Public Property | WebAddress1 | FLDCRDURL1 | As String | 100 |
Public Property | WebAddress2 | FLDCRDURL2 | As String | 100 |
Public Property | Status | FLDCRDUSER1 | As String | 30 |
Public Property | Field1 | FLDCRDUSER2 | As String | 30 |
Public Property | Field2 | FLDCRDUSER3 | As String | 30 |
Public Property | Field3 | FLDCRDUSER4 | As String | 30 |
Public Property | Field4 | FLDCRDUSER5 | As String | 30 |
Ticket Class
The CRM.Ticket class derives from CRM.Object and encapsulates the Ticket Fields. The following table lists all exposed CRM.Ticket properties.
Ticket Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | TicketREC_ID | FLDTKTRECID | As String | 20 |
Public Property | AccountREC_ID | FLDTKTCARDID | As String | 20 |
Public Property | AssetREC_ID | FLDTKTASSETRECID | As String | 20 |
Public Property | ContactREC_ID | FLDTKTCONTACTID | As String | 20 |
Public Property | ContractREC_ID | FLDTKTBCRECID | As String | 20 |
Public Property | EmployeeREC_ID | FLDTKTWORKERID | As String | 20 |
Public Property | TicketPriority | FLDTKTPRIORITY | As Integer | N/A |
Public Property | TicketNumber | FLDTKTTICKETNO | As String | 20 |
Public Property | Description | FLDTKTPROBLEM | As String | Unlimited |
Public Property | TicketType | FLDTKTKIND | As String | 25 |
Public Property | Source | FLDTKTSOURCE | As String | 30 |
Public Property | EstimatedDurationTime | FLDTKTSCHEDLENESTIM | As Integer | N/A |
Public Property | ShowTicketInDispatcher | FLDTKTFORDISPATCH | As String | 1 |
Public Property | Status | FLDTKTSTATUS | As Integer | N/A |
Public Property | CreatedByUser | FLDTKTCREATEUSER | As String | 20 |
Public Property | DueDate | FLDTKTDUEDATETIME | As DateTime | N/A |
Public Property | Resolution | FLDTKTSOLUTION | As String | Unlimited |
Public ReadOnly Property | UpdateDate | FLDTKTUPDATEDATE | As DateTime | N/A |
Asset Class
The CRM.Asset class derives from CRM.Object and encapsulates the Asset Fields. The following table lists all exposed CRM.Asset properties.
Asset Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | AssetREC_ID | FLDASTRECID | As String | 20 |
Public Property | AssetCode | FLDASTASSETCODE | As String | 30 |
Public Property | AssetType | FLDASTASSETTYPE | As String | 1 |
Public Property | AssetName | FLDASTNAME | As String | 60 |
Public Property | Status | FLDASTSTATUS | As String | 1 |
Public Property | SerialNo | FLDASTSERIALNO | As String | 30 |
Public Property | AccountREC_ID | FLDASTACCRECID | As String | 20 |
Public Property | ContactREC_ID | FLDASTCONTACTRECID | As String | 20 |
Public Property | CreatedByUser | FLDASTCREATEUSER | As String | 20 |
Public Property | PurchaseDate | FLDASTCUSTPURDATE | As DateTime | N/A |
Public Property | PurchasedFromUs | FLDASTCUSTPURFROMUS | As String | 1 |
Public Property | PurchaseInvoice | FLDASTCUSTPUROURINV | As String | 15 |
Public Property | CustomerPO | FLDASTCUSTPURPO | As String | 15 |
Public Property | PurchasePrice | FLDASTCUSTPURPRICE | As Double | N/A |
Public Property | DeliveredDate | FLDASTDELIVEDATE | As DateTime | N/A |
Public Property | Description | FLDASTDESC | As String | Unlimited |
Public Property | InstalledBy | FLDASTINSTALBY | As String | 20 |
Public Property | InstalledDate | FLDASTINSTALDATE | As DateTime | N/A |
Public Property | LicenseCodes | FLDASTLICENSECODE | As String | Unlimited |
Public Property | LicenseKeys | FLDASTLICENSEKEYS | As String | Unlimited |
Public Property | LicenseNotes | FLDASTLICENSENOTES | As String | Unlimited |
Public Property | Location | FLDASTLOCATION | As String | 50 |
Public Property | Manufacturer | FLDASTMANUFACTURER | As String | 40 |
Public Property | MnfSerialNo | FLDASTMNFSERIALNO | As String | 30 |
Public Property | Model | FLDASTMODEL | As String | 20 |
Public Property | Notes | FLDASTNOTES | As String | Unlimited |
Public Property | Quantity | FLDASTQUANTITY | As Double | N/A |
Public Property | LastUpdateBy | FLDASTUPDATEUSER | As String | 20 |
Public Property | Field1 | FLDASTUSER1 | As String | 25 |
Public Property | Field2 | FLDASTUSER2 | As String | 25 |
Public Property | Field3 | FLDASTUSER3 | As String | 25 |
Public Property | Field4 | FLDASTUSER4 | As String | 25 |
Public Property | Field5 | FLDASTUSER5 | As String | 25 |
Public Property | Date1 | FLDASTUSERDATE1 | As DateTime | N/A |
Public Property | Number1 | FLDASTUSERNUMBER1 | As Double | N/A |
Public Property | VendorPurchasedDate | FLDASTVENDORDATEPURC | As DateTime | N/A |
Public Property | VendorInvoice | FLDASTVENDORINVNO | As String | 15 |
Public Property | VendorPO | FLDASTVENDOROURPO | As String | 15 |
Public Property | VendorPrice | FLDASTVENDORPRICE | As Double | N/A |
Public Property | Vendor | FLDASTVENDORRECID | As String | 20 |
Public Property | VendorSerialNo | FLDASTVENDORSERNO | As String | 30 |
Public Property | VendorWarrantyExpDate | FLDASTVENDORWARREXP | As DateTime | N/A |
Public Property | Version | FLDASTVERSION | As String | 15 |
Public Property | WarrantyLicenseExp | FLDASTWARREXPDATE | As DateTime | N/A |
Calendar Class
The CRM.Calendar class derives from CRM.Object and encapsulates the Calendar Fields of event type Appointment. The following table lists all exposed CRM.Calendar properties.
Calendar Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | CalendarREC_ID | FLDEVTRECID | As String | 20 |
Public Property | EventType | FLDEVTWRITETOID | As Integer | N/A |
Public Property | EmployeeREC_ID | FLDEVTWORKERID | As String | 20 |
Public Property | PrivateUser | FLDEVTPRIVATEID | As String | 20 |
Public Property | AccountREC_ID | FLDEVTCARDID | As String | 20 |
Public Property | ContactREC_ID | FLDEVTCONTACTID | As String | 20 |
Public Property | DocumentREC_ID | FLDEVTDOCID | As String | 20 |
Public Property | DoneIndication | FLDEVTDONE | As Boolean | N/A |
Public Property | [Date] | FLDEVTEVENTDATE | As DateTime | N/A |
Public Property | Description | FLDEVTFREETEXT | As String | Unlimited |
Public Property | TimeStart | FLDEVTFROMTIME | As String | N/A |
Public Property | TimeEnd | FLDEVTTOTIME | As String | N/A |
Public Property | RelLinkREC_ID | FLDEVTLINKRECID | As String | 20 |
Public Property | Field1 | FLDEVTFAMILY | As String | 50 |
Public Property | Field2 | FLDEVTACTION | As String | 50 |
Public Property | Field3 | FLDEVTPLACE | As String | 40 |
Public Property | Field4 | FLDEVTPLACE1 | As String | 30 |
Public Property | Field5 | FLDEVTPLACE2 | As String | 30 |
Public Property | CreatedByUser | FLDEVTCREATEUSERID | As String | 20 |
Public Property | LastUpdateByUser | FLDEVTUPDATEUSER | As String | 20 |
Task Class
The CRM.Task class derives from CRM.Object and encapsulates the Calendar Fields of event type Task. The following table lists all exposed CRM.Task properties.
Task Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | TaskREC_ID | FLDEVTRECID | As String | 20 |
Public Property | EventType | FLDEVTWRITETOID | As Integer | N/A |
Public Property | EmployeeREC_ID | FLDEVTWORKERID | As String | 20 |
Public Property | PrivateUser | FLDEVTPRIVATEID | As String | 20 |
Public Property | AccountREC_ID | FLDEVTCARDID | As String | 20 |
Public Property | ContactREC_ID | FLDEVTCONTACTID | As String | 20 |
Public Property | DocumentREC_ID | FLDEVTDOCID | As String | 20 |
Public Property | DoneIndication | FLDEVTDONE | As Boolean | N/A |
Public Property | [Date] | FLDEVTEVENTDATE | As DateTime | N/A |
Public Property | Description | FLDEVTFREETEXT | As String | Unlimited |
Public Property | TimeStart | FLDEVTFROMTIME | As String | N/A |
Public Property | RelLinkREC_ID | FLDEVTLINKRECID | As String | 20 |
Public Property | Field1 | FLDEVTFAMILY | As String | 50 |
Public Property | Field2 | FLDEVTACTION | As String | 50 |
Public Property | Field3 | FLDEVTPLACE | As String | 40 |
Public Property | Field4 | FLDEVTPLACE1 | As String | 30 |
Public Property | Field5 | FLDEVTPLACE2 | As String | 30 |
Public Property | CreatedByUser | FLDEVTCREATEUSERID | As String | 20 |
Public Property | LastUpdateByUser | FLDEVTUPDATEUSER | As String | 20 |
Charge Class
The CRM.Charge class derives from CRM.Object and encapsulates the Charge Fields. The following table lists all exposed CRM.Charge properties.
Charge Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | ChargeREC_ID | FLDSLPRECID | As String | 20 |
Public Property | AccountREC_ID | FLDSLPCARDID | As String | 20 |
Public Property | EmployeeREC_ID | FLDSLPWORKERID | As String | 20 |
Public Property | ChargedItem | FLDSLPITEMID | As String | 20 |
Public Property | ContractREC_ID | FLDSLPBCRECID | As String | 20 |
Public Property | TicketREC_ID | FLDSLPTICKETID | As String | 20 |
Public Property | [Date] | FLDSLPSLIPDATE | As DateTime | N/A |
Public Property | Description | FLDSLPDESC | As String | Unlimited |
Public Property | Units_Hours | FLDSLPQUANTITY | As Double | N/A |
Public Property | HourlyBased | FLDSLPITEMUNITISHOUR | As Boolean | N/A |
Public Property | AdjustAmount | FLDSLPADJUSTAMOUNT | As Double | N/A |
Public Property | AdjustPercent | FLDSLPADJUSTPERCENT | As Double | N/A |
Public | AdjustType | FLDSLPADJUSTTYPE | As String | 1 |
Public Property | FromTime | FLDSLPSTARTTIME | As String | N/A |
Public Property | ToTime | FLDSLPENDTIME | As String | N/A |
Public Property | Price_Rate | FLDSLPPRICE | As Double | N/A |
Public Property | Billable | FLDSLPBILLKIND | As String | 1 |
Public Property | Billed | FLDSLPSTAGE | As String | 1 |
Public Property | Field1 | FLDSLPUSER1 | As String | 25 |
Public Property | CreateUser | FLDSLPCREATEUSER | As String | 20 |
Quote Class
The CRM.Quote class derives from CRM.Object. The following table lists all exposed CRM.Quote properties.
Quote Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | QuoteREC_ID | FLDQTERECID | As String | 20 |
Public Property | AccountREC_ID | FLDQTEACCOUNTRECID | As String | 20 |
Public Property | Status | FLDQTESTATUS | As String | 1 |
Public Property | BillToAddress | FLDQTEBILLTOADDRESS | As String | Unlimited |
Public Property | BillToContactREC_ID | FLDQTECONTACTRECID | As String | 20 |
Public Property | QuoteDate | FLDQTEQUOTEDATE | As DateTime | N/A |
Public Property | ShipToContactREC_ID | FLDQTESHIPTOCONTACT | As String | 20 |
Public Property | ShipToAddress | FLDQTESHIPTOADDRESS | As String | Unlimited |
Public Property | ContractREC_ID | FLDQTEBCRECID | As String | 20 |
Public Property | HeaderNotes | FLDQTEHEADERNOTES | As String | Unlimited |
Public Property | FooterNotes | FLDQTEFOOTERNOTES | As String | Unlimited |
Public ReadOnly Property | TotalAfterTax | FLDQTETOTALAFTERTAX | As Double | N/A |
Public ReadOnly Property | TotalTax1 | FLDQTETOTALTAX1 | As Double | N/A |
Public ReadOnly Property | TotalTax2 | FLDQTETOTALTAX2 | As Double | N/A |
Public ReadOnly Property | Tax1 | FLDQTETAX1 | As Double | N/A |
Public ReadOnly Property | Tax2 | FLDQTETAX2 | As Double | N/A |
Public ReadOnly Property | TotalAfterDiscount | FLDQTETOTALAFTERDISC | As Double | N/A |
Public ReadOnly Property | Discount | FLDQTEDISCOUNT | As Double | N/A |
Public ReadOnly Property | TotalForCustomer | FLDQTETOTAL4CUSTOMER | As Double | N/A |
Public Property | IsPublic | FLDQTEISPUBLIC | As Boolean | N/A |
Public Property | Audit | FLDQTEAUDIT | As String | Unlimited |
Public ReadOnly Property | QuoteNumber | FLDQTEQUOTENO | As Integer | N/A |
Public Property | QuoteName | FLDQTEQUOTENAME | As String | 100 |
Public Property | QuoteReference | FLDQTEREFERENCE | As String | 20 |
Public Property | ManagerRec_ID | FLDQTEWORKERID | As String | 20 |
Public Property | QuoteUserField1 | FLDQTEUSER1 | As String | 30 |
Public Property | QuoteUserField2 | FLDQTEUSER2 | As String | 30 |
Public Property | QuoteUserField3 | FLDQTEUSER3 | As String | 30 |
Public Property | QuoteNotes | FLDQTENOTES | As String | Unlimited |
Public ReadOnly Property | WonConvertedTo | FLDQTEWONCONVERTEDTO | As String | 1 |
Public ReadOnly Property | SignatureEmail | FLDQTECAFREEEMAIL | As String | 100 |
Public ReadOnly Property | SignatureName | FLDQTECAFREENAME | As String | 50 |
Public ReadOnly Property | SignatureText | FLDQTECAFREESIGNATRE | As String | 30 |
Public ReadOnly Property | SignatureIPAddress | FLDQTECAIPADDRESS | As String | 15 |
Public ReadOnly Property | SignatureDateAndTime | FLDQTECATIMESTAMP | As DateTime | N/A |
Public ReadOnly Property | SignatureWebUserName | FLDQTECAWEBUSERNAME | As String | 70 |
Public ReadOnly Property | SignatureWebUserREC_ID | FLDQTECAWEBUSERRECID | As String | 20 |
Public ReadOnly Property | CreatedByUser | FLDQTECREATEUSER | As String | 20 |
Public ReadOnly Property | LastUpdateByUser | FLDQTEUPDATEUSER | As String | 20 |
Public ReadOnly Property | CreatedDate | FLDQTECREATEDATE | As DateTime | N/A |
Public ReadOnly Property | UpdateDate | FLDQTEUPDATEDATE | As DateTime | N/A |
QuoteLine Class
The CRM.QuoteLine class derives from CRM.Object. The following table lists all exposed CRM.QuoteLine properties.
QuoteLine Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | QuoteLineREC_ID | FLDQTLRECID | As String | 20 |
Public Property | QuoteREC_ID | FLDQTLQUOTERECID | As String | 20 |
Public Property | ItemREC_ID | FLDQTLITEMRECID | As String | 20 |
Public ReadOnly Property | ItemGroup | FLDQTLITEMTYPEGROUP | As String | 1 |
Public Property | Quantity | FLDQTLQUANTITY | As Double | N/A |
Public Property | Price | FLDQTLPRICE | As Double | N/A |
Public Property | DiscountMarkup | FLDQTLADJUST | As String | 1 |
Public ReadOnly Property | DiscountTotalAmountForCustomer | FLDQTLADJAMTDIS4CUST | As Double | N/A |
Public ReadOnly Property | DiscountPercentageForCustomer | FLDQTLADJPERDIS4CUST | As Double | N/A |
Public ReadOnly Property | LineTotal | FLDQTLBILLTOTAL | As Double | N/A |
Public ReadOnly Property | LineTotalForCustomer | FLDQTLTOTAL4CUSTOMER | As Double | N/A |
Public ReadOnly Property | LineType | FLDQTLLINETYPE | As String | 1 |
Public Property | LineSortOrder | FLDQTLORDER | As Integer | N/A |
Public ReadOnly Property | PriceForCustomerAfterMarkup | FLDQTLPRICE4CUSTOMER | As Double | N/A |
Public Property | AdjustAmount | FLDQTLADJUSTAMOUNT | As Double | N/A |
Public Property | AdjustPercent | FLDQTLADJUSTPERCENT | As Double | N/A |
Public Property | AdjustType | FLDQTLADJUSTTYPE | As String | 1 |
Public Property | Description | FLDQTLDESCRIPTION | As String | Unlimited |
Public ReadOnly Property | CreatedByUser | FLDQTLCREATEUSER | As String | 20 |
Public ReadOnly Property | LastUpdateByUser | FLDQTLUPDATEUSER | As String | 20 |
Public ReadOnly Property | CreatedDate | FLDQTLCREATEDATE | As DateTime | N/A |
Public ReadOnly Property | UpdateDate | FLDQTLUPDATEDATE | As DateTime | N/A |
QuoteLine Helper Methods
Besides the get/set properties, QuoteLine supports number of helper methods.
QuoteLine Helper Methods Table
Access modifier | Return value | Property | Arguments | Description |
---|---|---|---|---|
Public | Sub | SetQuoteLineItem | (ByVal sItemREC_ID As String, ByVal dblQuantity As Double, ByVal dblPrice As Double) | Fills the appropriate fields for inserting Item type QuoteLine. |
Public | Sub | SetQuoteLineItemWithDiscount | (ByVal sItemREC_ID As String, ByVal dblQuantity As Double, ByVal dblPrice As Double, ByVal dblDiscount As Double, ByVal bByPercent As Boolean) | Fills the appropriate fields for inserting Item type QuoteLine specifying a discount. |
Public | Sub | SetQuoteLineItemWithMarkup | (ByVal sItemREC_ID As String, ByVal dblQuantity As Double, ByVal dblPrice As Double, ByVal dblMarkup As Double, ByVal bByPercent As Boolean) | Fills the appropriate fields for inserting Item type QuoteLine specifying a markup. |
Public | Sub | SetQuoteLineText | (ByVal sText As String) | Sets the appropriate field for inserting Text type QuoteLine. |
Public | Sub | MoveLineAboveLine | (ByVal lnAbove As QuoteLine) | Moves the QuoteLine position above the lnAbove position. The QuoteLine in lnAbove must point to an existing QuoteLine. This method essentially assigns the LineSortOrder property to the same value lnAbove holds and lnAbove is pushed down. You must call Save for the change to become effective. |
Public | Sub | MoveToBottom | () | Moves the QuoteLine position at the bottom of the Quote. This method essentially assigns the LineSortOrder property to -999 which is the value for the last position in the Quote. You must call Save for the change to become effective. |
Public | Sub | Delete | () | Deletes the QuoteLine. |
Document Class
The CRM.Document class derives from CRM.Object and encapsulates the Document Fields. The following table lists all exposed CRM.Document properties.
Document Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | DocumentREC_ID | FLDDOCRECID | As String | 20 |
Public Property | DocumentDate | FLDDOCDOCDATE | As DateTime | N/A |
Public Property | Subject | FLDDOCDOCUMENTDESC | As String | 100 |
Public Property | RelLinkREC_ID | FLDDOCLINKRECID | As String | 20 |
Public Property | AccountREC_ID | FLDDOCCARDID | As String | 20 |
Public Property | ContactREC_ID | FLDDOCCONTACTID | As String | 20 |
Public Property | Field1 | FLDDOCTRANSPORT | As String | 20 |
Public Property | Field2 | FLDDOCFOLDER | As String | 20 |
Public Property | Field3 | FLDDOCUMENTPLACE | As String | 20 |
Public Property | FilePathAndName | FLDDOCDOCUMENTNAME | As String | 240 |
Public Property | Category | FLDDOCTREEID | As Integer | N/A |
Public Property | EmployeeREC_ID | FLDDOCWORKERID | As String | 20 |
Public Property | CreatedByUser | FLDDOCCREATEUSER | As String | 20 |
Public Property | LastUpdateByUser | FLDDOCUPDATEUSER | As String | 20 |
HistoryNote Class
The CRM.HistoryNote class derives from CRM.Object and encapsulates the History Note Fields. The following table lists all exposed CRM.HistoryNote properties.
HistoryNote Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | HistoryNoteREC_ID | FLDHISRECID | As String | 20 |
Public Property | [Date] | FLDHISNOTEDATETIME | As DateTime | N/A |
Public Property | Description | FLDHISDESCRIPTION | As String | Unlimited |
Public Property | RelLinkREC_ID | FLDHISLINKRECID | As String | 20 |
Public Property | Field | FLDHISUSER1 | As String | 25 |
Public Property | About | FLDHISKIND | As String | 15 |
Public Property | EmployeeREC_ID | FLDHISWORKERID | As String | 20 |
Public Property | AccountREC_ID | FLDHISCARDID | As String | 20 |
Public Property | Contact | FLDHISCONTACTID | As String | 20 |
Public Property | DocumentREC_ID | FLDHISDOCID | As String | 20 |
Public Property | CreatedByUser | FLDHISCREATEUSER | As String | 20 |
Item Class
The CRM.Item class derives from CRM.Object and encapsulates the Item Fields. The following table lists all exposed CRM.Item properties.
Item Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | ItemREC_ID | FLDITMRECID | As String | 20 |
Public Property | ItemGroup | FLDITMITEMTYPEGROUP | As String | 1 |
Public Property | ItemCode | FLDITMITEMNO | As String | 30 |
Public Property | ItemName | FLDITMNAME | As String | 60 |
Public Property | PriceSource | FLDITMPRICESOURCE | As String | 1 |
Public Property | PricePerHour_Unit | FLDITMUNITISHOUR | As String | 1 |
Public Property | Price | FLDITMUNITPRICE | As Double | N/A |
Public Property | Cost | FLDITMSTANDARDCOST | As Double | N/A |
Public Property | Tax1 | FLDITMTAXCODE1 | As String | 3 |
Public Property | Tax2 | FLDITMTAXCODE2 | As String | 3 |
Public Property | Tax3 | FLDITMTAXCODE3 | As String | 3 |
Public Property | DescriptionByName | FLDITMDESCBYNAME | As String | 1 |
Public Property | Description | FLDITMDESC | As String | Unlimited |
Public Property | Suspend | FLDITMSUSPENDED | As String | 1 |
Public Property | Notes | FLDITMNOTES | As String | Unlimited |
Public Property | Field1 | FLDITMUSER1 | As String | 25 |
Public Property | CreateUser | FLDITMCREATEUSER | As String | 20 |
KnowledgeBaseArticle Class
The CRM.KnowledgeBaseArticle class derives from CRM.Object and encapsulates the Knowledge Base Article Fields. The following table lists all exposed CRM.KnowledgeBaseArticle properties.
KnowledgeBaseArticle Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | KnowledgeBaseArticleREC_ID | FLDKBARECID | As String | 20 |
Public Property | DocumentDate | FLDKBACREATEDATE | As DateTime | N/A |
Public Property | Title | FLDKBATITLE | As String | 250 |
Public Property | Problem | FLDKBAPROBLEM | As String | Unlimited |
Public Property | Solution | FLDKBASOLUTION | As String | Unlimited |
Public Property | Status | FLDKBASTATUS | As String | 1 |
Public Property | Category | FLDKBACATEGORY | As String | 100 |
Public Property | [Public] | FLDKBAISPUBLIC | As String | 1 |
Public Property | CreatedByUser | FLDKBACREATEUSER | As String | 20 |
Public Property | LastUpdateByUser | FLDKBAUPDATEUSER | As String | 20 |
Opportunity Class
The CRM.Opportunity class derives from CRM.Object and encapsulates the Opportunity Fields. The following table lists all exposed CRM.Opportunity properties.
Opportunity Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | OpportunityREC_ID | FLDOPPRECID | As String | 20 |
Public Property | OpportunityName | FLDOPPNAME | As String | 50 |
Public Property | OpportunityID | FLDOPPUSERID | As String | 15 |
Public Property | AccountREC_ID | FLDOPPCARDID | As String | 20 |
Public Property | Source | FLDOPPSOURCE | As String | 30 |
Public Property | CloseDate | FLDOPPCLOSEDATE | As DateTime | N/A |
Public Property | Manager | FLDOPPWORKERID | As String | 20 |
Public Property | OpenDate | FLDOPPOPENDATE | As DateTime | N/A |
Public Property | CloseByDate | FLDOPPESTDATE | As DateTime | N/A |
Public Property | Amount | FLDOPPAMOUNT | As Double | N/A |
Public Property | Probability | FLDOPPPROBABILITY | As Double | N/A |
Public Property | Stage | FLDOPPSTAGE | As String | 30 |
Public Property | Status | FLDOPPSTATUS | As Integer | N/A |
Public Property | ClosingAmount | FLDOPPCLOSEAMOUNT | As Double | N/A |
Public Property | Description | FLDOPPDESCRIPTION | As String | Unlimited |
Public Property | OpportunityType | FLDOPPKIND | As String | 30 |
Public Property | OpportunityReason | FLDOPPREASON | As String | 30 |
Public Property | Note | FLDOPPNOTES | As String | Unlimited |
Public Property | Territory | FLDOPPREGION | As String | 30 |
Public Property | Field1 | FLDOPPUSER1 | As String | 30 |
Public Property | Field2 | FLDOPPUSER2 | As String | 30 |
Public Property | Field3 | FLDOPPUSER3 | As String | 30 |
Public Property | CreatedByUser | FLDOPPCREATEUSER | As String | 20 |
Public Property | LastUpdateByUser | FLDOPPUPDATEUSER | As String | 20 |
Contact Class
The CRM.Contact class derives from CRM.Object and it represents the secondary contacts to a CRM.Account. The following table lists all exposed CRM.Contact properties.
Contact Properties Reference Table
Access modifier | Property | API Field Name | Return value | Field length |
---|---|---|---|---|
Public ReadOnly Property | ContactREC_ID | FLDCRDRECID | As String | 20 |
Public Property | ParentAccountREC_ID | FLDCRDASSIGNCARDID | As String | 20 |
Public Property | AccountType | FLDCRDENTITYKIND | As Integer | N/A |
Public Property | CompanyName | FLDCRDCOMPANY | As String | 60 |
Public Property | Contact | FLDCRDCONTACT | As String | 40 |
Public Property | Salutation | FLDCRDSUFFIX | As String | 20 |
Public Property | Title | FLDCRDTITLE | As String | |
Public Property | Department | FLDCRDDEPARTMENT | As String | 35 |
Public Property | Dear | FLDCRDDEAR | As String | 20 |
Public Property | LastName | FLDCRDLASTNAME | As String | 20 |
Public Property | AddressLine1 | FLDCRDADDRESS1 | As String | 40 |
Public Property | AddressLine2 | FLDCRDADDRESS2 | As String | 40 |
Public Property | AddressLine3 | FLDCRDADDRESS3 | As String | 40 |
Public Property | City | FLDCRDCITY | As String | 30 |
Public Property | Country | FLDCRDCOUNTRY | As String | 20 |
Public Property | Zip | FLDCRDZIP | As String | 15 |
Public Property | State | FLDCRDSTATE | As String | 30 |
Public Property | EmailAddress1 | FLDCRDEMAIL1 | As String | 70 |
Public Property | Phone1 | FLDCRDPHONE1 | As String | 25 |
Public Property | Phone2 | FLDCRDPHONE2 | As String | 25 |
Public Property | FaxNumber | FLDCRDFAX1 | As String | 25 |
Public Property | Phone1Ext | FLDCRDPHNDESC1 | As String | 40 |
Public Property | Phone2Ext | FLDCRDPHNDESC2 | As String | 40 |
Public Property | FaxNumberExt | FLDCRDFAXDESC1 | As String | 15 |
Public Property | SubContractCode | FLDCRDSUBCODE | As String | 15 |
Public Property | Birthday | FLDCRDBIRTHDAY | As DateTime | N/A |
Public Property | Notes | FLDCRDNOTES | As String | Unlimited |
Public Property | CreationDate | FLDCRDCREATEDATE | As DateTime | N/A |
Public Property | CreatedByUser | FLDCRDCREATEUSERID | As String | 20 |
Public Property | LastUpdatedBy | FLDCRDUPDATEUSERID | As String | 20 |
Config Class
CRM.Config class is used to pass the global configuration settings to the CRM.Application Initialize method.
Property | Type | Required | Description |
---|---|---|---|
AppName | String | Yes | Maximum 15 chars, string that best identifies your application. |
DllFolder | String | Yes | Exact path to the folder where RangerMSP API DLLs are located (CmtDbEng.dll and CmtDbQry.dll, usually "C:\RangerMSP\ThirdParty\UserDev"). |
DbFolder | String | Yes | Exact path to the folder where RangerMSP database is located (usually "C:\RangerMSP\db"). |
InitCRMApiDll | Boolean | No | Initializes the CmtDbEng.dll file, which is required for proper functioning of all update functions. True by default (recommended setting). Set it to False only if you know what you are doing. |
InitCRMQryDll | Boolean | No | Initializes the CmtDbQry.dll file which is required for proper functioning of all search/query functions. True by default (recommended setting). Set it to False only if you know what you are doing. |
Params | List(Of KeyValuePair(Of String, String)) | No | Not used, reserved for future use |
RaiseExceptionIfDatabaseFieldTruncated | Boolean | No | Specifies whether truncation of a field value will raise an exception. All string properties/fields have length limitations and if you overwrite them, the extra chars will be removed. By default this setting is False. Set it to True if you want truncation to raise an exception. |
Application Class
The CRM.Application class implements a Singleton pattern that hold all global defined application settings and is used for easy access to these settings. Once the main CRM.Application object is initialized, you can refer to this instance by writing: CRM.Application.instance().
Table below lists the CRM.Application properties.
Property | Type | Description |
---|---|---|
config | Config | Access to the CRM.Config object passed in CRM.Application.Initialize method. |
CmtDateFormat | String | Global RangerMSP date format (as dd/mm/yyyy or mm/dd/yyyy). You'll need to refer to this setting if you are directly manipulating DateTime field (using SetFieldValue method). |
CmtDateSeparator | String | Separator between the date ranges, usually '/', '-' or '.'. |
CmtTimeFormat | String | Global RangerMSP time format. |
CmtIsTimeFormatAMPMInUse | Boolean | 12 hour or 24 hour time format. |
Table below list the CRM.Application methods.
Access modifier | Method | Arguments | Return value | Description |
---|---|---|---|---|
Public Shared Function | instance | () | Application | Method that returns the singleton object. Use it to access all CRM.Application properties/methods. |
Public Shared Sub | Initialize | (ByVal c As Config) | Method that initializes the internal RangerMSP API DLLs. Must be the first call before using any other RangerMSP library calls. | |
Public Shared Sub | Terminate | () | Terminates all RangerMSP internal resources. You should call this method before exit from your application. |
CrmField Class
The CRM.CrmField class holds the basic attributes for each database field. For each of the classes that represent RangerMSP objects (Account, Ticket, etc.) there is a preinitialized set of shared CRM.CrmField objects that correspond to the properties defined for the class. For example, the CRM.Account class has a property FileAs (CRM.Account.FileAs). To this property corresponds one shared object instance of the CRM.CrmField class accessible through CRM.Account.Fields.FileAs. To the property LastName (CRM.Account.LastName), corresponds the shared object CRM.Account.Fields.LastName of type CRM.CrmField. And so on, for each property in each class.
Below is a table that lists the properties available in the CRM.CrmField class.
Property | Type | Description |
---|---|---|
Key | String | The internal database field key (as FLDCRDFULLNAME or FLDCRDLASTNAME, etc.) |
Type | String | Internal database field type (as CHAR, MEMO, DOUBLE, TIMESTAMP, etc.) |
Size | Integer | Maximum allowed length for the field data (applies to CHAR Type). |
Label | String | Label for the field |
Hint | String | |
Name | String | |
DefaultValue | String | Default value for the field |
DisplaySymbol | String | For fields that represent currency value this can be $ (for dollar), or for percentage values this can be % |
We demonstrate the above in the following sample:
'charge is of type CRM.Charge and is previously initialized
Console.Out.Write(charge.AdjustAmount.ToString() + CRM.Charge.Fields.AdjustAmount.DisplaySymbol)
ObjectQuery Class
CRM.ObjectQuery is a generics class that can operate with any of the CRM.Object derived classes. It is used to query for objects of certain type (Account, Ticket, etc.). For example, the following code snippet searches for all tickets of an account updated since certain date:
Dim ticketSearch As New CRM.ObjectQuery(Of CRM.Ticket) 'account is previously initialized ticketSearch.AddCriteria(CRM.Ticket.Fields.AccountREC_ID, CRM.OperatorEnum.opEqual, account.AccountREC_ID) ticketSearch.AddCriteria(CRM.Ticket.Fields.UpdateDate, CRM.OperatorEnum.opGreaterThanOrEqual, DateTime.Parse("01 Jan 2011")) Dim tickets As List(Of CRM.Ticket) = ticketSearch.FetchObjects() 'tickets now contains all CRM.Ticket objects that satisfy the above criteria.
By default, CRM.ObjectQuery.AddCriteria method uses the logical AND operator to link the conditions. Thus, in case more than one condition are added, all have to be satisfied in order for an object to get into the search results.
In case we want to search for objects and it is enough to satisfy any of the criteria, we can use the OR operator, as in the example below:
Dim accountSearch As New CRM.ObjectQuery(Of CRM.Account)(CRM.LinkEnum.linkOR) accountSearch.AddCriteria(CRM.Account.Fields.City, CRM.OperatorEnum.opEqual, "New York") accountSearch.AddCriteria(CRM.Account.Fields.City, CRM.OperatorEnum.opEqual, "Chicago") Dim accounts As List(Of CRM.Account) = accountSearch.FetchObjects() 'accounts now contains all CRM.Account objects that satisfy any of the above criteria.
If our search returns lots of objects, it may take some time to get the results back. If not all of the object's fields are need for the given task, we can pass a comma separated string with the field names to the CRM.ObjectQuery.FetchObjects and the objects in the results will have only those fields populated.
Dim accountSearch As New CRM.ObjectQuery(Of CRM.Account)(CRM.LinkEnum.linkOR) accountSearch.AddCriteria(CRM.Account.Fields.City, CRM.OperatorEnum.opEqual, "New York") accountSearch.AddCriteria(CRM.Account.Fields.City, CRM.OperatorEnum.opEqual, "Chicago") Dim accounts As List(Of CRM.Account) = accountSearch.FetchObjects(CRM.Account.Fields.AccountREC_ID.Key & "," & CRM.Account.Fields.City.Key) 'CRM.Account objects in the accounts list now contain only the AccountREC_ID and City fields.
The table below explains the important methods of the CRM.ObjectQuery class:
Access modifier | Method | Arguments | Return value | Description |
---|---|---|---|---|
Public Sub | AddCriteria | (ByVal sField As String, ByVal opEnum As OperatorEnum, ByVal sValue As String) | Adds one criteria to the initialized CRM.ObjectQuery object instance.
First parameter is the internal field name (column API Field name in the Object derived classes tables), second parameter is the criteria operator (see the table below) and third parameter is the value to search for. This variation of the AddCriteria method should be used only when searching in a field whose name is not included in the predefined fields. | |
Public Sub | AddCriteria | (ByVal field As CrmField, ByVal opEnum As OperatorEnum, ByVal sValue As String) | Adds one criteria to the initialized CRM.ObjectQuery object instance.
First parameter is one of the CRM.CrmField preinitialized objects included in Fields class in each of the CRM.Object derived classes, second parameter is the criteria operator (see the table below) and third parameter is the value (System.String) to search for. This variation (or the one variations with the System.DateTime or System.Double as third parameter) of the AddCriteria method is the preferred way of adding criteria, unless there is no preinitialized CRM.CrmField object for the field. | |
Public Sub | AddCriteria | (ByVal field As CrmField, ByVal opEnum As OperatorEnum, ByVal dtValue As DateTime) | Adds one criteria to the initialized CRM.ObjectQuery object instance.
First parameter is one of the CRM.CrmField preinitialized objects included in Fields class in each of the CRM.Object derived classes, second parameter is the criteria operator (see the table below) and third parameter is the value (System.DateTime) to search for. Use this variation to search in fields that are of DateTime type. | |
Public Sub | AddCriteria | (ByVal field As CrmField, ByVal opEnum As OperatorEnum, ByVal nValue As Integer) | Adds one criteria to the initialized CRM.ObjectQuery object instance.
First parameter is one of the CRM.CrmField preinitialized objects included in Fields class in each of the CRM.Object derived classes, second parameter is the criteria operator (see the table below) and third parameter is the value (System.Integer) to search for. Use this variation to search in fields that are of Integer type. | |
Public Sub | AddCriteria | (ByVal field As CrmField, ByVal opEnum As OperatorEnum, ByVal nValue As Double) | Adds one criteria to the initialized CRM.ObjectQuery object instance.
First parameter is one of the CRM.CrmField preinitialized objects included in Fields class in each of the CRM.Object derived classes, second parameter is the criteria operator (see the table below) and third parameter is the value (System.Double) to search for. Use this variation to search in fields that are of Double type. | |
Public Sub | AddSortExpression | (ByVal sField As String, ByVal sortEnum As SortDirectionEnum) | Adds a sort expression to the initialized CRM.ObjectQuery object instance.
First parameter is the internal field name (column API Field name in the Object derived classes tables), second parameter is CRM.SortDirectionEnum (sortASC or sortDESC). | |
Public Sub | AddSortExpression | (ByVal field As CrmField, ByVal sortEnum As SortDirectionEnum) | Adds a sort expression to the initialized CRM.ObjectQuery object instance.
First parameter is one of the CRM.CrmField preinitialized objects included in Fields class in each of the CRM.Object derived classes, second parameter is CRM.SortDirectionEnum (sortASC or sortDESC). | |
Public Function | FetchObjects | () | As List(Of T) | Executes the constructed query and returns a list of objects (of type T where T is any of the CRM.Object derived classes) that satisfies the criteria. |
Below is the table with the available operators (CRM.OperatorEnum) used in the AddCriteria methods.
Enum value | Description |
---|---|
CRM.OperatorEnum.opEqual | Searches for objects using the exact match (equals) operator |
CRM.OperatorEnum.opGreaterThan | Searches for objects whose value is greater than the value passed in the third parameter in AddCriteria method. |
CRM.OperatorEnum.opGreaterThanOrEqual | Searches for objects whose value is greater or equal than the value passed in the third parameter in AddCriteria method. |
CRM.OperatorEnum.opLessThan | Searches for objects whose value is less than the value passed in the third parameter in AddCriteria method. |
CRM.OperatorEnum.opLessThanOrEqual | Searches for objects whose value is less than or equal the value passed in the third parameter in AddCriteria method. |
CRM.OperatorEnum.opLike | Combined with % (percent sign) in the value passed in the third parameter in AddCriteria method can be used for search with broader match. |
CRM.OperatorEnum.opNot | Searches for objects whose value differs from the one passed in the third parameter in AddCriteria method. |
CRM.OperatorEnum.opNotLike |
Field length limitations
Most of the database fields (analogous the properties mapped to these fields) have limits on data length that can be accepted. If more than the allowed length is assigned to a field, data is truncated to the length the field is capable of holding and the rest is discarded. Depending on the CRM.Config.RaiseExceptionIfDatabaseFieldTruncated setting (True/False), the operation could raise an exception alerting you that not all of the data was accepted. By default this setting is off (False) resulting in silent truncation of the extra data. Set the CRM.Config.RaiseExceptionIfDatabaseFieldTruncated to True if this behavior is not acceptable.
Below is an example of how to switch this setting ON:
Dim config As New CRM.Config config.AppName = "VB.NET Demo" config.DllFolder = "C:\RangerMSP\ThirdParty\UserDev" config.DbFolder = "C:\RangerMSP\db" config.RaiseExceptionIfDatabaseFieldTruncated = True'the setting is ON now 'Initialize the CRM.Application CRM.Application.Initialize(config) Dim account As New CRM.Account account.FileAs = "ACME Company" account.Dear = "Mr." account.Contact = "John Doe" 'the following line of code will throw an exception because we try to assign more than 40 chars to AddressLine1 account.AddressLine1 = "More than forty characters of the main address line"'Exception is thrown here account.Save()