Solved

Dynamics CRM 4.0: How can I copy the display associated name of a selected lookup value in a textbox in the form?

Posted on 2009-06-29
6
510 Views
Last Modified: 2013-11-19
- My lookup field is called:   new_alternateid
- My associate field to the new_alternateid is called:    new_euorganization
- My text field in the form is called:       new_text

What I want to do is to select one 'new_alternateid' from the lookup and insert in the field 'new_text' the value of the 'new_euorganization' associated to the 'new_aternateid'.
I'm trying with
if (crmForm.all.new_alternateid.DataValue != null) {
    crmForm.all.new_text.DataValue = crmForm.all.new_alternateid.DataValue[0].new_euorganization;
}
and....DOES NOT WORK.

I have other lookup field that show me the full name of a contact (this is other example that I cannot solve), and I want to recover from the lookup field, the first name and the last name, but in separate fields.... I only can recover the fullname and I do not understand why!!
Thanks in advance for your help.

0
Comment
Question by:chonichon
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:Aftab_Khateeb
ID: 24742328
The below logic assigns the alternateid name to the text box new_text.

if (crmForm.all.new_alternateid.DataValue == null) {
    crmForm.all.new_text.DataValue = null;
}

else {
    crmForm.all.new_text.DataValue = crmForm.all.new_alternateid.DataValue[0].name;
}

I am quite not getting what you mean by associate field, is new_euorganization also a text field in the form?..

For your second query, make sure the contact lookup view has firstname and lastname fields in the view. If it is you could fetch them individually
0
 

Author Comment

by:chonichon
ID: 24742943
In the first case, the new_euorganization is included in the alternateid lookup view with other fields...
And in the second case I also have inlcuded the first name and last name in the lookup view. But how is it possible to recover one or more fields from the lookup view??

With your solution I only can recover the alternateis but not other fields....
And with my other problem is the same, I can recover the fullname but not the first and last name in separate fields......

Many thanks for your help.
0
 
LVL 11

Expert Comment

by:rakeshAgarwal
ID: 24743192
I think what you want to is

You have  entity called new_alternate (or whatever)  you have created a lookup  by relating this entity and entity in the problem

now you want  one of  the attribute of entity  new_alternate to be put on the entity in the problem

is it correct
 


just try this out

1. create a workflow  on the entity in the issue
2. on update of new_alternateid
3. update record  select entity in the problem
4. click on properties
5. select the text field you need to update
6.  select the entiy

regards
Rakesh Agarwal

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:chonichon
ID: 24743596
OK, I've created the Workflow and it works.... but I've to refresh 'manually'  several times before seeing in the screen the changes.
Any idea?
0
 
LVL 11

Expert Comment

by:rakeshAgarwal
ID: 24744000
yes that will be there  else you have to write a plugin that is non programitic way of doing things  :)

regards
rakesh
0
 
LVL 11

Accepted Solution

by:
rakeshAgarwal earned 500 total points
ID: 24744004
The above way is only non programitic way of achiving your solution  :)

rakesh
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
The viewer will learn how to dynamically set the form action using jQuery.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now