Asked by:
Get date from lookup and add to another field

Question
-
I have a form which has a lookup to another entity which has a date associated with its records
When I select one of the records in the lookup I want to send the date from the selected record to another field on my current form.
Anyone any ideas how best to do this?
Monday, January 5, 2015 2:49 PM
All replies
-
You can write Java Script function, which will call On Change of the Lookup Field.
For that you need to get the ID of the LookUp field and then retrieve the Date Field by filtering through the Lookup Id.
Now, You have the Date field, So you can set it on the current form.
Hope this will help you.
Thanks
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.
Monday, January 5, 2015 3:02 PM -
Thanks for the reply Kamal but I have already done this and am having problems as the code seems to work fully on some users pc's but not on others pc's. All pc's have IE on them but some have different browser versions.
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blogMonday, January 5, 2015 8:07 PMModerator -
Defining attribute mapping between source and target entity should help.
More information on Attribute mapping:
Tuesday, January 6, 2015 5:37 AM -
1. I'm pretty sure that entity with schema name "meeting" doesn't exist in CRM as well as fields like meetingdate, relatedmeeting e.t.c. So please double check that.
2. I would suggest you not to use Fetch and Soap Queries in this case. It would be definitely easier for you to use OData. Recheck following articles regarding fetching of a data using OData endpoint:
http://msdn.microsoft.com/en-us/library/gg334427.aspx
http://msdn.microsoft.com/en-us/library/gg309549.aspx
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blogTuesday, January 6, 2015 9:44 AMModerator -
In case you have custom entities I'm pretty sure that names should be something like new_meeting, new_meetingdata e.t.c. Following article describes difference between Display Name and Logical or Schema name - http://msdn.microsoft.com/en-us/library/bb928426.aspx It was writte for CRM 4.0 but general ideas remained the same.
Articles provided in my previous reply are applicable for CRM 2011, 2013, 2015.
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blogTuesday, January 6, 2015 10:13 AMModerator -
Recheck following articles:
http://guruprasadcrm.blogspot.com/2011/02/using-odata-to-retrieve-data-from.html
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blogTuesday, January 6, 2015 10:54 AMModerator -
Hi,
The problem you are having with multi browser compatibility is because you are using IE specific code in your JS. Try using the SDK JS library provided for a synchronous retrieve and cater to different kind of browsers by including if else statements.
Also if you are not bothered about showing the date from the other entity as soon as you leave the field you can always use the a custom workflow or a plugin to populate the date field.
I hope it helps.
Tuesday, January 6, 2015 11:18 AM