JoinFieldValue
A record type can be referenced by another record type through a foreign key. A joined field is a field on a record type that uses a foreign key to reference a field on another record type. For example, on most record types, the OwnerId field is a foreign key that references the User record type. The Owner field on many records is a joined field that uses the OwnerId foreign key to reference the Alias field on the User record type.
The JoinFieldValue function in Expression Builder returns the value of a joined field when the referenced record type and the related foreign key fields are specified in the function. The JoinFieldValue function can also retrieve other fields on the referenced record type that are not directly joined to the referencing object, which allows you to look up fields across record types from related record types.
Syntax
JoinFieldValue (ref_record_type, foreign_key, field_name)
Result Type
String.
If an error occurs or the requested field value is empty, a zero-length string is returned.
Arguments
The following table describes the arguments for the function.
Argument
|
Description
|
ref_record_type
|
The language-independent name of the referenced record type. (A language-independent name is a name that does not change when the user language changes.)
The argument must be enclosed in field string identifiers. For example:
'<Account>'
See the table in the Record Types section of this topic for a list of the language-independent record-type names.
|
foreign_key
|
A literal or expression that returns a valid row ID in the referenced record type (specified in the ref_record_type argument). If the row ID is invalid, the function returns a zero-length string. Direct field references must be enclosed in field identifiers. For example:
[<AccountId>]
|
field_name
|
The language-independent name of a field in the referenced record type (specified by the ref_record_type argument). If the field does not exist in the referenced record type, an error is returned. The field name must be enclosed in field string identifiers. For example:
'<Type>'
|
Examples
Example 1: A business process requires a workflow rule to look up the name of the new owner when the owner of a record is changed. When the owner of a record is changed, only the OwnerId foreign key field on the record is updated. As a result, the following condition on a workflow rule does not look up the new owner of the record:
PRE('<Owner>') <> [<Owner>]
Instead, you can use the following condition in the workflow to look up the new owner of the record:
PRE('<Owner>') <> JoinFieldValue('<User>',[<OwnerId>],'<Alias>')
Example 2: To get the email address of the previous owner of a record, use the following expression:
JoinFieldValue('<User>',PRE('<OwnerId>'),'<EMailAddr>')
Example 3: To get the email address of the current owner of a record, use the following expression:
JoinFieldValue('<User>',[<OwnerId>],'<EMailAddr>')
Example 4: A business process requires that a service request email is sent to a contact. Before the email is sent, the workflow rule checks that the contact has agreed to receive emails. The workflow rule (based on the service request record type) has the following condition:
JoinFieldValue('<Contact>',[<ContactId>],'<NeverEmail>')<> 'Y'
Example 5: To get the territory of the primary account for a service request, use the following expression:
JoinFieldValue('<Territory>', JoinFieldValue('<Account>', [<AccountId>], '<TerritoryId>'),'<TerritoryName>')
Record Types
In the following table, the Referenced Record Type column shows the language-independent names of the referenced record types that you can look up using the JoinFieldValue function. The Foreign Key column shows the foreign keys that you use to look up the referenced record type. The Record Type column shows the record types that you use to configure workflow rules where the foreign keys are exposed.
|
|
|
|
Referenced Record Type
|
Foreign Key
|
Record Type
|
Account
|
ParentAccountId
|
Account
|
Campaign
|
SourceCampaignId
|
Contact
|
PrimaryContactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Territory
|
TerritoryId
|
User
|
OwnerId
|
Account
|
CompetitorId
|
Account Competitor
|
Contact
|
PrimaryContactId
|
Account
|
AccountId
|
Account Contact
|
Contact
|
ContactId
|
Contact
|
ContactId
|
Account Contact Role
|
Account
|
AccountId
|
Account Note
|
Account
|
AccountId
|
Account Team
|
User
|
UserId
|
Account
|
AccountId
|
Activity
|
Campaign
|
CampaignId
|
Contact
|
PrimaryContactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Dealer
|
DealerId
|
FundRequest
|
FundRequestId
|
Lead
|
LeadId
|
MedEdEvent
|
MedEdEventId
|
Opportunity
|
OpportunityId
|
Portfolio
|
PortfolioId
|
ServiceRequest
|
ServiceRequestId
|
User
|
DelegatedById
|
User
|
OwnerId
|
Contact
|
ContactId
|
Assessment
|
Lead
|
LeadId
|
Opportunity
|
OpportunityId
|
ServiceRequest
|
ServiceRequestId
|
Account
|
ManufacturerId
|
Asset
|
Account
|
AccountId
|
Contact
|
CustomerContactId
|
Product
|
ProductId
|
Account
|
AccountId
|
Auto Dealer Makes
|
Account
|
AccountId
|
Auto Sales Hours
|
Product
|
ProductId
|
Auto Service Hours
|
Product
|
ProductId
|
Call Product Detail
|
User
|
OwnerId
|
Call Sample Dropped
|
Campaign
|
CampaignId
|
Campaign
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
User
|
OwnerId
|
Contact
|
ContactId
|
Campaign Recipients
|
Contact
|
CampaignContactId
|
Campaign
|
CampaignId
|
Account
|
AccountId
|
Contact
|
Campaign
|
SourceCampaignId
|
Contact
|
ManagerId
|
Contact
|
ContactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Territory
|
TerritoryId
|
User
|
OwnerId
|
Contact
|
ContactId
|
Contact Note
|
Contact
|
ContactId
|
Contact Team
|
User
|
UserId
|
Account
|
AccountId
|
Custom Object 01
|
Activity
|
ActivitiyId
|
Campaign
|
CampaignId
|
Contact
|
ContactId
|
CustomObject1
|
ParentId
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Dealer
|
DealerId
|
Fund
|
FundId
|
Household
|
HouseholdId
|
Lead
|
LeadId
|
MedEdEvent
|
MedEdEventId
|
Opportunity
|
OpportunityId
|
Portfolio
|
PortfolioId
|
Product
|
ProductId
|
ServiceRequest
|
ServiceRequestId
|
Solution
|
SolutionId
|
User
|
OwnerId
|
Vehicle
|
VehicleId
|
Account
|
AccountId
|
Custom Object 02
|
Activity
|
ActivityId
|
Campaign
|
CampaignId
|
Contact
|
ContactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
ParentId
|
CustomObject3
|
CustomObject3Id
|
Dealer
|
DealerId
|
Fund
|
FundId
|
Household
|
HouseholdId
|
Lead
|
LeadId
|
MedEdEvent
|
MedEdEventId
|
Opportunity
|
OpportunityId
|
Portfolio
|
PortfolioId
|
Product
|
ProductId
|
ServiceRequest
|
ServiceRequestId
|
Solution
|
SolutionId
|
User
|
OwnerId
|
Vehicle
|
VehicleId
|
Account
|
AccountId
|
Custom Object 03
|
Activity
|
ActivityId
|
Campaign
|
CampaignId
|
Contact
|
ConatctId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
ParentId
|
Dealer
|
DealerId
|
Fund
|
FundId
|
Household
|
HouseholdId
|
Lead
|
LeadId
|
MedEvent
|
MedEdEventId
|
Opportunity
|
OpportunityId
|
Portfolio
|
PortfolioId
|
Product
|
ProductId
|
ServiceRequest
|
ServiceRequestId
|
Solution
|
SolutionId
|
User
|
OwnerId
|
Vehicle
|
VehicleId
|
CustomObject1
|
CustomObject1Id
|
Dealer
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Dealer
|
ParentDealerId
|
Territory
|
PrimaryTerritoryId
|
User
|
OwnerId
|
Dealer
|
ChannelPartnerId
|
Dealer Territory
|
CustomObject1
|
CustomObject1Id
|
Fund
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Fund
|
FundId
|
User
|
PrimaryOwnerId
|
Fund
|
FundId2
|
Fund Participant
|
Campaign
|
CampaignId
|
Fund Request
|
Contact
|
PrimaryContactId
|
Fund
|
FundId
|
FundRequest
|
OwnedByEmployeeId
|
User
|
FundOwnerId
|
User
|
OwnerId
|
Account
|
AccountID
|
Household
|
Contact
|
PrimaryContactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Household
|
OwnerGroupId
|
Campaign
|
CampaignId
|
Household Contact
|
Account
|
AccountId
|
Lead
|
Campaign
|
CampaignId
|
Contact
|
ContactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Opportunity
|
OpportunityId
|
User
|
OwnerId
|
User
|
SalesRepId
|
User
|
ReferredById
|
|
Product
|
ProductId
|
MedEd Event
|
User
|
OwnerId
|
Account
|
AccountId
|
Opportunity
|
Campaign
|
SourceCampaignId
|
Contact
|
KeyContactId
|
Contact
|
ConatactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Dealer
|
DealerId
|
Territory
|
TerritoryId
|
User
|
OwnerId
|
Contact
|
PrimaryContactId
|
Opportunity Competitor
|
Opportunity
|
CompetitorId
|
Contact
|
ContactId
|
Opportunity Contact Role
|
Opportunity
|
OpportunityId
|
OpportunityId
|
OptyId
|
Opportunity Note
|
Contact
|
PrimaryContactId
|
Opportunity Partner
|
Opportunity
|
PartnerId
|
User
|
OwnerId
|
Opportunity
|
OptyId
|
Opportunity Team
|
User
|
UserId
|
Account
|
ParentAccountId
|
Partner
|
Campaign
|
SourceCampaignId
|
Territory
|
TerritoryId
|
User
|
ChannelAccountManagerId
|
User
|
OwnerId
|
Account
|
AccountId
|
Portfolio
|
Account
|
InstitutionId
|
Contact
|
PrimaryContactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Portfolio
|
OwnerGroupId
|
Portfolio
|
ParentPortfolioAccountId
|
Product
|
ParentProductId
|
Product
|
ProductId
|
User
|
OwnerId
|
Contact
|
ContactId
|
Portfolio Owner
|
Portfolio
|
PortfolioId
|
Product
|
ParentProductId
|
Product
|
Account
|
OpportunityAccountId
|
Revenue
|
Asset
|
AssetId
|
Contact
|
ContactId
|
Opportunity
|
OpportunityId
|
Product
|
ProductId
|
User
|
OwnerId
|
Account
|
AccountId
|
Service Request
|
Asset
|
AssetId
|
Contact
|
ContactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Dealer
|
DealerId
|
Product
|
ProductId
|
User
|
OwnerId
|
CustomObject1
|
CustomObject1Id
|
Solution
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Product
|
ProductId
|
Account
|
AccountId
|
Vehicle
|
Contact
|
PrimaryContactId
|
CustomObject1
|
CustomObject1Id
|
CustomObject2
|
CustomObject2Id
|
CustomObject3
|
CustomObject3Id
|
Product
|
ProductId
|
Dealer
|
SellingDealerId
|
Dealer
|
ServicingDealerId
|
User
|
OwnerId
|
In addition, the following foreign key fields are common to all record types, and they reference the following user record types:
Related Topics
See the following topics for related Expression Builder information:
|