how to retrieve select option ids and values via the web api - dynamics-crm

I'm using the api/data/v8.0 API endpoint of a microsoft crm 2016 and I can retrieve and update a specific entity using GET and PATCH on api/data/v8.0/accounts(063e4c86-e7f0-e511-93f7-123456bb6ce7).
That entity has a property called jobtypecode (I can see that on the JSON response of the GET) and on the front end of the CRM the possible values are the following (I retrieved them using dev tools by inspecting that html select):
721874717 Full Time
721874719 Part Time
721874713 Academic
721874714 Other
How can I retrieve those values via the API?
I tried using api/data/v8.0/GlobalOptionSetDefinitions and various combinations of api/data/v8.0/EntityDefinitions but no luck.

You can use EntityDefinitions with the MetadataId of account, add a filter to only get the optionset you want.
EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet
Source: https://msdn.microsoft.com/en-us/library/mt607522.aspx#bkmk_queryAttributes

Related

You can not complete this action for this component because of the configuration of its managed properties

I am trying to make a field optional in the Dynamics CRM
The name of the entity is Case and the internal name of the field is customerid
When I try to change it from mandatory to optional, I get the below error message
You can not complete this action for this component because of the
configuration of its managed properties.
this is happening in Dynamics CRM online
I'm pretty sure you won't be able to.
It's one of the few fields where mandatory behaviour is enforced at the platform level, whilst most mandatory fields are enforced only on the user interface.
If I remember correctly, tring to create a case without a customer via the API will result in an exception.
Looking at the managed properties for the customerid field on my recently provisioned CRM Online, shows that I'm unable to change the requirement level - I don't even get the option for setting it as optional.
I wanted to remove the field from the form, but I was not able to do it from the UI
So I used XRMToolBox.
There is a plugin called as FormXML Manager, enable it in the XRMToolBox and load the entities. Once this is done you can remove the required field and publish the form

TFS Get list of all availble fields and values- rest api

In my visual studio (TFS), when I try to write a TFS query I am able to see a list of all possible fields(eg. Team, Work Item Type etc.) and in values, I am able to see a list of all possible values for that field.
Is there any way I can get a list of all such fields and values?
Eg. I want to get a list of all Work Item Type I have in my TFS, or I want to get a list of all Applications in my TFS.
I have tried going through TFS rest APIs, I could only find a way to get work items or iterations or area path.
I am looking for REST API.
REST API still doesn't support get allowedvalues in a field.
Currently, we can only use old .net API to get allowedvalues by getting an instance of class FieldDefinition and referencing the AllowedValues property.
You can get list of fields via this API:
http://{tfs_url/project}/_apis/wit/fields?api-version=4.1

Get records in MS flow from Dynamics CRM

I am new to CRM and flow and in building a flow using MS flow, I need to get a record from Dynamics CRM equivalent to below SQL query -
select * from contacts where emailId = '<email id>'
Can you please help me to understand that how can I achieve this. I tried using List records feature but it threw an error that OData query is not correct. Image of flow is attached.
Well, it's working, I just had to put the parameter supplied in the single quote like -
emailaddress1 eq '<Customer email>'
If I understand correctly, the issue you are facing is with Filter query, Flow is not throwing an Error.
I tried to replicate the Flow on my Instance/org.
The issue is see is your filter filed "emailadress" should be selected from CRM i.e from system.
It is not mapped from CRM rather you wrote it per hand.
Click on Filter query it will open the dialog from where you could map the
fields. Screenshot below will help you understand more.

Is there any Common Way for updating status using c# in Dynamics CRM

I want to update the status using single common way in c#.
For now I know about SetStateRequest but it did not change its status to any of status. e.g. If i want to change status to fulfilled for order or canceled for order then it requires FulfillSalesOrderRequest and CancelSalesOrderRequest .Like wise different different class for quote's status and others.
So I want some common way for change status.If is there any solution please suggest me.
If you are on CRM 2015 Update 1 or later, SetStateRequest has been deprecated in favor of a normal UpdateRequest, as seen on MSDN:
Before Microsoft Dynamics CRM Online 2015 Update 1, specialized
messages were required to update certain entity attribute values. Now,
UpdateRequest can now be used to set these attributes. The following
table identifies the specialized deprecated message requests and the
related message attributes that can be updated using UpdateRequest.
With that being said, FulfillSalesOrderRequest (and the corresponding Requests for quotes) have not been deprecated, so you still need to use them going forward. The common reqeust you are looking for does thus not exist.

Programatically retrieve an attachment stored on a note on a CRM 4.0 entity

How would you suggest working with files that is stored on the note of a entity in Crm. Could you write a generic method that will enable you to access any type of file? Or would it be better to have a method for dealing with each type of file?
For example, we are going to be saving a mix of swf files and xml files on the entity, so would it make sense to have a method each for example:
GetXmlFilesOnAccount(accountid)
GetSwfFilesOnAccount(accountid)
When you upload an attachment to CRM the mimetype is also saved as part of the record information.
The following link contains a nice example of how to download the attachemt using a single method. http://crmscape.blogspot.com/2009/10/ms-crm-40-sending-attachments-to.html
The post is missing the actual query needed to retrieve the annotations but you can tell what columns are required from the method signature.
My suggestion using your methods:
* GetXmlFilesOnAccount(accountid)
* GetSwfFilesOnAccount(accountid)
Retrieve account activitypointers by regardingobjectid(in your case accountid guid)
Loop through returned activitypointers
Get attachments for each activitypointer (activitypointer.activityid = activitymimeattachment.activityid)
Store attachments (disk, etc)
You don't even need two methods. You can retrieve all attachment file types for a given note (annotation) with a single method.
Hope this helps.
I recently started an Open Source Project on CodePlex to accomplish exactly that. Feel free to check out the Project's Web Page at:
http://crmattachdownload.codeplex.com/
You can also view the source code under the "Source Code" tab of that same page.
Pete

Resources