jump to navigation

Setting a default value on a lookup field in Microsoft Dynamics CRM 2011 May 23, 2011

Posted by jarrettexpertcrm in Microsoft CRM General.
Tags: , , , , , , , , , , , , , , ,
7 comments


In previous a post i posted how to default a value on a lookup field in 4.0. Here is the solution for CRM 2011
function priceList()
{
//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 = ‘{27457CD-3C7C-E011-8E52-1CC1DE7983EB%257d}’;
lookupItem.typename = ‘pricelevel’;
lookupItem.name = ‘test’;
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
Xrm.Page.getAttribute(“pricelevelid”).setValue(lookupData);
}

In my example i am getting the pricelist “test” and defaulting it in the pricelist field on the Opportunity entity. Below is the template you can use to utilize the code for a different look up and values.
function priceList()
{
//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 = ‘{Fields Guid}’;
lookupItem.typename = ‘Entity Name’;
lookupItem.name = Lookup Value;
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
Xrm.Page.getAttribute(“FieldName”).setValue(lookupData);

}

Enjoy!!

For more information about Dynamics Four you can contact us at http://www.dynamics4.com

Advertisements

Microsoft Dynamics CRM 2011 Show Originating Lead Notes After Converting May 1, 2011

Posted by jarrettexpertcrm in Microsoft CRM General.
Tags: , , , , , , , , ,
5 comments


In a previous post i showed how to display originating leads notes in an iframe after converting. In Microsoft CRM 2011 that code no longer works. Here is the updated code.
function originatingLeadNotes()
{
var Parent = Xrm.Page.data.entity.attributes.get(“originatingleadid”);
var IFrame = Xrm.Page.ui.controls.get(“IFRAME_originatingLeadNotes”);

if (Parent.getValue() != null) {

var GUIDvalue = Parent.getValue()[0].id;

IFrame.setSrc(“/_controls/notes/notesdata.aspx?id=”+ GUIDvalue + ” &ParentEntity=3&EnableInlineEdit=false&EnableInsert=false”);
}
else
{
IFrame.setSrc(“about:blank”);
}

}

Enjoy!
-JC

For more information about Dynamics Four or to contact us please visit http://www.dynamics4.com

Microsoft Dynamics CRM 4.0 / 2011 Tech Tuesdays and Webinars January 11, 2011

Posted by jarrettexpertcrm in Microsoft CRM General, Uncategorized.
Tags: , , , , , , , , , , , ,
1 comment so far

CRM 2011 Preview – the Power of Productivity.
Join this free webinar to learn more about the newest release of Microsoft Dynamics CRM.
Sessions are held on the 2nd Thursday of each month.

Tech Tuesdays – Get practical answers and proven solutions from the CRM experts. Dynamics Four offers a free one session designed to explore new concepts, capabilities, and general discussion covering the sales, marketing, and service modules within Dynamics CRM. Sessions are held on the 2nd Tuesday of each month.

http://www.clicktoattend.com/?id=153046 This is link to sign up for Tech Tuesday

http://www.clicktoattend.com/?id=153074 – Link to sign up for CRM2011 preview

Enjoy!

-JC

For more information about Dynamics Four or to contact us please visit http://www.dynamics4.com

Microsoft Dynamics CRM 2011 Edit Site Map September 27, 2010

Posted by jarrettexpertcrm in Microsoft CRM General.
Tags: , , , , , , , , , , ,
2 comments

For those that are exploring the new beta CRM 2011 know that a lot has changed. One of the things I wanted to play around with was Site Map editing to see what was different from CRM 4.0. CRM 2011 now has a new feature called “Solutions” which pretty much took over the role of import/export customizations in 4.0. My first efforts were to create a “Solution” and add the Site Map client extension to it. Then, export the Solution, unzip the folder, open Site Map in notepad, make changes, and import back in. Failed. Hmmm ok, let me try and import the original zipped export i did. Success. Ok so basically I could import the original zip file just not one I unzipped. So then i right clicked on zipped folder, selected open with Winzip, modified the sitemap, save and close. Imported successfully. Basically what I see is it needed the orginal export, not a duplicate copy. Im sure there are multiple other ways of doing this so please post to this with other options.

Hope this helps!
– JC

For more information about Dynamics Four or to contact us please visit http://www.dynamics4.com

Microsoft Dynamics CRM 2011 September 14, 2010

Posted by jarrettexpertcrm in Microsoft CRM General.
Tags: , , , , , , , , ,
2 comments

For those that are interested in what CRM 5.0 looks like, here are some screen shots.









As you can see a lot has changed. CRM 2011 has a ton of new features that i will be showing in an upcoming video.

For more information about Dynamics Four or to contact us please visit http://www.dynamics4.com

Microsoft Dynamics CRM 4.0 Accessing Parent Form July 28, 2010

Posted by jarrettexpertcrm in Microsoft CRM General.
Tags: , , , , , , , , , ,
add a comment


In some cases you made need to have a code fire based on information from the parent form of that entity. For example, lets say you have a checkbox on the Order form that has values “Approved” and “Unapproved”. You need to have the Product lookup field disabled on the Order Product entity if the value “Unapproved” is checked. This is just an example, there are many other scenarios where this might come in handy. Place this code onload of the child entity.

if (
(window.opener != null) &&
(window.opener.parent != null) &&
(window.opener.parent.document != null) &&
(window.opener.parent.document.crmForm != null)) {

var parentForm = window.opener.parent.document.crmForm;
var formType;

switch(parentForm.FormType)
{

case 1:
formType = “Create Form”;
break;

case 2:
formType = “Update Form”;
break;

case 3:
formType = “Read Only Form”;
break;

case 4:
formType = “Disabled Form”;
break;

case 5:
formType = “Quick Create Form”;
break;

case 6:
formType = “Bulk Edit Form”;
break;

default:
formType = “Undefined Form Type”;
break;
}

if (parentForm.ObjectTypeName == “PARENTENTITY”)
{

if(parentForm.all.FIELD.DataValue == VALUE)

{
//PLACE FUNCTION FOR CHILD ENTITY HERE

}

}
}

Enjoy!

For more information about Dynamics Four or to contact us please visit http://www.dynamics4.com

Microsoft Dynamics CRM 4.0 Setting field requirement level with jscript July 23, 2010

Posted by jarrettexpertcrm in Microsoft CRM General.
Tags: , , , , , , , , , ,
add a comment


Sometimes it is necessary to change a field’s requirement level after the action of something else. Lets say you have a picklist called Contact Method, and one of those values is “email”. Once the user selects email, you want the email field to now become a required field so he/she doesn’t accidentally forget to put in the email address. However, the user may select the value “phone”. You then wouldn’t want the email address to be required because its not applicable, the phone field is what you want required. The point is, you need the field to become required when a particular value is selected, not all the time. Place this line of code onchange of the field you want to trigger it. Replace “fieldname” with the name of your field you want to set the requirement level on.

crmForm.SetFieldReqLevel(“fieldname”, 1);

Enjoy!

For more information about Dynamics Four or to contact us please visit http://www.dynamics4.com

Microsoft Dynamics CRM 4.0 Hiding taskbar buttons July 22, 2010

Posted by jarrettexpertcrm in Microsoft CRM General.
Tags: , , , , , , , , , , , ,
5 comments

In many occasions you may need to hide a task bar button on a form, lucky for you i’m going to show you how. Im also going to show those of you that do not know how to use the developer tool bar to grab the name of the button you are wanting to hide. In this example i am going to hide the “Create Invoice” button on the Order.  First open an exsisting order and press ctrl N. You now have the option to go to your developer tool bar. Upper right hand corner click tools, then developer tool bar.

 Once the dev toolbar has finished loading go to find, select element by click. Put your mouse over the button you want to hide, you will notice a blue outline over the button. Click that button and the properties of that button come up on your dev toolbar. Look for you button and you will see the ID for it.  You can hide the button in many different scenarios but for a simple example i am just going to hide it when the form loads. Place the following code onload.

var CreateInvBtn=document.getElementById(‘_MBprocessOrder’);
if(CreateInvBtn!=null)
            CreateInvBtn.style.display=’none’;

_MBprocessOrder is the ID of the button i am hiding in this example, for those that are hiding a different button replace that with your button ID. When you want to have the button show again use the following code:

var CreateInvBtn=document.getElementById(‘_MBprocessOrder’);
if(CreateInvBtn!=null)
            CreateInvBtn.style.display=’inline’;

Enjoy!

For more information about Dynamics Four or to contact us please visit http://www.dynamics4.com

Microsoft Dynamics CRM 4.0 disabling all fields on a tab July 14, 2010

Posted by jarrettexpertcrm in Microsoft CRM General.
Tags: , , , , , , , , , ,
add a comment

Ever need to disable all fields on a tab not just one or two? Want to know a quick way of doing it instead of crmForm.all.field.disabled = true; for every field? Of coarse you have or you wouldn’t be here :).

Onload

function disableTab(tabIndex)
{
var tab = document.all[“tab” + tabIndex];
for (var i = 0; i < tab.all.length; i++) {
if (tab.all[i].Disabled !== undefined) {
tab.all[i].Disabled = true;
}
}
}
disableTab(2);

Just replace the “2” in disableTab(2) with the proper tab number

Hope this helps!

For more information about Dynamics Four or to contact us please visit http://dynamics4.com

Microsoft Dynamics CRM 4.0 Primary Contact Filter July 14, 2010

Posted by jarrettexpertcrm in Microsoft CRM General.
Tags: , , , , , , , , , ,
add a comment

I have received quite a few requests to have primary contact on accounts, when clicked, only show the contacts for that particular account. For those that may already have some sort of look up filter in place they may have experienced this problem, and for those that don’t, well here is a solution that will work. When in an account with a “&” in the name, you click primary contact and you receive an error. Here is a fix for that.

Account Onload:

if (crmForm.FormType == 2 && crmForm.ObjectId != null)
{
var name = crmForm.all.name.DataValue;
crmForm.all.primarycontactid.additionalparams =  ‘search=’ + name.replace(“&”,”%26″).replace(“+”,”%2b”);
}
Hope this helps!
For more information about Dynamics Four or to contact us please visit http://www.dynamics4.com