Im using javascript to reload my page and form.
window.location.reload(true);
it will reload the page but not the parent page. The particular form or page u are at.
CRM 2011 To Refresh or Reload The Page or Form
0 commentsPosted by Unknown at 7/05/2012 03:15:00 pm
Labels: CRM 2011
CRM 2011 Set Owner Field or ownerid to readonly or disabled
0 comments
If u set the owner field to readonly using form layout, for sure it wont work.
Posted by Unknown at 7/02/2012 06:09:00 pm
Labels: CRM 2011
CRM 2011 Cascading Drop Down
0 comments
Ever encounter problem is cascading drop down?
Cascading in different level ? or maybe just one level.
Using this script.
*Note put this script function cascadingDropdown on the field that onchange to trigger the cascade.
Javascript Eg.
//Function to put in toward field trigger onchange
function cascadingDropdown() {
var Saving = Xrm.Page.data.entity.attributes.get("vw_saving").getValue();
var SavingType = "vw_savingtype";
var picklistTwo = Xrm.Page.getControl(SavingType);
var picklistTwoAttribute = picklistTwo.getAttribute();
if (picklistTwo.flag == true) {
picklistTwo.clearOptions();
var origOptions = picklistTwo.originalPicklistValues;
for (var i = origOptions.length - 1; i >= 0; i--) {
if (origOptions[i].text != "") {
picklistTwo.addOption(origOptions[i]);
}
}
}
else {
picklistTwo.originalPicklistValues = picklistTwoAttribute.getOptions();
picklistTwo.flag = true;
}
var picklistTwoOptions = picklistTwoAttribute.getOptions();
switch (Saving) {
case true:
for (var i = picklistTwoOptions.length - 1; i >= 0; i--) {
if (picklistTwoOptions[i].value != null && picklistTwoOptions[i].value != "") {
var optionText = picklistTwoOptions[i].text;
var optionValue = picklistTwoOptions[i].value;
//Remove these values (This is the problem with hard code)
//U can change the code to get the value too. It depends.
if (optionText == "Negotiation" || optionText == "Discount" || optionText == "Contracting Strategy" || optionText == "Online Bidding (OLB)") {
picklistTwo.removeOption(optionValue);
}
//END: EOS Selection
}
}
break;
case false:
for (var i = picklistTwoOptions.length - 1; i >= 0; i--) {
if (picklistTwoOptions[i].value != null && picklistTwoOptions[i].value != "") {
var optionText = picklistTwoOptions[i].text;
var optionValue = picklistTwoOptions[i].value;
//Remove these values
if (optionText == "Joint Tender" || optionText == "Integrated Tender") {
picklistTwo.removeOption(optionValue);
}
//END: CS Selection
}
}
break;
default:
break;
}
}
End.
The bad thing about this script is if u have thousand or hundred of cascading record, u need to hardcore the value one by one and it takes a lot of time and script line.
For what i suggest if there are thousand or more than thousand of cascading record, better make use of the lookup toward entity. By using lookup it wont be consuming much time in scripting or work with the cascading part.
Posted by Unknown at 6/28/2012 05:28:00 pm
Labels: CRM 2011
CRM 2011 Date Time Duration
0 comments
Date Time Duration between two field.
*Note duration field is in decimal type. That mean the calculation can calculate until decimal point. At here u can set the amount of decimal point u want to see at the field.
Javascript Eg.
function getAging() {
var Answer = 0;
var AgingStartTime = Xrm.Page.data.entity.attributes.get("FieldName").getValue();
var AgingEndTime = Xrm.Page.data.entity.attributes.get("FieldName").getValue();
if (AgingStartTime != null) {
//Date time duration different between today and AgingStartTime
var today = new Date();
Answer = (today - AgingStartTime) / 1000 / 60 / 60 / 24;
//Date time duration different between AgingStartTime and AgingEndTime
Answer = (
AgingStartTime -
AgingEndTime ) / 1000 / 60 / 60 / 24;
}
else { Answer = null; }
//Which field to put the answer record to.
Xrm.Page.data.entity.attributes.get("FieldName").setValue(Answer);
}
End.
Posted by Unknown at 6/28/2012 05:12:00 pm
Labels: CRM 2011