Create lead in D365 from PowerApps information - dynamics-crm

When 'Request Quote' is pressed, I want all the info from the text boxes to be sent to Dynamics 365 and for a lead entity to be created and filled out with all info.

For other data sources, we usually do SubmitForm. But for CDS we have to use PATCH function.
Read more
Patch(
"CDSEntityDataSource",
Defaults(CDSEntityDataSource),
{
Column1:DataCardValue1.Text,
Column2:DataCardValue2.Text,
...
}
)

Related

How to set multiple locations in Outlook compose form?

I am currently working on an Angular outlook addin using Microsoft Graph API. I have to set and get Outlook item data in compose form. I referred the link Get and set data items in outlook compse form for doing that. In the case of location, I used
Office.context.mailbox.item.location.setAsync('LocationA');
But it will take only string. In the case of multiple locations, I cant use this property. Is there any other way to implement the setting of multiple location in Outlook compose form?
You can use EnhancedLocation Preview API to set one or more locations that are associated with email ids. You need to use addAsync and passing the locations to be added to the current list of locations as locationIdentifiers.
Office.context.mailbox.item.enhancedLocation
In read and compose mode, enhancedlocation will return an object of type EnhancedLocation, on which you can perform add/get/remove operation.
var locations = [
{
"id": "ConfRoom101#contoso.com",
"type": Office.MailboxEnums.LocationType.Room
}
];
Office.context.mailbox.item.enhancedLocation.addAsync(locations);
Also be aware that this API is provided as a preview for developers and may change based on the feedback. It is wise not use this API in a production environment.

PowerApps - "Set Regarding" for an appointment in CRM

So I need to essentially create a PowerApp which would make appointments in Dynamics CRM. All data gets sent to CRM - except the case regarding the appointment.
Originally, I was using the normal SubmitForm() but switched over to the Patch() function. I have set the _regardingobjectid_value to a valid case GUID. The problem lies with _regardingobjectid_type - as for some reason, I cannot set the entity name. In this case, the entity name would be "incident", but it keeps throwing an error that states that it needs another GUID. I really don't know what to do anymore.
This is the code I am using:
Patch(
Appointments;
Defaults(Appointments);
{
Subject: txtSubject.Text;
'Start Time': DateTimeValue(_selectedStartTime);
'End Time': DateTimeValue(_selectedEndTime);
Description:txtDescription.Text;
_regardingobjectid_value: _regarding;
_regardingobjectid_type: incident
}
)
So to clarify, I would just really like to have my appointment have the specified case regarded to it.
At the moment I am getting an error stating that incident "name is invalid". If I remove the type, I get an ambigious error. And when I set the case id to the type, it does input my record into Dynamics, however with no case (understandably so).
This should work. Exact same problem is solved in this blog post.
You have to make sure to set this Use GUID data types instead of strings setting in App settings.
Patch(
Appointments;
Defaults(Appointments);
{
Subject: txtSubject.Text;
'Start Time': DateTimeValue(_selectedStartTime);
'End Time': DateTimeValue(_selectedEndTime);
Description:txtDescription.Text;
_regardingobjectid_value: GUID(_regarding);
_regardingobjectid_type: “incidents”
}
)
Edit:
Nick mentioned in his blog about this. Should be a known bug.
The only reason why I choose Flow as opposed to writing directly to
CDS from the PowerApp is that at this point you cannot set the
“regarding” when you write to a task in the Canvas based PowerApp, but
you can using Flow.

Change label in Google contacts

I want to synchronize contacts in my application with Google contacts. But not all of them, just those with the right label (tag). I'm using Google's People Apis for this. But I ran into a problem, the memberships property/field which holds informations about labels is read only. I can't even create a contact/person with the right label. It throws an error. Is there a way how to update or create a contact with label?
For mor information head here.
EDIT:
I've tried both creating and updating a contact. Sending a POST and PATCH request message on https://people.googleapis.com/v1/people:createContact (similiar to update contact). Both fail with the same error, memberships parameter is read-only.
contactGroupId is the id of the label I'm trying to assaign to the contact.
Request body:
{
"memberships": [
{
"contactGroupMembership": {
"contactGroupId": "45asd3d7321gd"
}
}
]
... //Other parameters
}
You should use contactGroups.members.modify api call

Filter records based on current user in PowerApps

I want to filter records on my browse screen with email of current user.I used Office 365 Users Connection. 
Logic Which I have written on items property of browse screen:
SortByColumns(Search(Filter('Time Entries', User().Email= Office365Users.MyProfile().Mail) , TextSearchBox1.Text, "cf_name"), "createdon", If(SortDescending1, Ascending,Descending))
Error:
Part of this filter cannot be evaluated remotely due to service limitations.The local evaluation may produce suboptimal or partial results.
Try changing the Onstart of your app to Set(CurrentUser,User()) and then instead of User().Email = Office365Users.Myprofile().Mail use CurrentUser.Email = Office365Users.Myprofile()

Is it possible to retrieve schema change information in Dynamics CRM online?

When a custom entity is created, a field is added or changed, someone makes an out-of-box changes to metadata.
How to know who did it and when?
The same for the creation or modification from a UI form. The metadata in CRM doesn't seem to store that information.
I think it is not possible to access information you're asking for. Such a information is not available in the on-premise CRM database and I suppose there is a similar situation with CRM Online
Not exactly what you are looking for. But this will be a good starting point to achieve what you want.
Using RetrieveMetadataChangesRequest, we can get the schema changes like:
Adding a custom entity named sample_SampleEntityForMetadataQuery with
a custom optionset attribute named : sample_ExampleOptionSet
ClientVersionStamp: 296646!10/22/2012 21:42:06
Adding an additional option to the sample_ExampleOptionSet attribute
options
Deleting the sample_SampleEntityForMetadataQuery custom entity
--
Sample code can be found in MSDN/SDK.
protected RetrieveMetadataChangesResponse getMetadataChanges(
EntityQueryExpression entityQueryExpression,
String clientVersionStamp,
DeletedMetadataFilters deletedMetadataFilter)
{
RetrieveMetadataChangesRequest retrieveMetadataChangesRequest = new RetrieveMetadataChangesRequest()
{
Query = entityQueryExpression,
ClientVersionStamp = clientVersionStamp,
DeletedMetadataFilters = deletedMetadataFilter
};
return (RetrieveMetadataChangesResponse)_service.Execute(retrieveMetadataChangesRequest);
}

Resources