Link to home
Start Free TrialLog in
Avatar of logicsolutions
logicsolutionsFlag for Australia

asked on

Dynamics CRM 4.0: Copy Redarding Drop Down List value to Subject Field

Hi Experts,

I know I have to add an onchange value to the regardingobjectid field in order to get it to auto populate the Subject field for me. I am trying to get the subject field to auto populate the exact value or string which appears on the regardingobjectid field.

Example: If I choose an Account 'ABC Pty Ltd' in the regarding list of the Phone Call Activity form I would like it to write 'ABC Pty Ltd in the subject field automatically. It will save our guys having to re-write the Regarding field into the subject field.

I have tried: 'crmForm.all.subject.DataValue' = 'crmForm.all.regardingobjectid.DataValue';

but I received an error. The  complete code for the solution would be great as I don't have alot of javascript skills.

Many Thanks.
Avatar of crm_info
crm_info
Flag of United States of America image

Getting a value out of a lookup field is not quite as simple as getting the value out of another field on a form.  The full code (possibly requiring some name changes) is below.
crmForm.all.subject.DataValue = crmForm.all.regardingobjectid.DataValue[0].name;

Open in new window

Avatar of logicsolutions

ASKER

WOW. Exactly what I needed. Just for the iceing on the cake how do I get it to add a colun (:) symbol on the end. i.e. If ABC Pty Ltd is selected from the list it will automatically put 'ABC Pty Ltd:' in the subject field.

Many Thanks CRM info.
crmForm.all.subject.DataValue = crmForm.all.regardingobjectid.DataValue[0].name & ":";
Hi CRM info,

It says 'The Control only accepts strings or nulls as an input' after using the following:

crmForm.all.subject.DataValue = crmForm.all.regardingobjectid.DataValue[0].name & ":";

Big Thanks,
ASKER CERTIFIED SOLUTION
Avatar of crm_info
crm_info
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect Solution. God bless your work.