Answered by:
Set Regarding Field on an Appointment

Question
-
Scenario - User will schedule a new appointment on a contact. When new appointment form is opened the default is that the rearding and the required be filled with the contact. I want to change the regarding field to the contact's parent company. I'll eventually use a SOAP message, but for right now I'm just trying to figure out how to set the Regarding field to something else so I'm using hard coded data. I currently have the following, although I have tried many variations of this:
crmForm.all.regardingobjectid = {2E45C135-A1E0-DF11-9545-00219B955415};
Any help would be great!
I'm using CRM 4.0 rollup 11.
-JP
Monday, April 16, 2012 3:10 PM
Answers
-
Hi,
regardingobjectid is a lookup type, and you can set it easily using below javascript
Here is code from SDK
//Create an array to set as the DataValue for the lookup control. var lookupData = new Array(); //Create an Object add to the array. var lookupItem= new Object(); //Set the id, typename, and name properties to the object. lookupItem.id = '{1AAC1363-01A1-DB11-8432-0003FF9CE217}'; lookupItem.typename = 'account'; lookupItem.name = 'A Bike Store'; // Add the object to the array. lookupData[0] = lookupItem; // Set the value of the lookup field to the value of the array. crmForm.all.parentaccountid.DataValue = lookupData;
change field name and id value accordinglyMahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- Proposed as answer by HIMBAPModerator Monday, April 16, 2012 3:22 PM
- Marked as answer by lifeIsPunny Monday, April 16, 2012 4:09 PM
Monday, April 16, 2012 3:19 PMModerator
All replies
-
Hi,
regardingobjectid is a lookup type, and you can set it easily using below javascript
Here is code from SDK
//Create an array to set as the DataValue for the lookup control. var lookupData = new Array(); //Create an Object add to the array. var lookupItem= new Object(); //Set the id, typename, and name properties to the object. lookupItem.id = '{1AAC1363-01A1-DB11-8432-0003FF9CE217}'; lookupItem.typename = 'account'; lookupItem.name = 'A Bike Store'; // Add the object to the array. lookupData[0] = lookupItem; // Set the value of the lookup field to the value of the array. crmForm.all.parentaccountid.DataValue = lookupData;
change field name and id value accordinglyMahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- Proposed as answer by HIMBAPModerator Monday, April 16, 2012 3:22 PM
- Marked as answer by lifeIsPunny Monday, April 16, 2012 4:09 PM
Monday, April 16, 2012 3:19 PMModerator -
Oh - so you have to set all the attributes? You can't just set the id and leave it at that?Monday, April 16, 2012 3:54 PM
-
I just answered my own question by trying it - Thanks for the information!!!Monday, April 16, 2012 4:09 PM