var Maths = { addNumbers: function(one, two) { return one + two; }, subNumbers: function(one, two) { return one - two; }, mulNumbers: function(one, two) { return one * two; }, divNumbers: function(one, two) { if (two != 0) return one / two; else return "Division failed. Denominator cannot be Zero"; } } function mathOperations() { alert( "Addition of 10 and 20 is " + Maths.addNumbers(10, 20) + "\n\n" + "Substraction of 10 and 20 is " + Maths.subNumbers(10, 20) + "\n\n" + "Multiplication of 10 and 20 is " + Maths.mulNumbers(10, 20) + "\n\n" + "Division of 10 and 20 is " + Maths.divNumbers(10, 20) ); }
Month: March 2014
Calculate difference between two dates using Javascript
Difference between two dates
Input String: calculateDays(“01-01-2014″,”12-12-2014”)
Date Format: MM-DD-YYYY
function calculateDays(datetime1, datetime2) {
var oneDay = 1000 * 60 * 60 * 24; // The number of milliseconds in a day
//Convert the datetime1 and datetime2 to Date object and get Time in milliseconds
var dt1 = new Date(datetime1).getTime();
var dt2 = new Date(datetime2).getTime();
// Calculate the difference in milliseconds
var diff = Math.abs(dt1- dt2); // Difference of Days
return Math.round(diff / oneDay);
}
Auto Number generation using Real Time Workflow in MS CRM 2013
Auto Number generation using Real Time Workflow in MS CRM 2013
Hi All,
I am going to show you the example of Real Time Workflow for Auto Number generation.Follow the below steps to create Auto Number for Contact entity,
Step 1: Create a Custom Entity “Counter” with the following Fields
Counter Value: Whole Number (Range as required)
Step 2: Create One Record in Counter entity as follows,
Step 3: Create N:1 relationship between Contact to Counter entity as follows,
Step 4: Create “Contact ID” field in Contact entity as follows,
Step 5: Place “Contact ID” and “Counter_Contact” fields on the Contact entity form and hide them,
Step 6: Create a Real time workflow as follows,
Step 7: Create a step to Update “Counter-Contact” record in Contact entity as follows,
Step 8: Update Counter Value from Counter entity as follows,
Step 9: Update Counter Value by 1 in Counter entity
Step 10: Activate the Process and Create Contact Record
Please provide your valuable comments.