Showing posts with label Relationship. Show all posts
Showing posts with label Relationship. Show all posts

Thursday, 5 March 2015

Can’t Mapping Campaign Response Fields to Lead in CRM

As we know that we can convert Campaign Response to create new lead easily.

image

Then it will open new Lead form which is you need to fill the completion, but it does some fields mapped by default, such as Subject, Company name, Last Name, etc.

But, the problem here, what if I want to copy other fields? Other new field, or even existing fields such as Promotion Code?

The first time, I was thinking about mapping, like what CRM did for the fields like Subject, CRM has existing mapping, but in fact, you cannot modify it by default.

It is connected by Related Campaign Response field.

image

image

As we can see, no Mapping could be edited here.

So, the second time I was thinking to use workflow.

I did create the workflow:

image

I want to copy Promotion Code from Campaign Response to Lead description.

image

I thought everything will be okay after I create this workflow.

So, I convert the Response to Lead.

But, in fact, after I convert it to Lead, I still have to Save first in order to make the workflow working, it’s different from CRM Opportunity to Quote that will automatically create the Quote directly, no matter what.

However, after I save it, the mapping still doesn’t work.

After I check the Log, it was because the Related Campaign Response field in the Lead was blank and did not get mapped at all.

image

I check the Advanced Find, no data for Lead with Related Campaign Response containing data.

Then, I try to put it to the Lead Form.

It turns out that this field is never been unlocked.

image

And it never have any value on it, so that I think it’s a flaw/bug that the Lead in fact has no relationship with the Response at all, what if we want to know, which Response is becoming the Lead original source?

I did try to unlock it using Business Rule, but no luck.

I have submitted to this Microsoft Connect.

https://connect.microsoft.com/dynamicssuggestions/feedback/details/1162506/related-campaign-response-field-is-not-mapped-when-converting-campaign-response-to-lead
Kindly you help me to vote it up.

So, I‘ve been thinking to use another workaround. I realized that I could edit mapping from Opportunity Product to Quote Product even though the mapping is not editable through OOB UI.

So here are my steps:

1. Get the Mapping ID

If you are using CRM 2015 you can try to get the mapping ID and follow this instruction:
http://inogic.com/blog/2012/12/add-mapping-for-custom-attribute-of-order-product-to-invoice-product/
http://www.stellarise.com/insight/mapping-custom-fields-on-the-opportunity-product-entity-to-the-quote-product-in-microsoft-dynamics-crm-2011/#.VPhdX_mUf0w

Or I can put the steps here:

*For CRM Online, you can obtain the mapping ID through:

To get the mapping Id you can hit this URL:
https://mycrmonlineorg.crm5.dynamics.com/XRMServices/2011/OrganizationData.svc/EntityMapSet?$select=EntityMapId&$filter=TargetEntityName eq ‘lead’ and SourceEntityName eq ‘campaignresponse’

So will get the mapping Guid.
SNAGHTML242ca89b

*For OnPremise, you can use above method or use this SQL query to get the mapping ID:

SELECT EntityMapId
FROM EntityMapBase
WHERE TargetEntityName='lead' AND SourceEntityName='campaignresponse'

So will get the Mapping Id

image

Now copy the ‘88F8FF60-DEC3-E311-9408-001CC4EECDD6’


And paste to this pattern of URL:

http://mycrmserver/Tools/SystemCustomization/Relationships/Mappings/mappingList.aspx?mappingId=<guid_of_the_mapping_id_you_get_from_previous_step>

Will become:

http://mycrmserver/Tools/SystemCustomization/Relationships/Mappings/mappingList.aspx?mappingId=88F8FF60-DEC3-E311-9408-001CC4EECDD6

SNAGHTML2425b567

Now, you can see the list of existing mapping.

Please, create new One.

I create new one for the Promotion Code Name.

*Remember for the Mapping, make sure that both fields are in the same date type, the target field should not have less length allowed compared to the source field, then for Option set make sure it is an Option Set, otherwise it will fail.

image

Then, to make sure, please Publish All Customizations.





But, the result..

image

Still I cannot get the Promotion Code to be mapped to the Lead.

I guess because there is no direct relationship because in the Lead we cannot get any related Campaign Response.

So that would be not working as well.

Overall, you cannot use Workflow for this mapping as well.

So the possibilities here:

1. Either customize the Convert ribbon, copy it and creating new one with your own dialog or control.

2. Create new relationship between Campaign Response and Lead then you create the new mappings, and you can create the Lead through subgrid or associated view

3. Utilize the mapped fields, such as Subject, First Name, Last Name, Description to get get the Campaign Response source and then use workflow or plugin or javascript to get fields from the original Campaign Response. You need to query to get the exact Campaign Response.

If you have any other suggestion, I will be so happy.

Thank you!

Monday, 10 November 2014

Field Mapping from Opportunity/Quote/Order/Invoice to Product Lines does not Work in CRM 2013

There are many case submitted in the forum telling that the mapping between the Header and Product Lines, for example: Quote to Quote Product or Order to Order Product does not work.

Even though you have set the mapping properly

image

And please don’t tell about custom field first, because for the standard fields, such as Ship Address field, the mapping is also not working.

After spending some hours to research and dig, apparently, I learned something, a behavior, if you use Editable subgrid, you will not be able to make the mapping working.

image

When you double click the record, you will never see the field mapping works right now.

Check these forum posts to know similar scenario..

So now, what I should do?

Basically, I have submitted this issue to Microsoft because those records are created as new record from the subgrid, even though it is not a standard subgrid appearing in the earlier version, CRM 2011, it is supposed to bring along the field from the parent record as well.

So check this link and I hope you would like to vote it as well Smile 
Resolution:

1. If you want to keep using this editable subgrid, then the best way is to wait Microsoft Team to fix this issue, it might be in next version or next rollup release. Basically, we are expecting this mapping behavior also works not only for old-style CRM 2011 subgrid, but it is also for CRM 2013 subgrid as well.

2. To make it works, you need to replace your editable subgrid to the standard subgrid, so the mapping will work well.

See this:
image

My objective here is to copy the Ship to Address field from Quote header to Quote Product.

So, I change the subgrid, I replace this to my own created subgrid..

image

Replace it will your own subgrid..

image

And here is after Ok, Save, and Publish.

image

And it will makes a new pop up dialog form to key in the Quote Product

image

And as you can see the mapping is working very well.

This is one of the best solution because by replacing this subgrid you are not only having this supposed Mapping behavior, but you can also customize the View, including criteria, sorting, and of course additional columns selection, which those are not possible in the editable subgrid, you cannot modify that view even though you just want to add one more column. But, the consequence, you will lose the editable subgrid capability that firs introduced in CRM 2013.

3. I tried using OOB Workflow, but no luck, so if you have enough programming skills and of course enough time, what you can do is using a plugin or custom workflow activity to retrieve the value from the parent and copy it in to the product line in detail.

4. You can also using form scripting execute during onLoad to have an auto pre-filled fields copy from the Parent record field values.

Kindly, I hope this post can help you, especially for those, who are still blur or confused and still wondering find why and what happened with my Mapping, “I know I created properly, but what happened”?

Thank you.

Sunday, 9 November 2014

Filter Lookup Field by Related Subgrid Records in CRM

Sometimes we have requirement to choose lookup field value from the records that are listed in the related subgrid and we need to validate it so that the users won’t choose wrongly.

Let’s start with the example first.

You have lookup field in the Lead entity and you have a subgrid to list all of related Contractors.
Now, you have requirement to let the users to choose Primary Contractors from that list and validate it same as CRM did for selecting Primary Contact in the Account entity.

image

image

And if Look Up More Records

image

Yes, you can build a custom view or custom filter in the Lookup field, but is that too overkill? And let’s say you don’t have enough time or scripting skills so, what should you do?

In this post I am explaining about how to Filter a lookup field to show only records listed in the Related subgrid records.

I will use customized Case as another scenario with same concept with my first example and also same concept with Primary Contact in the Account entity.

Scenario: When you will need this circumstance?

In a Case entity, I have customized to be a Job Sheet Case for Spare Part Service Industry purposes and I have a subgrid to list all of the Case’s related Product Parts that want to be repaired as reparation service..
Now user A will have task to list all of the Parts.

image

Case and Product Parts are having N:N Relationship.

And I have a lookup to choose what is the Main Part that having major issue.

My client wants another user or the user himself to choose the Main Part with most major issue to choose and the system has to validate only to show the part from the available list, not another part, this is for analysis and escalation to next level purposes.

image

So..What can I do?

I know I can have a customer filtered lookup using javascript, but in fact CRM has capability to achieve this requirement without any custom code.

Resolution

1. Go to the Form Editor

2. Double click the lookup field to go to Field Property

3. Edit this property

Tick the ‘Only show records where:’

image

And to be safe, don’t allow users to turn off filter

4. You can also modify this additional property to manage the View

image

It will show when you click the Lookup in inline lookup and as well in the lookup more records.

To know more about the inline lookup, you can refer to this post:

5. As usual, Ok, Save, and Publish it.

Result:

Inline Lookup

*Before:
image

*After:
image

Lookup More Records..

*Before
image

*After
image

http://missdynamicscrm.blogspot.com/2014/09/crm-2013-modify-columns-shown-in-inline-lookup.html

Term and Condition

This is only works if the current entity and the entity records you want to filter are having relationship, either 1:N or N:N relationship.

Additional Info

So, now you know that without any custom code you can filter lookup to show only records from related entity without any custom code.

In my previous post, I have explained about how to filter lookup field by linked entity (only for N:1 relationship or Parent entity, for example relationship between Case and Account) fields as criteria.

In this post, we know how to filter lookup field by linked entity that having 1:N from this current entity record, no need any custom code. Even, filter lookup by related child records is easier.

So, those are tips and tricks to filter a lookup, choose your way to experience happy CRM-ing.

I hope this post can help you!
Thank you.

Sunday, 12 October 2014

CRM 2013 Subgrid vs. (Expanded) Associated View Records

Have you ever experienced when you have subgrid in your CRM Form, but when you click the ‘expand’ button to expand the view then it will redirect you to Associated View, but you found the records appear in the list are different?

If yes, then you might need to read this post.

If not, then you could read this post as well just in case you encounter this issue in the future.

To more detailed info about the real situation in practice, you can check this forum post:


and


When you put the sub grid into the form and you put the Associated view in the Left Navigation area during customization in Form Editor, you can see the subgrid records and you can open to expand the view.

image

*I have 2 records

Then, you realize that your associated view does not have the same list


* I can only see 1 record, where is the other record?

Okay, let’s go to the Root of Cause.

1. When you place a subgrid in the parent entity form, you will choose the view, right? Is that the records from related record or not and also what view you use.

For example, you choose ‘Recent Opportunities’ and ‘Only Related Records’.

You want to display Opportunities from Account.


2. If you found the issue I mentioned in the very beginning, then you might check the relationships.

In fact, you have more than 1 relationship.


3. So, what’s about? I have 2 relationship, so what?

Okay, now imagine that in the Opportunity perspective, you will have 2 fields.

- Account from relationship number 1 (hereafter will called as Account A)
- Account from relationship number 2 (hereafter will called as Account B)

For the records that you created from subgrid or associated view (quick create form as well) anything you create and then you choose from Account ABC for example, it will auto populate Account A and Account B set to ABC, because the mapping will work for record created from parent entity (it is how CRM relationship mapping takes role as behavior) and CRM does not know which relationship will be auto-filled, relationship #1 or relationship #2, so that CRM auto-populate both of those Account fields.

However, it won’t work for those records which created from outside of the parent subgrid or associated view, and won’t work for update or for existing record, it will work only for new record created.

*So, for example you create a new Opportunity, then you set the lookup field on Account A to ABC and Account B to XYZ, yes, it is possible. (remember this statement)
4. From the last statement in number 3, I mentioned about the lookup fields that can be different even though comes from same entity, Account.

This is very clear that the related records in the view of Account ABC and Account XYZ perspectives will return different related opportunities records.

If you go to Account ABC based on the relationship number #1 vs. relationship number #2, you will get different opportunity records.

See this table as reference:

Opportunity Account A Account B
Opp1 ABC XYZ
Opp2 ABC XYZ
Opp3 ABC ABC
Opp4 XYZ XYZ
Opp5 XYZ ABC

So, now you are in Account ABC from the relationship #1, you will get 3 opportunity records, otherwise from relationship #2, you will get 2 opportunity records only.

5. Now what happened if you found the subgrid and (expanded) Associated View are showing different result.

Basically, in the subgrid, it will show all of the Recent Opportunity records related to Account ABC based on your selected view (you can choose the view based on which relationship)

Then, in your CRM you have 2 relationships Account – Opportunity and you put a subgrid plus 2 associated view:


I found that if you don’t have any Associated View listed in the navigation area, it will not allow you to click the ‘Expand’ button to go to expanded Associated View, this is the key of the investigation.
6. Okay, then when you click the ‘expand’ image button, it will open the Associated View and now you have 2 Associated Views, CRM will not ask you which one you want to go, relationship #1 or relationship #2? In fact, CRM will redirect you to one of the associated view by default.

7. So, for example you put the subgrid based on the relationship #1, it will return you 3 Opportunities,

image

but when you click the expanded view, it is possible will show you different result.
It is possible to show you only 2 records from relationship #2 (Opp3 and Opp5)

image

8. Okay, I am done with the explanation, let’s back to the root of cause and the solution.
The main reason behind this behavior is you have more than 1 Associated View and CRM can redirect you to different Associated View, not exactly redirect you to the View based on the subgrid you have.

CRM will redirect you to the Associated View by Order or in Sequence.

Solution:

1. If you think the relationship #2 is not important (since you put relationship #1 as the view in the subgrid), you can just remove the Associated View.

2. If you think solution number #1 is not appropriate, you can try another proper solution, you can just re-order the order of the associated view, for example you swap the position.



I found this similar question in some posts and I hope it can help you!

Thank you.