# slxGetProductID

### slxGetProductID(productName, type)

Check the PRODUCT table for the product name and return the ID if found.

### slxGetProductID(productName, type, displayErrors)

Check the PRODUCT table for the product name and return the ID if found. If there are no matches or multiple matches on the product name, an error message will be thrown.

## Arguments

Argument | Data Type | Description
productName | string | name/id of the product to check
type | character 'N' or 'I' | specifies whether the productName is NAME or ACTUALID
displayErrors | boolean | If true and the name does not match, an error will be thrown DEFAULT FALSE

## Returns

String - valid product ID if found.

## Description

The OPPORTUNITY table contains three virtual fields that allow you to link opportunities. They are:

- vfContactID - link the opportunity to a contact

- vfProductID - link the opportunity to a product

- vfProductID - link the opportunity to a product

When creating Opportunity records, you will normally want to link the opportunity to a product. If you have the Product table as a parent of the Opportunity table, will automatically fill in the vfProductID field.

If you do not have the Product table as a parent of Opportunity, you may want to use this function to get the correct product id, and then map this to the vfProductID field.

The TYPE parameter specifies whether the productName parameter is used to look up the product name in the PRODUCT table, or the ACTUALID field.

## Examples

Example | Returns | Description
slxGetProductID("Acme Corp") | ID if found |

## See Also

slxGetContactId(), slxGetProductID()