Answered by:
CRM Live - JScript to pull data from Account field to Opportunity field?

Question
-
Hi all,
I'm trying to find the best way to pull data from a field on an Account record, to an Opportunity record.
I don't understand Soap and Webservice.
Would something like this work (as OnLoad in my Opportunity)?
If not, is there a way to correct the code so that it does grab the correct value?
var lookupItem = new Array;
lookupItem = crmForm.all.customerid.DataValue;alert(lookupItem[0].id.crmForm.all.websiteurl.DataValue);
Thanks! -mattTuesday, March 10, 2009 6:32 PM
Answers
-
Matt -
did this solve your question? - Mapping the attributes would certainly be the easiest method.
I found this earlier, but didn't think of it when I was answering your question - it does access the webservice, but it could be easily 'tweaked' to fit your needs even if you wouldn't feel comfortable writing this from scratch.
Here it is - Jim Wang posted this excellent script that will allow you to grab values from a parent entity.
http://jianwang.blogspot.com/2008/12/crm-40-get-attribute-value-from-entitys.html
Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell- Proposed as answer by Scott Sewell, Hitachi SolutionsModerator Tuesday, March 24, 2009 9:34 PM
- Marked as answer by darrenliuMicrosoft employee, Moderator Wednesday, March 25, 2009 6:24 PM
Tuesday, March 24, 2009 9:34 PMModerator
All replies
-
is this something you only need populated when you create an opportunity from an account record? - if so, there is an easier way - go into settings, customization and modify the mapping that exists on the relationship between an account and an opportunity.
Once added and published, when you create an opportunity from an account record, the mapped information will be populated in the opportunity. (much like a company's address is mapped to any new contact created off that company record.)
If it's something that needs to be done real-time or on an on-going basis, you will need to follow the more involved code route you're already looking at.
Scott Sewell CustomerEffective.com- Proposed as answer by Scott Sewell, Hitachi SolutionsModerator Wednesday, March 11, 2009 2:36 PM
Tuesday, March 10, 2009 7:13 PMModerator -
Matt -
did this solve your question? - Mapping the attributes would certainly be the easiest method.
I found this earlier, but didn't think of it when I was answering your question - it does access the webservice, but it could be easily 'tweaked' to fit your needs even if you wouldn't feel comfortable writing this from scratch.
Here it is - Jim Wang posted this excellent script that will allow you to grab values from a parent entity.
http://jianwang.blogspot.com/2008/12/crm-40-get-attribute-value-from-entitys.html
Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell- Proposed as answer by Scott Sewell, Hitachi SolutionsModerator Tuesday, March 24, 2009 9:34 PM
- Marked as answer by darrenliuMicrosoft employee, Moderator Wednesday, March 25, 2009 6:24 PM
Tuesday, March 24, 2009 9:34 PMModerator