dyn_query: Perform FetchXML Query

Description Usage Arguments Value Note Examples

View source: R/query.R

Description

Executes a query against the specified object and returns data that matches the specified criteria.

Usage

1
2
3
dyn_query(fetchxml = NULL, entity_name = NULL, attributes = NULL,
  all_attributes = FALSE, page_size = 100, top = NULL,
  verbose = FALSE)

Arguments

fetchxml

character; a string defining a FetchXML query

entity_name

character; the name of one MS Dynamics CRM entity that the function is operating against (e.g. "Account", "Contact", "CustomObject__c")

attributes

character; one or more strings indicating attributes

all_attributes

logical; an indicator if all possible attributes should be returned for the entity. If TRUE this parameter will override the attributes parameter.

page_size

numeric; a number indicating the records per page that are returned. This is provided for performance improvements for queries returning a large number of records.

top

numeric; a number indicating the first N number of records that should be returned by the query. This behavior is similar to the LIMIT or TOP keyword in SQL.

verbose

logical; do you want informative messages?

Value

tbl_df of records

Note

If the fetchxml argument is specified, then all other fetch arguments will be ignored. They are only provided as a convenience in case the user does not want to specify exact FetchXML for simple "SELECT" queries (e.g. SELECT * FROM ACCOUNT).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
fetchxml <- "
<fetch version='1.0' count='100' page='1'>
  <entity name='systemuser'>
    <attribute name='fullname'/>
    <attribute name='internalemailaddress'/>
    <attribute name='systemuserid'/>
    <order attribute='fullname' descending='false'/>
  </entity>
</fetch>"
users <- dyn_query(fetchxml)

# using arguments instead of explicit FetchXML statement
users <- dyn_query(entity_name="systemuser",
                   attributes=c("fullname", "internalemailaddress"))

## End(Not run)

StevenMMortimer/rdynamicscrm documentation built on July 9, 2019, 11:37 a.m.