# slxGetLeadSourceID

### slxGetLeadSourceID(leadSource, type)

Returns the SalesLogix LeadSourceID for a given Lead Source Description or Lead Source Abbreviation.

### slxGetLeadSourceID(leadSource, type, displayErrors)

Returns the SalesLogix LeadSourceID for a given Lead Source Description or Lead Source Abbreviation and throw an error if there is an error when querying the Saleslogix table.

## Arguments

Argument | Data Type | Description
--- | --- | ---
Lead description or abbrevaition | String | The lead description or abbreviation
"D" or "A" | String | Specifies whether the first argument is lead description ("D") or abbreviation ("A")
Throw error | String or Boolean | If TRUE, any errors when querying SalesLogix will cause an error to be thrown

## Returns

String - valid leadID if found.

## Description

This function will query the LEADSOURCE table and get the appropriate lead source id, which can then be used when mapping to the OPPORTUNITY table.

If the second parameter is "A", the following SQL will be executed:

SELECT LEADSOURCEID FROM LEADSOURCE WHERE ABBREVDESC= 'yourText'

If the second parameter is "D", the follwoing SQL will be executed:

SELECT LEADSOURCEID FROM LEADSOURCE WHERE DESCRIPTION= 'yourText'

## Examples

Example | Returns
--- | ---
slxgetleadsourceid("MyLeads", "A") | The lead source id found

## See Also