Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 521
  • Last Modified:

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

- 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
chonichon
Asked:
chonichon
  • 3
  • 2
1 Solution
 
Aftab_KhateebCommented:
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
 
chonichonAuthor Commented:
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
 
rakeshAgarwalCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
chonichonAuthor Commented:
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
 
rakeshAgarwalCommented:
yes that will be there  else you have to write a plugin that is non programitic way of doing things  :)

regards
rakesh
0
 
rakeshAgarwalCommented:
The above way is only non programitic way of achiving your solution  :)

rakesh
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now