//Call bellow Function as HideField( "Feild Name", true);
function HideField( fieldName, removeEntireRow )
{
var elem = crmForm.all[fieldName + "_c"];
if( elem != null ) elem.style.display = "none";
elem = crmForm.all[fieldName + "_d"];
if( elem != null ) elem.style.display = "none";
if (removeEntireRow)
{
var elem = crmForm.all[fieldName + "_d"];
if( elem != null ) elem.parentElement.style.display = "none";
}
}
Wednesday, April 20, 2011
CRM 2011 - Hide Form Feilds And Rows Using Java Sript
Tuesday, April 19, 2011
Validate Credit Card Types
function ValidateType(cardNumber ,cardType) {
if (checkCreditCard(cardNumber, cardType.split(' ').join(''))) {
alert("Credit card has a valid format")
}
else { alert(ccErrors[ccErrorNo]) };
} else {
alert("Card Type Not Valied");
}
var ccErrorNo = 0;
var ccErrors = new Array()
ccErrors[0] = "Unknown card type";
ccErrors[1] = "No card number provided";
ccErrors[2] = "Credit card number is in invalid format";
ccErrors[3] = "Credit card number is invalid";
ccErrors[4] = "Credit card number has an inappropriate number of digits";
function checkCreditCard(cardnumber, cardname) {
// Array to hold the permitted card characteristics
var cards = new Array();
// Define the cards we support. You may add addtional card types as follows.
// Name: As in the selection box of the form - must be same as user's
// Length: List of possible valid lengths of the card number for the card
// prefixes: List of possible prefixes for the card
// checkdigit: Boolean to say whether there is a check digit
cards[0] = { name: "Visa",
length: "13,16",
prefixes: "4",
checkdigit: true
};
cards[1] = { name: "MasterCard",
length: "16",
prefixes: "51,52,53,54,55",
checkdigit: true
};
cards[2] = { name: "DinersClub",
length: "14,16",
prefixes: "305,36,38,54,55",
checkdigit: true
};
cards[3] = { name: "CarteBlanche",
length: "14",
prefixes: "300,301,302,303,304,305",
checkdigit: true
};
cards[4] = { name: "AMERICANEXPRESS",
length: "15",
prefixes: "34,37",
checkdigit: true
};
cards[5] = { name: "Discover",
length: "16",
prefixes: "6011,622,64,65",
checkdigit: true
};
cards[6] = { name: "JCB",
length: "16",
prefixes: "35",
checkdigit: true
};
cards[7] = { name: "enRoute",
length: "15",
prefixes: "2014,2149",
checkdigit: true
};
cards[8] = { name: "Solo",
length: "16,18,19",
prefixes: "6334,6767",
checkdigit: true
};
cards[9] = { name: "Switch",
length: "16,18,19",
prefixes: "4903,4905,4911,4936,564182,633110,6333,6759",
checkdigit: true
};
cards[10] = { name: "Maestro",
length: "12,13,14,15,16,18,19",
prefixes: "5018,5020,5038,6304,6759,6761",
checkdigit: true
};
cards[11] = { name: "VisaElectron",
length: "16",
prefixes: "417500,4917,4913,4508,4844",
checkdigit: true
};
cards[12] = { name: "Laser",
length: "16,17,18,19",
prefixes: "6304,6706,6771,6709",
checkdigit: true
};
// Establish card type
var cardType = -1;
for (var i = 0; i < cards.length; i++) {
// See if it is this card (ignoring the case of the string)
if (cardname.toLowerCase() == cards[i].name.toLowerCase()) {
cardType = i;
break;
}
}
// If card type not found, report an error
if (cardType == -1) {
ccErrorNo = 0;
return false;
}
// Ensure that the user has provided a credit card number
if (cardnumber.length == 0) {
ccErrorNo = 1;
return false;
}
// Now remove any spaces from the credit card number
cardnumber = cardnumber.replace(/\s/g, "");
// Check that the number is numeric
var cardNo = cardnumber
var cardexp = /^[0-9]{13,19}$/;
if (!cardexp.exec(cardNo)) {
ccErrorNo = 2;
return false;
}
// Now check the modulus 10 check digit - if required
if (cards[cardType].checkdigit) {
var checksum = 0; // running checksum total
var mychar = ""; // next char to process
var j = 1; // takes value of 1 or 2
// Process each digit one by one starting at the right
var calc;
for (i = cardNo.length - 1; i >= 0; i--) {
// Extract the next digit and multiply by 1 or 2 on alternative digits.
calc = Number(cardNo.charAt(i)) * j;
// If the result is in two digits add 1 to the checksum total
if (calc > 9) {
checksum = checksum + 1;
calc = calc - 10;
}
// Add the units element to the checksum total
checksum = checksum + calc;
// Switch the value of j
if (j == 1) { j = 2 } else { j = 1 };
}
// All done - if checksum is divisible by 10, it is a valid modulus 10.
// If not, report an error.
if (checksum % 10 != 0) {
ccErrorNo = 3;
return false;
}
}
// The following are the card-specific checks we undertake.
var LengthValid = false;
var PrefixValid = false;
var undefined;
var prefix = new Array();
var lengths = new Array();
// Load an array with the valid prefixes for this card
prefix = cards[cardType].prefixes.split(",");
// Now see if any of them match what we have in the card number
for (i = 0; i < prefix.length; i++) {
var exp = new RegExp("^" + prefix[i]);
if (exp.test(cardNo)) PrefixValid = true;
}
// If it isn't a valid prefix there's no point at looking at the length
if (!PrefixValid) {
ccErrorNo = 3;
return false;
}
// See if the length is valid for this card
lengths = cards[cardType].length.split(",");
for (j = 0; j < lengths.length; j++) {
if (cardNo.length == lengths[j]) LengthValid = true;
}
if (!LengthValid) {
ccErrorNo = 4;
return false;
};
return true;
}
if (checkCreditCard(cardNumber, cardType.split(' ').join(''))) {
alert("Credit card has a valid format")
}
else { alert(ccErrors[ccErrorNo]) };
} else {
alert("Card Type Not Valied");
}
var ccErrorNo = 0;
var ccErrors = new Array()
ccErrors[0] = "Unknown card type";
ccErrors[1] = "No card number provided";
ccErrors[2] = "Credit card number is in invalid format";
ccErrors[3] = "Credit card number is invalid";
ccErrors[4] = "Credit card number has an inappropriate number of digits";
function checkCreditCard(cardnumber, cardname) {
// Array to hold the permitted card characteristics
var cards = new Array();
// Define the cards we support. You may add addtional card types as follows.
// Name: As in the selection box of the form - must be same as user's
// Length: List of possible valid lengths of the card number for the card
// prefixes: List of possible prefixes for the card
// checkdigit: Boolean to say whether there is a check digit
cards[0] = { name: "Visa",
length: "13,16",
prefixes: "4",
checkdigit: true
};
cards[1] = { name: "MasterCard",
length: "16",
prefixes: "51,52,53,54,55",
checkdigit: true
};
cards[2] = { name: "DinersClub",
length: "14,16",
prefixes: "305,36,38,54,55",
checkdigit: true
};
cards[3] = { name: "CarteBlanche",
length: "14",
prefixes: "300,301,302,303,304,305",
checkdigit: true
};
cards[4] = { name: "AMERICANEXPRESS",
length: "15",
prefixes: "34,37",
checkdigit: true
};
cards[5] = { name: "Discover",
length: "16",
prefixes: "6011,622,64,65",
checkdigit: true
};
cards[6] = { name: "JCB",
length: "16",
prefixes: "35",
checkdigit: true
};
cards[7] = { name: "enRoute",
length: "15",
prefixes: "2014,2149",
checkdigit: true
};
cards[8] = { name: "Solo",
length: "16,18,19",
prefixes: "6334,6767",
checkdigit: true
};
cards[9] = { name: "Switch",
length: "16,18,19",
prefixes: "4903,4905,4911,4936,564182,633110,6333,6759",
checkdigit: true
};
cards[10] = { name: "Maestro",
length: "12,13,14,15,16,18,19",
prefixes: "5018,5020,5038,6304,6759,6761",
checkdigit: true
};
cards[11] = { name: "VisaElectron",
length: "16",
prefixes: "417500,4917,4913,4508,4844",
checkdigit: true
};
cards[12] = { name: "Laser",
length: "16,17,18,19",
prefixes: "6304,6706,6771,6709",
checkdigit: true
};
// Establish card type
var cardType = -1;
for (var i = 0; i < cards.length; i++) {
// See if it is this card (ignoring the case of the string)
if (cardname.toLowerCase() == cards[i].name.toLowerCase()) {
cardType = i;
break;
}
}
// If card type not found, report an error
if (cardType == -1) {
ccErrorNo = 0;
return false;
}
// Ensure that the user has provided a credit card number
if (cardnumber.length == 0) {
ccErrorNo = 1;
return false;
}
// Now remove any spaces from the credit card number
cardnumber = cardnumber.replace(/\s/g, "");
// Check that the number is numeric
var cardNo = cardnumber
var cardexp = /^[0-9]{13,19}$/;
if (!cardexp.exec(cardNo)) {
ccErrorNo = 2;
return false;
}
// Now check the modulus 10 check digit - if required
if (cards[cardType].checkdigit) {
var checksum = 0; // running checksum total
var mychar = ""; // next char to process
var j = 1; // takes value of 1 or 2
// Process each digit one by one starting at the right
var calc;
for (i = cardNo.length - 1; i >= 0; i--) {
// Extract the next digit and multiply by 1 or 2 on alternative digits.
calc = Number(cardNo.charAt(i)) * j;
// If the result is in two digits add 1 to the checksum total
if (calc > 9) {
checksum = checksum + 1;
calc = calc - 10;
}
// Add the units element to the checksum total
checksum = checksum + calc;
// Switch the value of j
if (j == 1) { j = 2 } else { j = 1 };
}
// All done - if checksum is divisible by 10, it is a valid modulus 10.
// If not, report an error.
if (checksum % 10 != 0) {
ccErrorNo = 3;
return false;
}
}
// The following are the card-specific checks we undertake.
var LengthValid = false;
var PrefixValid = false;
var undefined;
var prefix = new Array();
var lengths = new Array();
// Load an array with the valid prefixes for this card
prefix = cards[cardType].prefixes.split(",");
// Now see if any of them match what we have in the card number
for (i = 0; i < prefix.length; i++) {
var exp = new RegExp("^" + prefix[i]);
if (exp.test(cardNo)) PrefixValid = true;
}
// If it isn't a valid prefix there's no point at looking at the length
if (!PrefixValid) {
ccErrorNo = 3;
return false;
}
// See if the length is valid for this card
lengths = cards[cardType].length.split(",");
for (j = 0; j < lengths.length; j++) {
if (cardNo.length == lengths[j]) LengthValid = true;
}
if (!LengthValid) {
ccErrorNo = 4;
return false;
};
return true;
}
CRM - Retrieving Data from Lookup View Fields Using java script
var lookup = document.getElementById('lookup id');
var name = lookupId[0].name;
//Can Retrive all Values in Lookup View
var lookupItems = lookup.items[0].values;
var age= lookupItems[1].value;
var address= lookupItems[2].value;
var name = lookupId[0].name;
//Can Retrive all Values in Lookup View
var lookupItems = lookup.items[0].values;
var age= lookupItems[1].value;
var address= lookupItems[2].value;
Monday, March 21, 2011
Configuring IFD with Microsoft Dynamics CRM 2011
Internet-facing deployment (IFD) uses Active Directory to authenticate a user. The user can access Microsoft Dynamics CRM from an internal network or from the Internet. Either way, the user must have an account in Active Directory.
The process to authenticate a user under IFD resembles Active Directory authentication. However, the licensing model specified when you access the CrmDiscoveryService Web service is a Microsoft Service Providers License Agreement (SPLA). In addition, a ticket must be obtained and set in the CrmAuthenticationTokenValue property value instance of the CrmService instance.
This Site very usefull to Configure IFD with CRM 2011>>>
Configuring IFD with Microsoft Dynamics CRM 2011
The process to authenticate a user under IFD resembles Active Directory authentication. However, the licensing model specified when you access the CrmDiscoveryService Web service is a Microsoft Service Providers License Agreement (SPLA). In addition, a ticket must be obtained and set in the CrmAuthenticationTokenValue property value instance of the CrmService instance.
This Site very usefull to Configure IFD with CRM 2011>>>
Configuring IFD with Microsoft Dynamics CRM 2011
Thursday, January 20, 2011
Set Status Inactive in CRM - Entity Using C#
// Create the Request Object
SetStateAccountRequest state = new SetStateAccountRequest();
//// Set the Request Object's Properties
state.AccountState = AccountState.Inactive;
state.AccountStatus = 2;
state.EntityId = account.accountid.Value;
service.ExecuteCompleted += new EventHandler(service_UpdateMemberStatus);
service.ExecuteAsync(state);
SetStateAccountRequest state = new SetStateAccountRequest();
//// Set the Request Object's Properties
state.AccountState = AccountState.Inactive;
state.AccountStatus = 2;
state.EntityId = account.accountid.Value;
service.ExecuteCompleted += new EventHandler
service.ExecuteAsync(state);
Tuesday, January 11, 2011
CRM and jQuery
o1.Add JQuery to crmForm Load Event.
function IncludeExternalScript(scriptFile)
{
var netRequest = new ActiveXObject("Msxml2.XMLHTTP");
netRequest.open("GET", scriptFile, false);
netRequest.send(null);
eval(netRequest.responseText);
}
IncludeExternalScript('http://"Your Link"/_common/styles/test/jquery-1.4.1.js');
$(document).ready(function () {
alert('test');
});
02.Create Dynamic Elements
var body=document.getElementById("tab0");
var boxes = document.createElement("<div id='boxes'/>");
body.appendChild(boxes);
03.Add css in Jquery
$(' #boxes .window').css({ 'width': '440px', 'height': '220px', 'position': 'absolute', 'left': '0', 'top': '0', 'z-index': '9999', 'padding': '20px', 'display': 'none' });
function IncludeExternalScript(scriptFile)
{
var netRequest = new ActiveXObject("Msxml2.XMLHTTP");
netRequest.open("GET", scriptFile, false);
netRequest.send(null);
eval(netRequest.responseText);
}
IncludeExternalScript('http://"Your Link"/_common/styles/test/jquery-1.4.1.js');
$(document).ready(function () {
alert('test');
});
02.Create Dynamic Elements
var body=document.getElementById("tab0");
var boxes = document.createElement("<div id='boxes'/>");
body.appendChild(boxes);
03.Add css in Jquery
$(' #boxes .window').css({ 'width': '440px', 'height': '220px', 'position': 'absolute', 'left': '0', 'top': '0', 'z-index': '9999', 'padding': '20px', 'display': 'none' });
Monday, January 3, 2011
Error : Unable to update the EntitySet. because it has a DefiningQuery and no element exists in the element to support the current operation admin under Entity Framework
Table doesn’t have a primary key defined.
01.Add primary Key in to the Table.
02.Delete and Re Create Entity Class(.edmx)
01.Add primary Key in to the Table.
02.Delete and Re Create Entity Class(.edmx)
Subscribe to:
Posts (Atom)