Addressbook.multivalue.setPrimaryIdentifier
-------------------------------------------

Sets the primary value to be the value for the given identifier.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Addressbook](component_Addressbook.md) | [3.1](newinversion31.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |

### Deprecated

This function was [deprecated](deprecated.md). Use [Contacts](component_Contacts.md) functions instead.

MBS( "Addressbook.multivalue.setPrimaryIdentifier"; Identifier ) 

**MBS**( **"Addressbook.multivalue.setPrimaryIdentifier";** /\* Sets the primary value to be the value for the given identifier. \*/  
**$Identifier**) /\* The identifier whose value will be used as the primary value for a multivalue property. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Identifier | The identifier whose value will be used as the primary value for a multivalue property. | $identifier |

### Result

Returns OK on success and error on failure.

### Description

Sets the primary value to be the value for the given identifier.  
If the identifier is empty, this method returns an error. Use the [Addressbook.multivalue.identifierAtIndex](AddressbookmultivalueidentifierAtIndex.md) method to get the identifier given the index.  
### Examples

Add a new URL to a contact:

 Set Variable \[$r ; MBS ( "[Addressbook.multivalue.New](AddressbookmultivalueNew.md)") \]  
Set Variable \[$ID ; MBS ( "[Addressbook.multivalue.addValue](AddressbookmultivalueaddValue.md)"; "http://www.mbsplugins.de"; "WorkLabel" ) \]   
Set Variable \[$r ; MBS ( "Addressbook.multivalue.setPrimaryIdentifier"; $ID ) \]  
Set Variable \[$r ; MBS ( "[Addressbook.record.SetValueForProperty](AddressbookrecordSetValueForProperty.md)"; $personID ; "URLsProperty"; "multivalue" ) \]  
Add work and home emails:

 $r = MBS ( "[Addressbook.multivalue.New](AddressbookmultivalueNew.md)" )  
$WorkEmailID = MBS ( "[Addressbook.multivalue.addValue](AddressbookmultivalueaddValue.md)"; Addressbook::WorkEmail ; "EmailWorkLabel" )  
$HomeEmailID = MBS ( "[Addressbook.multivalue.addValue](AddressbookmultivalueaddValue.md)"; Addressbook::HomeEmail ; "EmailHomeLabel" )  
$r = MBS ( "Addressbook.multivalue.setPrimaryIdentifier"; $WorkEmailID )  
$r = MBS ( "[Addressbook.record.SetValueForProperty](AddressbookrecordSetValueForProperty.md)"; $personID ; "EmailProperty"; "multivalue" )  
### See also

- [Addressbook.multivalue.addValue](AddressbookmultivalueaddValue.md)
- [Addressbook.multivalue.identifierAtIndex](AddressbookmultivalueidentifierAtIndex.md)
- [Addressbook.multivalue.indexForIdentifier](AddressbookmultivalueindexForIdentifier.md)
- [Addressbook.multivalue.labelForIdentifier](AddressbookmultivaluelabelForIdentifier.md)
- [Addressbook.multivalue.New](AddressbookmultivalueNew.md)
- [Addressbook.multivalue.primaryIdentifier](AddressbookmultivalueprimaryIdentifier.md)
- [Addressbook.multivalue.valueForIdentifier](AddressbookmultivaluevalueForIdentifier.md)
- [Addressbook.NewPerson](AddressbookNewPerson.md)
- [Addressbook.record.SetValueForProperty](AddressbookrecordSetValueForProperty.md)
- [Addressbook.save](Addressbooksave.md)

### Example Databases

- [Mac and iOS/Addressbook/Addressbook](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Addressbook/Addressbook.shtml#3ScriptAnchor_)

This function is free to use.

Created 18th August 2014 , last changed 6th September 2025

  
[Addressbook.multivalue.replaceValueAtIndex](AddressbookmultivaluereplaceValueAtIndex.md) - [Addressbook.multivalue.valueAtIndex](AddressbookmultivaluevalueAtIndex.md)

[HTML Version](AddressbookmultivaluesetPrimaryIdentifier.shtml)