Salesforce: Dynamic Related List and their associated filters
Dynamic Related List Dynamic Related Lists in Salesforce offer a flexible way to display related records on a record detail page based on specific criteria. Unlike traditional related lists that show all related records by default, dynamic related lists dynamically
Restrict back button of browser using Struts2
Follow the steps below to restrict back button of the browser: 1. Make a custom filter class as shown below. 2. Implement Filter (in-built interface) 3. Override “doFilter” method present in the Filter interface: public class NoCacheFilter implements Filter {
Toggling a checkbox on/off through Selenium webdriver
Below is the script for on/off the checkbox using webdriver: package mypackage; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class myclass { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); String baseUrl = “http://www.facebook.com”; driver.get(baseUrl);
How to create a dynamic div using Javascript
Here is sample code if you want to create a dynamic div using Javascript: <script type=”text/javascript”> divCount =0; function createDiv() { var divTag = document.createElement(“div”); var studList =””; studList += ‘<select id=”BOX_’+divCount+'” name=”BOX_’+divCount+'”>’; studList += ‘<option value=””>— Select —</option>’; for(i=0;i<countStud;i++)
Salesforce | Some Date functions (String to Date and more)
We can convert a string variable into date datatype by using the apex date class function date.parse(String); Syntax: Date var1=date.parse(String); Example: String var=’12/25/2016’; Convert var to date type by: Date var1=date.parse(var); Now var1 contain it as a date type. It
Android | How to get list of all the apps installed on Android device
In one of the mobile app we were required to get the list of all the installed applications on user’s mobile. This was possible but due to security reasons first of all you need to prompt app user to allow
Selenium | How to test popup alert message in Selenium Webdriver
Below is the script: package mypackage; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class myclass { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); String alertMessage = “”; driver.get(“http://demo.webnerserver.com/view/sent_email.php”) driver.findElement(By.cssSelector(“input[value=”Borrar”]”)).click(); alertMessage = driver.switchTo().alert().getText(); driver.switchTo().alert().accept(); System.out.println(alertMessage); driver.quit(); }
Salesforce | Calculate number of years between two dates in apex class
Sample Code: Date date1 = System.today(); Date date2 = System.today().addMonths(30); system.debug(‘No of months === >>>> ‘ + date1.monthsBetween(date2)); String noOfYears = String.valueOf(date1.monthsBetween(date2) / 12) + ‘ Year(s) ‘ + String.valueOf(Math.mod(date1.monthsBetween(date2), 12)) + ‘ Month(s)’; system.debug(‘No of years ‘ + noOfYears);
Salesforce | Visualforce | Error : DML currently not allowed exception on creation of the record on an Object
When creating a record on the document object using Rest API, Salesforce did not allow to execute the DML command from the Visualforce component. Reason: When we try to pass dynamic values from the Visualforce Component to the Apex method,
Mysql | How to access database remotely
To access Mysql database remotely a good way is to create a new Mysql user and grant it permissions to access database from remote, as explained below: You can create user with two ways From Mysql command prompt: 1. Open
