Dynamics CRM - Converting Lead to Oppurtunity - dynamics-crm

I am new to CRM. I was reading here that there is a "convert lead to account, contact and opportunity". I understand how it would split the data from lead to account and contact, but I can't see ( from reading the Entity Metadata excel file ) where any opportunity information would be linked to lead.

If I understand your question correctly, you are looking for Originating Lead lookup in Opportunity entity record where the Qualified Lead entity record reference will be stored.
If you want to store more Lead record values into Opportunity record, you can use entity relationship mapping like explained in this blog.
Update:
If you don’t want to create a Contact when qualifying, you will need to associate the Lead to an existing Contact in Dynamics CRM 2015. An Opportunity will always be created regardless of which fields are populated on the Lead.
In fact, if you didn’t fill out a single field on the Lead form (none were set to ‘required’), and Qualified that Lead, you would create a new Opportunity with no information associated to a new Contact that also has no information.
Of course, you can use workflows to adjust these situations as required – e.g. if you never want an Opportunity to be created from a Qualified Lead you could write a workflow to delete the Opportunity on creation (checking to make sure the Originating Lead has a value).
Read more

Related

Loading records into Dynamics 365 through ADF

I'm using the Dynamics connector in Azure Data Factory.
TLDR
Does this connector support loading child records which need a parent record key passed in? For example if I want to create a contact and attach it to a parent account, I upsert a record with a null contactid, a valid parentcustomerid GUID and set parentcustomeridtype to 1 (or 2) but I get an error.
Long Story
I'm successfully connecting to Dynamics 365 and extracting data (for example, the lead table) into a SQL Server table
To test that I can transfer data the other way, I am simply loading the data back from the lead table into the lead entity in Dynamics.
I'm getting this error:
Failure happened on 'Sink' side. ErrorCode=DynamicsMissingTargetForMultiTargetLookupField,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=,Source=,''Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Cannot find the target column for multi-target lookup field: 'ownerid'.
As a test I removed ownerid from the list of source columns it loads OK.
This is obviously a foreign key value.
It raises two questions for me:
Specifically with regards to the error message: If I knew which lookup it needed to use, how can I specify which lookup table it should validate against? There's no settings in the ADF connector to allow me to do this.
This is obviously a foreign key value. If I only had the name (or business key) for this row, how can I easily lookup the foreign key value?
How is this normally done through other API's, i.e. the web API?
Is there an XRMToolbox addin that would help clarify?
I've also read some posts that imply that you can send pre-connected data in an XML document so perhaps that would help also.
EDIT 1
I realised that the lead.ownertypeid field in my source dataset is NULL (that's what was exported). It's also NULL if I browse it in various Xrmtoolbox tools. I tried hard coding it to systemuser (which is what it actually is in the owner table against the actual owner record) but I still get the same error.
I also notice there's a record with the same PK value in systemuser table
So the same record is in two tables, but how do I tell the dynamics connector which one to use? and why does it even care?
EDIT 2
I was getting a similar message for msauto_testdrive for customerid.
I excluded all records with customerid=null, and got the same error.
EDIT 2
This link appears to indicate that I need to set customeridtype to 1 (Account) or 2 (Contact). I did so, but still got the same error.
Also I believe I have the same issue as this guy.
Maybe the ADF connector suffers from the same problem.
At the time of writing, #Arun Vinoth was 100% correct. However shortly afterwards there was a documentation update (in response to a GitHub I raised) that explained how to do it.
I'll document how I did it here.
To populate a contact with against a parent account, you need the parent accounts GUID. Then you prepare a dataset like this:
SELECT
-- a NULL contactid means this is a new record
CAST(NULL as uniqueidentifier) as contactid,
-- the GUID of the parent account
CAST('A7070AE2-D7A6-EA11-A812-000D3A79983B' as uniqueidentifier) parentcustomerid,
-- customer id is an account
'account' [parentcustomerid#EntityReference],
'Joe' as firstname,
'Bloggs' lastname,
Now you can apply the normal automapping approach in ADF.
Now you can select from this dataset and load into contact. You can apply the usual automapping approach, this is: create datasets without schemas. Perform a copy activity without mapping columns
This is the ADF limitation with respect to CDS polymorphic lookups like Customer and Owner. Upvote this ADF idea
Workaround is to use two temporary source lookup fields (owner team and user in case of owner, account and contact in case of customer) and with parallel branch in a MS Flow to solve this issue. Read more, also you can download the Flow sample to use.
First, create two temporary lookup fields on the entity that you wish to import Customer lookup data into it, to both the Account and Contact entities respectively
Within your ADF pipeline flow, you will then need to map the GUID values for your Account and Contact fields to the respective lookup fields created above. The simplest way of doing this is to have two separate columns within your source dataset – one containing Account GUID’s to map and the other, Contact.
Then, finally, you can put together a Microsoft Flow that then performs the appropriate mapping from the temporary fields to the Customer lookup field. First, define the trigger point for when your affected Entity record is created (in this case, Contact) and add on some parallel branches to check for values in either of these two temporary lookup fields
Then, if either of these conditions is hit, set up an Update record task to perform a single field update, as indicated below if the ADF Account Lookup field has data within it

Seeking solution for Dynamics365 CRM records similar to MS Word tracking changes

I am currently leading the implementation of Office 365 for a crowdfunding portal for a UN agency. The portal features stories of survivors of human trafficking. Their cases are generated in Dynamics (for various reasons) and published to the user-facing platform. Each case comprises of a collection of records including various text fields which contain individual story points.
The problem: Those survivor stories are usually generated by teams on the ground but can be diplomatically sensitive.
As such each case needs to go through an elaborate review process to ensure that higher ups can propose changes to the case, make comments for specific fields. Each field can have several (1:n) comments/ change suggestions from n staff (not just one).
It was proposed to collate feedback in a field called 'comments' but this separates the input from the fields the comment was made about. We are now looking for a solution that emulates Word's 'tracking changes' feature.
Options considered but ruled out:
We are aware that Dynamics comes with an audit history module, but this usually requires changes/ comments to be displayed in a separate window which defeats the purpose.
Is anyone aware of a useful workaround which accomplishes one or several of the below:
Flags changes in a particular record per record and next to said record
Allows for said changes to be accepted or rejected by the Case owner
Supports workflow integration and user hierarchies.
Works in Dynamics (not Sharepoint... ... ...)
Any advice would be highly appreciated.
While I am all for creative uses of CRM, and CRM can store the data you're looking for, using CRM as a collaborative document editing system might be pushing the envelope.
Before you build out a custom document editing system, you might want to consider reviewing SharePoint, and some of the other document management add-ons that exist for CRM. While I have not implemented it myself, I have heard good things about LaserFiche.
You might also want to look into a 3rd party editor that provides "track changes" capabilities that you can embed in a web resource on the Case form.
I took a quick look and found this LoopIndex LITE plugin for CKEditor.
If you do go the custom route, here's a potential design for capturing the comments on a field-by-field basis:
Each field could have a separate text box where a user can enter a new comment about that field. A workflow could take that comment, turn it into a new "comment" record which would include the user, timestamp, and text. The workflow would also clear the box for the next comment.
You might also want to have this text box hidden by default for each field and have a checkbox called "Add Comment" (again for each field), which would show the new comment text box.
And you could consider having the new comment text box automatically populate with the original text, so the user can edit it rather than from start from scratch. This could be optional via an "Edit original text" checkbox or button.
To get really fancy you could run a text diff module to compare the updated text and the original, and store the new text as HTML, highlighting the differences.
The approval process would work off the "comment" entity. People could review each comment and approve or deny, with additional "meta-comments".
You could then have a web resource that would compile all existing comments for the field into html and display them under the field, formatted based on their status (i.e. pending review in black, denied in red, approved in green).
While I think this approach can be effective, adding a new field to the survivor's story would have some overhead. Another approach would be to create a Story Field entity and a Story Field Type entity. Let's say there are 5 fields now in the survivor's story. When you populate a story into CRM you'd create 5 Story Field records, each with its appropriate type. And, the Story Field entity would have a 1:N to Comments. This way, adding a new field to the survivor's story template is as simple as adding a new Story Field Type.
My proposal:
Use CRM incident entity or any custom entity as now hierarchy data can be maintained.
Parent incident is field collected record & child incidents can be used for tracking each feedback / comments / change requests from officials.
Build a custom approval mechanism using actions/workflow/plugins based on your team skill set. This can be invoked based on BPF stages in child Case.
On approval (child case closures) the values / comments can be rolled up / incorporated to the parent incident record.
Note: Multiple parallel feedback for overwriting changes can be a challenge, but approval business process flow should take care of this scenario.

How to have an address field like Account and Contact entities

I have added a new entity to my Solution in Dynamics Online 2016 Update 1 which is used to log the details of a physical computer (named System). This entity needs to have an address associated which may not be the same as the linked Account and Contact records.
How do I include an address field(s) in the same way that the Account and Contact entities do, that has a multiple line input field which pops out to multiple single line fields when clicked and links to a Bing maps location beneath it?
If this is not possible (and I really hope it is) then what is best practice for associating street addresses with custom entities?
what you describe is known as the composite field and it's not possible to create custom fields with the same flyout style.
Regarding the address, you can proceed as you prefer, create the fields or create a separate entity, or what you think suit your requirements.

How can I tell if an entity is disabled in Dynamics CRM 4.0?

In Microsoft Dynamics CRM 4.0, I want to be able to check if a record of any entity type is disabled. I think I can check the statecode. From the information I have seen, a value of zero means that the entity is enabled (editable in CRM) and any other value means disabled (for editing in CRM).
Is this assumption correct for all entities?
EDIT
If my assumption is correct, is it possible to create a QueryExpression for dynamic entities that does such a comparison, rather than using the text, "Active", which would be incorrect for quotes?
From what I've read, StateCode is not necessarily the same for every entity. It varies per entity.
I'm not aware of a way to disable an entity. I double checked our install, but don't see any option to disable. Google also yields no results to this end.
Do you mean perhaps individual entity records? If so, you'll have to check the StateCode for the entity you're looking at. I think most entities use StateCode as you describe, but for some entities, such as Activities, it seems to vary a little.
Here is some SQL I found to pull back the StateCode/StatusCode details of a particular entity:
select
AttributeName,
AttributeValue,
Value
from dbo.StringMap
where
(dbo.StringMap.AttributeName = 'statuscode'
or
dbo.StringMap.AttributeName = 'statecode')
and
dbo.StringMap.ObjectTypeCode = 1
ObjectTypeCode 1 maps to the Account entity.
Hope this helps.
EDIT: Just saw your addition. I think you'll be safe using StateCode in most instances. I personally use it in one of my projects to exclude disabled records on the Lead and Contact entities. Just double check the value mapping as I've described and then implement.

MS CRM 4 - Custom entity with "regardingobjectid" functionality

I've made a custom entity that will work as an data modification audit (any entity modified will trigger creating an instance of this entity). So far I have the plugin working fine (tracking old and new versions of properties changed).
I'd like to also keep track of what entity this is related to. At first I added a N:1 from DataHistory to Task (eg.) and I can indeed link back to the original task (via a "new_tasksid" attribute I added to DataHistory).
The problem is every entity I want to log will need a separate attribute id (and an additional entry in the form!)
Looking at how phone, task, etc utilize a "regardingobjectid", this is what I should do. Unfortunately, when I try to add a "dataobjectid" and map it to eg Task and PhoneCall, it complains (on the second save), that the reference needs to be unique. How does the CRM get around this and can I emulate it?
You could create your generic "dataobjectid" field, but make it a text field and store the guid of the object there. You would lose the native grids for looking at the audit records, and you wouldn't be able to join these entities through advanced find, fetch or query expressions, but if that's not important, then you can whip up an ASPX page that displays the audit logs for that record in whatever format you choose and avoid making new relationships for every entity you want to audit.
CRM has a special lookup type that can lookup to many entity types. That functionality isn't available to us customizers, unfortunately. Your best bet is to add each relationship that could be regarding and hide the lookups that aren't in use for this particular entity.

Resources