add getIdFieldByStringField()
This commit is contained in:
@@ -29,6 +29,7 @@ Protected methods
|
||||
- [getDoubleFieldValues](#getdoublefieldvalues)
|
||||
- [getFieldByField](#getfieldbyfield)
|
||||
- [getFieldsByField](#getfieldsbyfield)
|
||||
- [getIdFieldByStringField](#getidfieldbystringfield)
|
||||
- [getIdFieldByIdField](#getidfieldbyidfield)
|
||||
- [getIdFieldsByIdField](#getidfieldsbyidfield)
|
||||
- [getIdFieldValues](#getidfieldvalues)
|
||||
@@ -138,6 +139,18 @@ Contacts contacts = Contacts.newInstance(records);
|
||||
Map<Object, Set<Object>> contactIdByAccountId = contacts.getFieldsByField(Contact.Id, Contact.AccountId);
|
||||
```
|
||||
<br/><br/>
|
||||
#### getIdFieldByStringField
|
||||
Get a map with the string field as the key and the ID as values. Key fields containing null values are omitted.
|
||||
|
||||
`protected Map<String, Id> getIdFieldByStringField(Schema.SObjectField valueField, Schema.SObjectField keyField)`
|
||||
|
||||
_Example_
|
||||
|
||||
```apex
|
||||
Contacts contacts = Contacts.newInstance(records);
|
||||
Map<String, Id> accountIdByContactId = contacts.getIdFieldByStringField(Contact.Id, Contact.Name);
|
||||
```
|
||||
<br/><br/>
|
||||
|
||||
#### getIdFieldByIdField
|
||||
Get a map with the values of two Id fields. Key fields containing null values are omitted.
|
||||
|
||||
Reference in New Issue
Block a user