# addtogrp

### Inaport Gold and above only

### addtogrp(groupName, userId, clearGroup, sortValue, refValue)

Adds a contact to the named group, optionally clearing the original group members at the start of the import.

## Arguments

Argument | Data Type | Description
groupName | string | Name of GoldMine group to add contact to
userId | string | The user ID of the the owner of the group
clearGroup | boolean | Clear the group before adding any members
sortValue | string | The value to be used as the member sort value
refValue | string | The value to be used as the member reference value

## Returns

No value returned.

## Description

Adds a contact to the specified GoldMine group if a record for that contact has been matched. The group to add to is specified using the groupName parameter. The boolean parameter clearGroup indicates whether the group list should initially be cleared before contacts from the current import are added, or the contacts simply added to the end of the existing group list. Note that a true value for clearGroup will only result in the named group being cleared once at the start of the current import, i.e. before any contacts from the current import are added. It does not clear the group for every contact addition. Also note that to use the latter optional parameters you have to have put something in the previous arguments, even if you do not wish to. This can be done by just having an open and close quotes to represent the argument, see the first example to see how this is done.

The userId parameter will allow you to select the user who owns the group if it differs from the one set up for the import, however if it is left out or set to "" then the user ID that has been set up for the import will still be used.

## Examples

Example | Returns | Description
addtogrp("NewInvoices", "", true) |  | adds the current contact to the "NewInvoices" group in GoldMine, having initially cleared the group list at the start of the import. This example uses the default user as indicated by the empty quotes as the second parameter.
addtogrp("NewInvoices", "", false) |  | adds the current contact to the end of the current "NewInvoices" group in GoldMine. This example uses the default user as indicated by the empty quotes as the second parameter.
addtogrp("NewInvoices", "BLOGGS") |  | adds the current contact to the group "NewInvoices" group in GoldMine that is owned by the user "BLOGGS".
addtogrp("NewInvoices", "", false, "ord" + #OrderNo) |  | adds the current contact to the "NewInvoices" group in GoldMine belonging to the user set up for this import. It will also set the sort value for the member to be the text "ord" and the value contained in the OrderNo field
addtogrp("NewInvoices", "", false, "ord" + #OrderNo, "ref - " + #Company) |  | as above but will also add the value of the text "ref - " and the value in the field #Company into the reference field for the member

## See Also

attachap(), cleargrp(), makegrp(), removefromgrp(), removegrp()