module DataRelationships

Represents common relationships from a Data class

Public Instance Methods

organisation() click to toggle source

@example

# Retrieve organisation record associated to an opportunity and then get its name
Opportunity.organisation.name

Retrieve organisation related to current opportunity

# File lib/leap_salesforce/soql_data/data_relationships.rb, line 9
def organisation
  raise '"Organisation" class not yet defined' unless defined? Organisation

  Organisation.find(Id: self['AccountId'])
end
owner() click to toggle source

@example Get user name

record.owner.name

@return [Exchange] object representing owner of object

# File lib/leap_salesforce/soql_data/data_relationships.rb, line 18
def owner
  User.find(Id: self[:owner_id])
end
queue() click to toggle source

@example Get user name

record.queue.name

@return [Exchange] object representing owner of object

# File lib/leap_salesforce/soql_data/data_relationships.rb, line 25
def queue
  Group.find(Id: self[:owner_id])
end
record_type() click to toggle source

Retrieve record type for current object

# File lib/leap_salesforce/soql_data/data_relationships.rb, line 30
def record_type
  raise '"RecordType" class not yet defined' unless defined? RecordType

  RecordType.find(Id: self['RecordTypeId'])
end