Startup or MNC for Graduates in IT
Jun16

Startup or MNC for Graduates in IT

As a fresher out from college you have still long way to go both in learning and earning. To start a career I would strictly advise you to look forward at how much you can learn in the shortest duration. MNC’s will always have a charm, brand name, probably good salary attached to it but Start up will always give you more knowledge and experience. I would like to share my experience in both the types of companies as following: Startup Advantage Great Challenge: Several challenges indeed and everyday you might get a new problem to solve. Great Power & Big Responsibilities: With great power comes greater responsibilities. You can play all the roles you can or want to play in a Startup. For a day you can be a programmer/QA/System Architect/Manager and even the delivery head. Everything by Yourself: A leader in Startup will always give you several tasks and also the freedom to do it  yourself by your way. Risky!! For them who don’t have dependencies or family responsibilities are natural to take more risk, probably because they can afford to try and fail. Huge growth possibilities: You grow as the company grows. Since you are in a Startup so there is good possibility that the company will double or triple each quarter or probably each month and so as your salary if you are participating in this with the right talent. Startup Disadvantage Risky: God forbidden if anything fails then everything else might get effected and fail too. You might even lose your job since company went bankrupt. Startups are also not good for people looking for easy money or peaceful/vacation type jobs. Less Training: The truth is that you are accountable from the very first day in office. You are responsible for your actions and in actions both. You can be very lucky if you have a great captain driving your ship from whom you can quickly learn and be a champion in riding waves. MNC advantage Good Initial Salary: MNCs have the money. They can pay you a handsome salary for couple of months or probably years. No Risk: MNC is way more stable and job security is there. Long learning curve: I can give several examples in which my friends or colleagues in the same or different MNCs were on bench having no project to work upon for the entire year! yes entire YEAR ie. 12 months! Fun Fun Fun ! Most of my friends and my time in MNC was full of fun. I was able to complete my entire week’s work in a single day so rest of the time I...

Read More
Coding Genius (Trigger)
Jun11

Coding Genius (Trigger)

The following practice questions are for Salesforce developers who are new to salesforce and wish to solve some basic programming questions. Write a trigger 1. On Account create a default contact every time an account is created. What is Trigger Click here to learn more trigger Accounttir on Account (after insert) { list<contact> con = new list<contact>(); for(Account acc : trigger.new){ contact c = new contact(); c.LastName = acc.Name; c.AccountID = acc.ID; con.add(c); } insert con; } 2. Bulkify the above trigger to manage multiple record insertion. Trigger Bulkify Click here to learn more trigger Accounttir on Account (after insert) { list<contact> con = new list<contact>(); for(Account acc : trigger.new){ contact c = new contact(); c.LastName = acc.Name; c.AccountID = acc.ID; con.add(c); } insert con; } 3. On Opportunity to not let the user insert Opportunities with pass closed Date with following Message “Please enter a future Closed Date”. This can also be implemented by a validation rule but we want a Trigger to be written Click here to learn more trigger opportunitydate on Opportunity (before insert) { for(opportunity opp : trigger.new) { if(opp.Closedate<=Date.Today()){ opp.adderror(‘please eneter a future closed date’); } } } 4. On Product to setup default Pricebook entry in the “Standard Pricebook” as 1$. Product Schema Diagram Click here to learn more trigger Productupdate on Product2 (after insert) { list<PricebookEntry> pblist = new list<PricebookEntry>(); Pricebook2 pb=[Select id FROM Pricebook2 WHERE IsStandard=true]; for(Product2 pro:trigger.new){ PriceBookEntry pbe=new PriceBookEntry(); pbe.pricebook2id = pb.id; pbe.Unitprice=1; pbe.Product2Id=pro.id; pblist.add(pbe); } insert pblist; } 5. On Contact to update the Account Name field with contact Last Name, concatenated in the end. Example If “Tata” Account gets a contact “Ratan” created then Account Name field will be updated as “TataRatan”. Click here to learn more trigger updateAccname on Contact (after insert,before delete) { List<Account> accountlist=new List<Account>(); if(trigger.isInsert){ for(Contact con:[select Accountid,Account.Name,LastName from Contact WHERE Id IN:trigger.new]){ if(con.Account.Name!=null){ con.Account.Name+=con.LastName; accountlist.add(con.Account); } } }else if(trigger.isDelete){ for(Contact con : [select AccountId, Account.Name, LastName from Contact WHERE Id IN: trigger.old]){ system.debug(‘** contact –‘+con + ‘ *** Account –‘ + con.AccountId + ‘ *** Account Name — ‘+ con.Account.Name); con.Account.Name = con.Account.Name.replace(con.LastName,”); accountlist.add(con.Account); } } system.debug(‘*** ‘ +accountlist); update accountlist; } 6. Update the above trigger to delete the Last Name from the Account Company field when a Contact is deleted without deleting the other Last name. Example If “TataRatanNori” Account already have “Ratan” and “Nori” as its contacts and then contact “Ratan” gets deleted then Account Name field will be updated as “TataNori”. Click here to learn more trigger updateAccname on Contact (after insert,before delete) { List<Account> accountlist=new List<Account>(); if(trigger.isInsert){ for(Contact con:[select Accountid,Account.Name,LastName from Contact WHERE Id IN:trigger.new]){ if(con.Account.Name!=null){ con.Account.Name+=con.LastName; accountlist.add(con.Account); } }...

Read More
Coding Genius (Visual Force)
Jun10

Coding Genius (Visual Force)

The following practice questions are for Salesforce developers who are new to salesforce and wish to solve some basic programming questions. Develop the following Visualforce pages in your salesforce developer org. 1. Create a page that displays the detail page same as of the Account object along with its related lists Click here to learn more <apex:page standardController=”Account”> <apex:detail subject=”{!account.id}” relatedList=”true” title=”false”/> </apex:page> 2. Create a page that shows a datatable having 100 records. Click here to learn more <apex:page controller=”PageBlockTable” >   <apex:sectionHeader title=”Account List”/>   <apex:form >   <apex:dataTable value=”{!accountList}” var=”a”>   <apex:facet name=”header”>Account Name</apex:facet>   <apex:column value=”{!a.Name}”></apex:column>   </apex:dataTable>   </apex:form>   </apex:page>   public class PageBlockTable {   public list<Account> accountList{get;set;}   public PageBlockTable(){   accountList = new list<Account>();   accountList = [SELECT id,name FROM Account LIMIT 100];   }   } 3. Create a scrollable list of datatable that has 20 records. Click here to learn more <apex:page controller=”PageBlockTable” > <apex:sectionHeader title=”Account List”/> <apex:form > <apex:outputPanel layout=”block” style=”overflow:auto;width:850px;height:350px” > <apex:dataTable value=”{!accountList}” var=”a” > <apex:facet name=”header”>Account Name</apex:facet> <apex:column value=”{!a.Name}”></apex:column> </apex:dataTable> </apex:OutputPanel> </apex:form> </apex:page>   public class PageBlockTable {   public list<Account> accountList{get;set;} public PageBlockTable(){ accountList = new list<Account>(); accountList = [SELECT id,name FROM Account LIMIT 200]; } } 4. Develop the logic which shows/ hides the custom button “Test”. If the Opportunity>Stage = “Won” on an Opportunity record then the button should be displayed. Click here to learn more <apex:page standardController=”opportunity” extensions=”opportunityhide”> <apex:form > <apex:pageBlock > <div style=”display:none;”> dasdasdadda </div> <apex:outputPanel id=”abcd”> <apex:commandButton value=”test” rendered=”{!dadasda}”/> </apex:outputPanel> <apex:inputField value=”{!opportunity.stageName}”> <apex:actionSupport event=”onchange” action=”{!onCHeck}” rerender=”abcd” /> </apex:inputField> </apex:pageBlock> </apex:form> </apex:page>   public class opportunityhide { public boolean isTrue{get;set;} public boolean dadasda{get;set;} public Opportunity opp{get;set;} public opportunityhide(ApexPages.StandardController controller) { dadasda = false; opp =(opportunity) controller.getRecord(); } public void onCHeck(){ if(opp.stageName==’Closed Won’) { dadasda = true; } else { dadasda = false; } } } 5. Create a dataList that has 200 records and shows 10 records per page.It should have pagination with “Next” and “Previous” features in it.  Click here to learn more <apex:page standardController=”Account” recordSetVar=”Accounts” extensions=”AccountStandardSetController”> <apex:sectionHeader title=”Account List”/> <apex:form > <apex:dataTable value=”{!Accounts}” var=”a”>   <apex:facet name=”header”>Account Name</apex:facet> <apex:column value=”{!a.Name}”></apex:column> </apex:dataTable> <apex:panelGrid columns=”2″> <apex:commandLink action=”{!previous}”>Previous</apex:commandlink> <apex:commandLink action=”{!next}”>Next</apex:commandlink> </apex:panelGrid> </apex:form> </apex:page> public class AccountStandardSetController { public AccountStandardSetController(ApexPages.StandardSetController controller) { controller.setPageSize(20); } } 6. Create a page that has a text box and a datatable having column(Name, Phone, Postal Code and city) and in text box text is entered and on the basis of it the data block searches and shows the name column along with other columns.   Click here to learn more <apex:page controller=”DateBlock” > <apex:sectionHeader title=”Account List”/> <apex:form > <apex:inputText value=”{!searchstring}” label=”Input”/> <apex:commandButton value=”Search records” action=”{!search}”/> <apex:commandButton value=”Clear records” action=”{!clear}”/>...

Read More
Coding Genius (Batch Class )
Jun10

Coding Genius (Batch Class )

The following practice questions are for Salesforce developers who are new to Salesforce and wish to solve some basic programming questions. Using batch Apex classes, you can process records in batches asynchronously. If you have a large number of records to process, for example, for data cleansing or archiving, batch Apex is your solution. Each invocation of a batch class results in a job being placed on the Apex job queue for execution. Write or Schedule Apex Batch classes for the following. 1. Write an Apex Batch class in your Salesforce developer org to delete Accounts created in last 10 days. Click here to learn more global class AccountDelete implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext BC) { String query = ‘SELECT Id,CreatedDate FROM Account WHERE CreatedDate <= N_DAYS_AGO:10’; return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC, List<Account> scope) { /*List <Account>acclist = new List<Account>(); for(Account acc:acclist){ //string test = acc.Name; acclist.add(acc); }*/ system.debug(‘**** Acc List–‘+ scope); delete scope; } global void finish(Database.BatchableContext BC) { system.debug(‘**** Finish’); } } global class ScheduleDelete implements Schedulable{ global void execute(SchedulableContext sc) { AccountDelete a = new AccountDelete(); database.executebatch(a); } } 2. Schedule the above class to run twice every day at 12:00 PM. Click here to learn more String CRON_EXP1 = ‘0 0 12,0 * * ?’ ; ScheduleDelete bt2 = new ScheduleDelete(); System.schedule(‘every 12 hour Batch Schedule’, CRON_EXP1, bt2);  3. Write a Script to delete the above Schedule Jobs. Click here to learn more String CRON_EXP1 = ‘0 0 12,0 * * ?’ ; ScheduleDelete bt2 = new ScheduleDelete(); ID jobId = System.schedule(‘every 12 hour Batch Schedule’, CRON_EXP1, bt2); system.debug(‘++++++++++’+jobId); system.abortJob(jobId); 4. Create Batch class to create 5 new Opportunities daily. Click here to learn more global class OpportunityBatch implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext BC) { String query = ‘SELECT Id,Name FROM Opportunity LIMIT 1’; return Database.getQueryLocator(query); }   global void execute(Database.BatchableContext BC, List<Opportunity> scope) { List <opportunity> oppnew = new List<opportunity>();  for(integer i=1;i<6;i++){ Opportunity opp = new Opportunity(); opp.name = ‘Test ‘ + i; opp.StageName = ‘Prospecting’; opp.CloseDate = Date.Today(); oppnew.add(opp); } system.debug(‘**** Opp List–‘+ oppnew); insert oppnew; }    global void finish(Database.BatchableContext BC) { system.debug(‘**** Finish’); } } global class OpportunityBatchScheduler implements Schedulable{ global void execute(SchedulableContext sc) { OpportunityBatch b = new OpportunityBatch();  database.executebatch(b); } } 5. Schedule the above class to run 4 times every day at after every 6 hours. Click here to learn more String CRON_EXP1 = ‘0 0 6,12,18,0 * * ?’ ; OpportunityBatchScheduler bt1 = new OpportunityBatchScheduler(); System.schedule(‘six hour Batch Schedule job1’, CRON_EXP1, bt1); 6. Write a Script to delete the above Schedule Jobs Click here to learn more String CRON_EXP1 = ‘0 0 6,12,18,0 * *...

Read More