{"id":17153866,"url":"https://github.com/stevenmmortimer/rdynamicscrm","last_synced_at":"2025-03-24T13:20:24.266Z","repository":{"id":95730467,"uuid":"144392345","full_name":"StevenMMortimer/rdynamicscrm","owner":"StevenMMortimer","description":"This R package provides a client to connect to MS Dynamics CRM instances","archived":false,"fork":false,"pushed_at":"2020-07-23T17:02:02.000Z","size":199,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-29T18:22:12.424Z","etag":null,"topics":["dynamics-crm","r"],"latest_commit_sha":null,"homepage":"https://stevenmmortimer.github.io/rdynamicscrm/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StevenMMortimer.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-11T14:34:23.000Z","updated_at":"2019-07-08T15:09:14.000Z","dependencies_parsed_at":"2023-05-21T19:45:21.895Z","dependency_job_id":null,"html_url":"https://github.com/StevenMMortimer/rdynamicscrm","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenMMortimer%2Frdynamicscrm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenMMortimer%2Frdynamicscrm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenMMortimer%2Frdynamicscrm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenMMortimer%2Frdynamicscrm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StevenMMortimer","download_url":"https://codeload.github.com/StevenMMortimer/rdynamicscrm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245276093,"owners_count":20588895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dynamics-crm","r"],"created_at":"2024-10-14T21:47:32.296Z","updated_at":"2025-03-24T13:20:24.245Z","avatar_url":"https://github.com/StevenMMortimer.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: \n  github_document:\n    html_preview: false\n---\n\n```{r, echo = FALSE, message = FALSE}\nknitr::opts_chunk$set(\n  fig.align = 'center',\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\")\n```\n\n# rdynamicscrm\u003cimg src=\"man/figures/rdynamicscrm.png\" width=\"120px\" align=\"right\" /\u003e\n\n[![Build Status](https://travis-ci.org/StevenMMortimer/rdynamicscrm.svg?branch=master)](https://travis-ci.org/StevenMMortimer/rdynamicscrm)\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/StevenMMortimer/rdynamicscrm?branch=master\u0026svg=true)](https://ci.appveyor.com/project/StevenMMortimer/rdynamicscrm)\n[![Coverage Status](https://codecov.io/gh/StevenMMortimer/rdynamicscrm/branch/master/graph/badge.svg)](https://codecov.io/gh/StevenMMortimer/rdynamicscrm?branch=master)\n\n**rdynamicscrm** is an R package that creates a client to connect to MS Dynamics CRM. \nPackage features include: \n\n  * An auto-refreshing authentication method (`dyn_auth()`)\n  * CRUD (Create, Retrieve, Update, Delete) methods for records, such as: \n    * `dyn_create()`, `dyn_retreive()`, `dyn_update()`, `dyn_delete()`\n  * Query records using `dyn_query()`\n  * Basic utility calls (`dyn_whoami()`)\n\n## Table of Contents  \n  * [Installation](#installation)\n  * [Usage](#usage)\n    * [Authenticate](#authenticate)\n    * [Create](#create)\n    * [Query](#query)\n    * [Update](#update)\n    * [Delete](#delete)\n  * [Future](#future)\n  * [Credits](#credits)\n  * [More Information](#more-information)\n\n## Installation\n\n```{r, eval = FALSE}\n# this package is not yet available on CRAN \n# install the latest version available on GitHub using the devtools package\n\n# install.packages(\"devtools\")\ndevtools::install_github(\"StevenMMortimer/rdynamicscrm\")\n```\n\nIf you encounter a clear bug, please file a minimal reproducible example on [GitHub](https://github.com/StevenMMortimer/rdynamicscrm/issues).\n\n## Usage\n\n### Authenticate\n\nFirst, load the **rdynamicscrm** package and authenticate.\n\n```{r auth, include = FALSE}\nsuppressWarnings(suppressMessages(library(dplyr)))\nsuppressWarnings(suppressMessages(library(purrr)))\nsuppressWarnings(suppressMessages(library(here)))\nlibrary(rdynamicscrm)\nrdynamicscrm_setup \u003c- readRDS(here::here(\"tests\", \"testthat\", \"rdynamicscrm_setup.rds\"))\nsuppressMessages(dyn_auth(url = rdynamicscrm_setup$url, \n                          username = rdynamicscrm_setup$username, \n                          password = rdynamicscrm_setup$password))\n```\n\n```{r, eval=FALSE}\nlibrary(rdynamicscrm)\n\ndyn_auth(url = \"https://test.ztcrm.org/\",\n         username = \"test@live.com\", \n         password = \"{PASSWORD_HERE}\")\n```\n\nThe `dyn_auth()` function will obtain a cipher and secret key that will be embedded \nin the header of each SOAP API call to securely access the CRM instance. After obtaining \nthese authentication credentials, you can check your connectivity by looking at \nthe information returned about the current user. It should be information about you!\n\n```{r}\n# pull down information of person logged in\n# it's a simple easy call to get started \n# and confirm a connection to the APIs\nme \u003c- dyn_whoami()\nmy_info \u003c- dyn_retrieve(me$UserId, entity_name=\"systemuser\", \n                        attributes=c(\"fullname\", \"isdisabled\"))\n#sprintf(\"Name: %s\", my_info$fullname)\nsprintf(\"Disabled?: %s\", my_info$isdisabled)\n```\n\n### Create\n\nMS Dynamics CRM has entities and those entities contain records. One default entity is the \n\"contact\" entity. This example shows how to create two records in the contact entity.\n\n```{r create-records}\nn \u003c- 2\nnew_contacts \u003c- tibble(firstname = rep(\"Test\", n),\n                       lastname = paste0(\"Contact-Create-\", 1:n))\ncreated_records \u003c- dyn_create(new_contacts, entity_name=\"contact\")\ncreated_records\n```\n\n### Query\n\nMS Dynamics CRM has proprietary form of SQL called FetchXML. FetchXML is a powerful \ntool that allows you to return the attributes of records on almost any entity in \nMS Dynamics CRM including accounts, contacts, custom entities and more! \n\nFor simple \"SELECT\" queries you only need to specify the entity and the fields.\n\n```{r query-records-1}\nqueried_records \u003c- dyn_query(entity_name = \"contact\",\n                             attributes = c(\"modifiedon\", \"donotbulkemail\"), top=3)\nqueried_records\n```\n\nBelow is an example where we grab the two contact records we just created using \nFetchXML to specifically target those records.\n\n```{r query-records-2}\nmy_fetchxml \u003c- '\u003cfetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"false\"\u003e\n                  \u003centity name=\"contact\" \u003e\n                    \u003cattribute name=\"firstname\" /\u003e\n                    \u003cattribute name=\"lastname\" /\u003e\n                    \u003cfilter type=\"or\"\u003e\n                      \u003ccondition attribute=\"lastname\" operator=\"eq\" value=\"Contact-Create-1\" /\u003e\n                      \u003ccondition attribute=\"lastname\" operator=\"eq\" value=\"Contact-Create-2\" /\u003e\n                    \u003c/filter\u003e\n                  \u003c/entity\u003e\n                \u003c/fetch\u003e'  \nqueried_records \u003c- dyn_query(fetchxml=my_fetchxml)\nqueried_records\n```\n\n### Update\n\nAfter creating records you can update them using `dyn_update()`. Updating a record \nrequires you to pass the MS Dynamics CRM `Id` of the record. MS Dynamics CRM creates \na GUID (globally unique identifier) on each record and uses that to know which record to \nattach the update information you provide. Simply include a field or column in your \nupdate dataset called \"Id\" and the information will be matched. Here is an example \nwhere we update each of the records we created earlier with a new first name \ncalled \"TestTest\".\n\n```{r update-records}\n# Update some of those records\nqueried_records \u003c- queried_records %\u003e%\n  mutate(firstname = \"TestTest\") %\u003e% \n  rename(id=contactid)\n\nupdated_records \u003c- dyn_update(queried_records, entity_name=\"contact\")\nupdated_records\n```\n\n### Delete\n\nRecords can easily be deleted individually or in bulk by passing a vector of IDs \nto the `dyn_delete()` function. Here we will delete the two records that we created \nin this example.\n\n```{r delete-records}\nids_to_delete \u003c- updated_records$id\ndeleted_records \u003c- dyn_delete(ids_to_delete, entity_name=\"contact\")\ndeleted_records\n```\n\n## Future\n\nSupport for:\n\n - Online environments (not just On-Premise IFD environments)\n - Upsert \n - Related Entities\n\n## Credits\n\nThis application has derived inspiration from other open source software components. \nThe format of the XML in SOAP calls was created by following mimicking implementations \nin [Java](https://github.com/jlattimer/CRMSoapAuthJava) by Jason Lattimer and \n[Python](https://github.com/veeloinc/python-dynamics) by Veelo, Inc. In addition, \ninspiration was drawn from examples created by Jamie Miley that are available on his \n[blog](http://mileyja.blogspot.com/p/microsoft-dynamics-crm-2011-sdk-example.html). \nWe acknowledge and are grateful to these developers for their contributions to open source.\n\n## More Information\n\nMicrosoft provides support with a C# client library. Unfortunately R is not a supported \nlanguage. However, most all operations supported by Dynamics CRM can be made available \nvia this package. This package makes requests best formatted to match what the API \nrequires as input. This articulation is not perfect and continued progress will be \nmade to add and improve functionality. For details on formatting, attributes, and \nmethods please refer to \n[Microsoft's documentation](https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/use-microsoft-dynamics-365-organization-service) \nas they are explained better there.\n\nMore information is also available on the `pkgdown` site at \nhttps://StevenMMortimer.github.io/rdynamicscrm.  \n\n[Top](#rdynamicscrm)\n\n---\nPlease note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).\nBy participating in this project you agree to abide by its terms.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenmmortimer%2Frdynamicscrm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevenmmortimer%2Frdynamicscrm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenmmortimer%2Frdynamicscrm/lists"}