• chowdary marella
  • NEWBIE
  • -1 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 17
    Questions
  • 23
    Replies

Hi all.i created 2 users(A,B), "A" as system admin and other "B" as Standard User, i created OWD setting as private for lead. so "B" cannot see Lead records.

Requirement: if suppose lead in "A" with email as "S@gmail.com"

WHEN LEAD "B" Tries to create a record with email as "S@gmail.com"(same as already existed). i need to show an popup as "LEAD ALREADY EXISTS. you want to see the lead??"aLSO i need to show the already existed lead reecord("S@gmail.com").this popup and showing the record will happen after click on save.

I think i need create a trigger that shows popup message if email already exists.next i need to create a vf page that shows the already existed record (same email is record). can any one help me how to design.?? because iam not sure how to display the record after save with existing email

How a particular record with already email record will come after click on save , but owd is private. need to show after click on save only after email matches.

 

Thanks

 

Hi i created a trigger which is working.but not working with bulkified(dataloader).please see my code,and let me know to bulkify this code

field in account object (Status_Contact) to be updated when a custom field (Project Status) on the custom Project Object gets updated.
i HAVE LOOKUP FROM PROJECT TO CONTACT(Contact__c)..

 

 

trigger contactlookup on Project__c (after insert,after update) {

list<Project__c> proj=new list<Project__c>();
Map<Id,List<Project__c>> mapProject = New Map<Id,List<Project__c>>();
set<id>ids=new set<id>();
for(Project__c p1:trigger.new)
{
ids.add(p1.Contact__c);
}

proj=[SELECT id,contact__r.Client_Status_Contact__c,contact__r.id from Project__c where Contact__c in:ids];


for(Project__c po :proj)

{
if(po.Contact__c != null)
{
List<Project__c> ProjectForKey =mapProject.get(po.Contact__c);
if(ProjectForKey == null)
{
ProjectForKey = new List<Project__c>();
mapProject.put(po.Contact__c, ProjectForKey);
}


list<contact> cont= new list<contact>();
cont=[select id ,name,Client_Status_Contact__c from contact];
contact c= new contact();
c.Client_Status_Contact__c =proj[0].contact__r.Client_Status_Contact__c;
c.id=proj[0].contact__r.id;
system.debug('##############################'+c.Client_Status_Contact__c);
for(Project__c p:trigger.new)
{
if(p.Project_Status__c!=null)
c.Client_Status_Contact__c=p.Project_Status__c;
system.debug('prrrr^^^^^^^^^^^^^^^^^^^^^^^'+p.Project_Status__c);
system.debug('accccccccc******************************************'+c.Client_Status_Contact__c);
}
Update c;
}
}
}

Hi all.i had written a Trigger.but it is not meeting requirement.
Requirement:-
I have Policy Custom Object, Which is related to Account. There is are 6 "renewal due date"(Formula fields) field based on Expiration_Date__c ,Effective_Date__c,in Policy Object. Now i have to create a task on the Renewal Due Date. There could be many policies for an Account. Now we have to check that is there any policies with same Renewal Date related to one Account. We want to create only one task for the Policies with same Date.

(some accounts could have multiple policies with the same renewal dates.  We only need one set of tasks in this case.)

 

 

Thanks In Advance.


My code as follows:-

trigger Create_Task on Policy__c (After insert,After update) {
list<policy__c> p=new list<policy__c>();
list<task>tsk=new list<task>();
map<date,date> dat=new map<date,date>();
set<id> ids=new set<id>();
Boolean createtask=true;
for(policy__c p1:trigger.new){
ids.add(p1.Account__c);
}
p =[select id,name,Expiration_Date__c ,Effective_Date__c from policy__c where Account__c IN :ids];
system.debug('@@@@@@@@@@@@@@@@@@@@'+p);
for(policy__c p2:p){
dat.put(p2.Expiration_Date__c,p2.Effective_Date__c);
}
for(policy__c p3:trigger.new ){
if(dat.get(p3.Expiration_Date__c)!= null)
{
IF(dat.get(p3.Expiration_Date__c)==p3.Effective_Date__c )
   {
        createtask=False;
   }
}
 If(createtask != False)
 {
    Task t1=new Task();
    Task t2=new Task();
    Task t3=new Task();
    Task t4=new Task();
 
}

}
}


 

 

is it possible to get the data from core commerce to salesforce?? or can we get the data from core commerce to excel?

Hi all,  i am facing a issue, which i never faced.can any one work around it?

 

Need to send email before 1day,1hour,3hours. based on duedate__c . so i have created time based workflow  with rule criteria as Lead:duedate NOT equal to Null.

 

 

i am creating 3 dummy records to check giving before 1day,3hrs,1hr.

 

But surprise, iam getting 2 emails of 1hr,1day   to the email given in 1hour record.

 

but getting 1 email before 1 day. and 3hours which i expected..

 

 

issue :Why iam getting 2 mails for the email where i have to recieve only 1 hour template..

 


is i need to go for schedular class??
suggest me

How to stamp a date in custom field . i have created a formula field    IF(  ISPICKVAL(Confirmed__c, 'yes') , today() ,'').

 

in picklist if yes is selected, today date should populate, when no is selected it should give no value.

 

How to stamp a date in custom field . i have created a formula field    IF(  ISPICKVAL(Confirmed__c, 'yes') , today() ,'').

 

in picklist if yes is selected, today date should populate, when no is selected it should give no value.

 

Hi all i had written a class, due_date__c is date/Time field in Lead
Requirement:-I need due date reminders sent to whomever sets the due date. For example, if an agent completes a task then sets a date for the next action, a reminder needs to go to that agent to remind him/her that they have tasks to complete. Reminders should come the day before the event is due, again at 3 hours before due date and then one hour before due date.

need to schedule before 3hrs,before 1day and before 1 hour.

QUdos in Advance..Thank uu

 

 

My code

 

global class Sending_Email_SINGLECLASS implements Schedulable
{
public List<Lead> led=new List<Lead> ();
public list<lead> led1= new List<Lead> ();
public List<Lead> led2=new List<Lead> ();
list<id> leadid=new list<id>();

global void execute(SchedulableContext ctx)
{

Datetime d=system.TODAY();

 led=[select id,DUEDATETIME__c,Email from lead where DUEDATETIME__c=:date.valueOf(d.addHours(-1))];
system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+led);
led1=[select id,DUEDATETIME__c,Email from lead where DUEDATETIME__c=:date.valueOf(d.addHours(-2))];
system.debug('@++++++++++++++++++++++++++++++++++++++'+led1); */
led2=[select id,Due_Date__c,Email from lead where Due_Date__c=:date.valueOf(d.adddays(-1))];
system.debug('@*************************************'+led2);



for(Lead l:led)
{
leadid.add(l.id);
system.debug('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'+leadid);
}


for(Lead l:led1)
{
leadid.add(l.id);
system.debug('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'+leadid);
}


for(Lead l:led2)
{
leadid.add(l.id);
system.debug('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'+leadid);
}
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setTargetObjectIds(leadid); // assign the all emails
//mail.setReplyTo('exemple@exemple.ex');
EmailTemplate et= [SELECT id FROM EmailTemplate WHERE developerName = 'birth_day'];
mail.setSenderDisplayName('SirdikChowdary Marella'); // displaying the senders name
mail.setTemplateId(et.id); // adding the templete id,here we are taken subject,body.
Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
system.debug('********mail *@@@@@@@'+mail );
}
}

Hi all i had written a class, due_date__c is date/Time field in Lead
Requirement:-I need due date reminders sent to whomever sets the due date. For example, if an agent completes a task then sets a date for the next action, a reminder needs to go to that agent to remind him/her that they have tasks to complete. Reminders should come the day before the event is due, again at 3 hours before due date and then one hour before due date.

need to schedule before 3hrs,before 1day and before 1 hour.

QUdos in Advance..Thank uu

 

 

My code

 

global class Sending_Email_SINGLECLASS implements Schedulable
{
public List<Lead> led=new List<Lead> ();
public list<lead> led1= new List<Lead> ();
public List<Lead> led2=new List<Lead> ();
list<id> leadid=new list<id>();

global void execute(SchedulableContext ctx)
{

Datetime d=system.TODAY();

 led=[select id,DUEDATETIME__c,Email from lead where DUEDATETIME__c=:date.valueOf(d.addHours(-1))];
system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+led);
led1=[select id,DUEDATETIME__c,Email from lead where DUEDATETIME__c=:date.valueOf(d.addHours(-2))];
system.debug('@++++++++++++++++++++++++++++++++++++++'+led1); */
led2=[select id,Due_Date__c,Email from lead where Due_Date__c=:date.valueOf(d.adddays(-1))];
system.debug('@*************************************'+led2);



for(Lead l:led)
{
leadid.add(l.id);
system.debug('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'+leadid);
}


for(Lead l:led1)
{
leadid.add(l.id);
system.debug('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'+leadid);
}


for(Lead l:led2)
{
leadid.add(l.id);
system.debug('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'+leadid);
}
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setTargetObjectIds(leadid); // assign the all emails
//mail.setReplyTo('exemple@exemple.ex');
EmailTemplate et= [SELECT id FROM EmailTemplate WHERE developerName = 'birth_day'];
mail.setSenderDisplayName('SirdikChowdary Marella'); // displaying the senders name
mail.setTemplateId(et.id); // adding the templete id,here we are taken subject,body.
Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
system.debug('********mail *@@@@@@@'+mail );
}
}

i have created an email service class, but i need to do..if the record is already exists i need to update,if not i need to create a new record ...based on email id i need to check whether it is already exists or not...can any one give a logic,,kudos for ur help..!!!


 

global class POL_EMAIL implements Messaging.InboundEmailHandler {
      global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
          Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
       
         string myPlainText= '';
         list<string> lst;
         String emailAddress = envelope.fromAddress;
         myPlainText = email.PlainTextBody;
         System.debug('@@@@@@@@@@@@@@@@@@@'+emailAddress );
         System.debug('@@@@@@@@@@@@@@@@@@@*************'+myPlainText );
          
          
          lst=myPlainText.split(';;');
          system.debug('111111'+lst);
          Member__c e=new Member__c();
          string fname = lst.get(0);
          e.First_Name__c = (fname.substringAfter(':')).trim();
         
          System.debug('@@@@@@@@'+e.First_Name__c);
          
       string name = lst.get(1);
          e.Name = (name.substringAfter(':')).trim();
       
       //   System.debug('@@@@@@@@'+e.Last_Name__c );
          
          
          
          
          string Othername = lst.get(2);
          e.Other_Name__c = (Othername.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Other_Name__c );
          
          string gender = lst.get(3);
          e.Gender__c = (gender.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Gender__c );
          
          string DOB = lst.get(4);
          e.Date_of_Birth__c =date.parse((DOB.substringAfter(':')).trim());
          System.debug('@@@@@@@@'+e.Date_of_Birth__c );
          
          string Occupation = lst.get(5);
          e.Occupation__c = (Occupation.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Occupation__c );
          
          string Nationality = lst.get(6);
          e.Nationality__c = (Nationality.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Nationality__c );
          
          string Language = lst.get(7);
          e.Language__c = (Language.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Language__c );
          
          string Street = lst.get(8);
          e.Street__c = (Street.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Street__c );
          
          string Address2 = lst.get(9);
          e.Address_2__c = (Address2.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Address_2__c );
          
          string SuburbCityTown = lst.get(10);
          e.Suburb_City__c = (SuburbCityTown.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Suburb_City__c );
          
          string StateProvidenceTerritory = lst.get(11);
          e.State_Providence_Territory__c = (StateProvidenceTerritory.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.State_Providence_Territory__c );
          
          string Country = lst.get(12);
          e.Country__c = (Country.substringAfter(':')).trim();
          e.Newsletter_Interest__c=(Country.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Country__c );
          
         string postal = lst.get(13);
          e.Posatl_Zip_Code__c = (postal.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Posatl_Zip_Code__c );
          
       string Mobile = lst.get(14);
          e.Mobile_Number__c = (Mobile.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+  e.Mobile_Number__c );
          
          
          string Skype= lst.get(15);
          e.Skype_Name__c = (Skype.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Skype_Name__c );
          
          
           string Curr= lst.get(16);
          e.CurrencyIsoCode = (Curr.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.CurrencyIsoCode );
          
          string Newsletter= lst.get(17);
          e.Newsletter_Interest__c = (Newsletter.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.Newsletter_Interest__c );
          
          string pol= lst.get(18);
          e.How_did_You_Hear_About_Path_of_Love__c = (pol.substringAfter(':')).trim();
          System.debug('@@@@@@@@'+e.How_did_You_Hear_About_Path_of_Love__c );
          
        string Email1= lst.get(19);
        e.E_Mail__c = (Email1.substringAfter(':')).trim();

         
          insert e;
          System.debug('@@@@@@@@#################'+e);
          
          return result;
      }
  }

How to map a custom field in lead to custom fields in both account and opportunity?..how can i write a trigger?

Hi i have created a VF page using css, as header,body,footer,
But in body the clour is not present in client side,Am not able to fin it is a browser problem or my with my code...

Hi i have created a VF page using css, as header,body,footer,
But in body the clour is not present in client side,Am not able to fin it is a browser problem or my with my code...

When creating a online exam on vf page,how to build logic.?? when i click on start exam(button),the javascript BACK timer and question should start coming randomly with out repeating and start exam button should dissapear after user click.how to do this?? am having prblm to call both javascript and apex methods at a time on button click..here is my code please resolve ..


vf page:-


<apex:page sidebar="false" showHeader="false" controller="clsonline">
<form>
<html>
<body style="background-image:url('{!$Resource.Background}');">

<table border="1" cellpadding="14px" width="1200px" align="center" style= "font-size:25px; color: #686868 ;font-family:Verdana;">
<tr><th><center>SalesForce DEV-401 Examination</center></th></tr>
</table>
<table border="1" cellpadding="210px" width="1300px" style= "font-size:25px; color:#F00000 ;font-family:Verdana;">
<tr><td width="12%">

</td>

<td width="6px"> Answer the Following<BR/><BR/><BR/>
<apex:pageBlock >
<apex:pageblockTable value="{!quess}" var="ques" columnsWidth="100%, 100%" >
<apex:column value="{!ques.Name}" headerValue=""/>
<apex:column value="{!ques.a__c}" headerValue=""/>
<apex:column value="{!ques.b__c}" headerValue=""/>
<apex:column value="{!ques.c__c}" headerValue=""/>
<apex:column value="{!ques.d__c}" headerValue=""/>
</apex:pageblockTable>

</apex:pageBlock>
<!-- TIMER CODING STARTS / -->

<script type="text/javascript">

var sec = 00; // set the seconds
var min = 60; // set the minutes

function countDown() {
sec--;
if (sec == -01)
{
sec = 59;
min = min - 1;
}
else 
{
min = min;
}

if (sec<=9)
{
sec = "0" + sec; 
}

time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec ";

if (document.getElementById) { document.getElementById('theTime').innerHTML = time; }

SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); }
}
<!--window.onload = countDown;-->

</script>

<style type="text/css">

.timeClass {
font-family:arial,verdana,helvetica,sans-serif, color:yellow;
font-weight:normal;
font-size:20pt;
}

</style>

<!-- This goes into the BODY of the file -->

<table width="100%">
<tr><td width="100%" align="center"><span id="theTime" class="timeClass"></span></td></tr>
</table>

<div id="mydiv"></div>


<center><input type= "button" id="button1" value="StartExam" onclick="countDown()" /></center>
<apex:form >
<!--<apex:commandButton onclick="countDown();" action="{!Ques}" value="Start Exam"/>-->
<apex:commandButton value="Next" action="{!nxt}"/>
<!--<apex:commandButton value="start exam" onClick="if(!countDown()) return true;" action="{!CallAction}" rendered="{!hidebttn}" />-->
</apex:form>

</td><td width="22%">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <apex:image url="{!$Resource.pic}" width="80" height="50"/></td> </tr>
</table>
<table border="1" cellpadding="14px" width="1000px" align="center" style= "font-size:15px;color:#660000;font-family:Verdana;">
<th > <center><marquee behavior="alternate">360 Degree Cloud 2013.All Rights Reserved</marquee></center> </th>
</table>
</body>
</html>
</form>
</apex:page>

 

======================================================================

 

 

CONTROLLER:-

 

public class clsonline { 
public boolean hidebttn{get;set;}
public list<Questions__c> quess{get;set;}
set<integer> i= new set<integer>();
public pageReference CallAction() {


pageReference pgref=new pageReference('/apex/onlineexam?pagID=1');
pgref.setRedirect(true);

return pgref;

}
public integer timer;
list<Questions__c> ques=new list<Questions__c>();

public clsonline(){

hidebttn=true;
if(ApexPages.currentpage().getParameters().get('pagID')!=null)

hidebttn=false;
}
}
public pageReference Ques()
{


Integer rand = Math.floor(Math.random()*14).intValue();


quess = new list<Questions__c>();
if(!i.contains(rand)){
quess = [SELECT Name FROM Questions__c limit 1 OFFSET :rand];
}
i.add(rand);
System.debug('@@@@Account@@@@@'+quess); 
return null;
}
public pagereference nxt()
{
Integer rand = Math.floor(Math.random()*14).intValue();

quess = new list<Questions__c>();
if(!i.contains(rand)){
quess = [SELECT name,a__c,b__c,c__c,d__c FROM Questions__c limit 1 OFFSET :rand];
}
System.debug('@@@@Account@@@@@'+quess); 
return null;
}
}

When creating a online exam on vf page,how to build logic.?? when i click on start exam(button),the javascript BACK timer and question should start coming randomly with out repeating and start exam button should dissapear after user click.how to do this?? am having prblm to call both javascript and apex methods at a time on button click..here is my code please resolve ..


vf page:-


<apex:page sidebar="false" showHeader="false" controller="clsonline">
<form>
<html>
<body style="background-image:url('{!$Resource.Background}');">

<table border="1" cellpadding="14px" width="1200px" align="center" style= "font-size:25px; color: #686868 ;font-family:Verdana;">
<tr><th><center>SalesForce DEV-401 Examination</center></th></tr>
</table>
<table border="1" cellpadding="210px" width="1300px" style= "font-size:25px; color:#F00000 ;font-family:Verdana;">
<tr><td width="12%">

</td>

<td width="6px"> Answer the Following<BR/><BR/><BR/>
<apex:pageBlock >
<apex:pageblockTable value="{!quess}" var="ques" columnsWidth="100%, 100%" >
<apex:column value="{!ques.Name}" headerValue=""/>
<apex:column value="{!ques.a__c}" headerValue=""/>
<apex:column value="{!ques.b__c}" headerValue=""/>
<apex:column value="{!ques.c__c}" headerValue=""/>
<apex:column value="{!ques.d__c}" headerValue=""/>
</apex:pageblockTable>

</apex:pageBlock>
<!-- TIMER CODING STARTS / -->

<script type="text/javascript">

var sec = 00; // set the seconds
var min = 60; // set the minutes

function countDown() {
sec--;
if (sec == -01)
{
sec = 59;
min = min - 1;
}
else 
{
min = min;
}

if (sec<=9)
{
sec = "0" + sec; 
}

time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec ";

if (document.getElementById) { document.getElementById('theTime').innerHTML = time; }

SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); }
}
<!--window.onload = countDown;-->

</script>

<style type="text/css">

.timeClass {
font-family:arial,verdana,helvetica,sans-serif, color:yellow;
font-weight:normal;
font-size:20pt;
}

</style>

<!-- This goes into the BODY of the file -->

<table width="100%">
<tr><td width="100%" align="center"><span id="theTime" class="timeClass"></span></td></tr>
</table>

<div id="mydiv"></div>


<center><input type= "button" id="button1" value="StartExam" onclick="countDown()" /></center>
<apex:form >
<!--<apex:commandButton onclick="countDown();" action="{!Ques}" value="Start Exam"/>-->
<apex:commandButton value="Next" action="{!nxt}"/>
<!--<apex:commandButton value="start exam" onClick="if(!countDown()) return true;" action="{!CallAction}" rendered="{!hidebttn}" />-->
</apex:form>

</td><td width="22%">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <apex:image url="{!$Resource.pic}" width="80" height="50"/></td> </tr>
</table>
<table border="1" cellpadding="14px" width="1000px" align="center" style= "font-size:15px;color:#660000;font-family:Verdana;">
<th > <center><marquee behavior="alternate">360 Degree Cloud 2013.All Rights Reserved</marquee></center> </th>
</table>
</body>
</html>
</form>
</apex:page>

 

======================================================================

 

 

CONTROLLER:-

 

public class clsonline { 
public boolean hidebttn{get;set;}
public list<Questions__c> quess{get;set;}
set<integer> i= new set<integer>();
public pageReference CallAction() {


pageReference pgref=new pageReference('/apex/onlineexam?pagID=1');
pgref.setRedirect(true);

return pgref;

}
public integer timer;
list<Questions__c> ques=new list<Questions__c>();

public clsonline(){

hidebttn=true;
if(ApexPages.currentpage().getParameters().get('pagID')!=null)

hidebttn=false;
}
}
public pageReference Ques()
{


Integer rand = Math.floor(Math.random()*14).intValue();


quess = new list<Questions__c>();
if(!i.contains(rand)){
quess = [SELECT Name FROM Questions__c limit 1 OFFSET :rand];
}
i.add(rand);
System.debug('@@@@Account@@@@@'+quess); 
return null;
}
public pagereference nxt()
{
Integer rand = Math.floor(Math.random()*14).intValue();

quess = new list<Questions__c>();
if(!i.contains(rand)){
quess = [SELECT name,a__c,b__c,c__c,d__c FROM Questions__c limit 1 OFFSET :rand];
}
System.debug('@@@@Account@@@@@'+quess); 
return null;
}
}

When creating a online exam on vf page,how to build logic.?? when i click on start exam(button),the javascript BACK timer and question should start coming randomly with out repeating and start exam button should dissapear after user click.how to do this?? am having prblm to call both javascript and apex methods at a time on button click..here is my code please resolve ..


vf page:-


<apex:page sidebar="false" showHeader="false" controller="clsonline">
<form>
<html>
<body style="background-image:url('{!$Resource.Background}');">

<table border="1" cellpadding="14px" width="1200px" align="center" style= "font-size:25px; color: #686868 ;font-family:Verdana;">
<tr><th><center>SalesForce DEV-401 Examination</center></th></tr>
</table>
<table border="1" cellpadding="210px" width="1300px" style= "font-size:25px; color:#F00000 ;font-family:Verdana;">
<tr><td width="12%">

</td>

<td width="6px"> Answer the Following<BR/><BR/><BR/>
<apex:pageBlock >
<apex:pageblockTable value="{!quess}" var="ques" columnsWidth="100%, 100%" >
<apex:column value="{!ques.Name}" headerValue=""/>
<apex:column value="{!ques.a__c}" headerValue=""/>
<apex:column value="{!ques.b__c}" headerValue=""/>
<apex:column value="{!ques.c__c}" headerValue=""/>
<apex:column value="{!ques.d__c}" headerValue=""/>
</apex:pageblockTable>

</apex:pageBlock>
<!-- TIMER CODING STARTS / -->

<script type="text/javascript">

var sec = 00; // set the seconds
var min = 60; // set the minutes

function countDown() {
sec--;
if (sec == -01)
{
sec = 59;
min = min - 1;
}
else 
{
min = min;
}

if (sec<=9)
{
sec = "0" + sec; 
}

time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec ";

if (document.getElementById) { document.getElementById('theTime').innerHTML = time; }

SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); }
}
<!--window.onload = countDown;-->

</script>

<style type="text/css">

.timeClass {
font-family:arial,verdana,helvetica,sans-serif, color:yellow;
font-weight:normal;
font-size:20pt;
}

</style>

<!-- This goes into the BODY of the file -->

<table width="100%">
<tr><td width="100%" align="center"><span id="theTime" class="timeClass"></span></td></tr>
</table>

<div id="mydiv"></div>


<center><input type= "button" id="button1" value="StartExam" onclick="countDown()" /></center>
<apex:form >
<!--<apex:commandButton onclick="countDown();" action="{!Ques}" value="Start Exam"/>-->
<apex:commandButton value="Next" action="{!nxt}"/>
<!--<apex:commandButton value="start exam" onClick="if(!countDown()) return true;" action="{!CallAction}" rendered="{!hidebttn}" />-->
</apex:form>

</td><td width="22%">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <apex:image url="{!$Resource.pic}" width="80" height="50"/></td> </tr>
</table>
<table border="1" cellpadding="14px" width="1000px" align="center" style= "font-size:15px;color:#660000;font-family:Verdana;">
<th > <center><marquee behavior="alternate">360 Degree Cloud 2013.All Rights Reserved</marquee></center> </th>
</table>
</body>
</html>
</form>
</apex:page>

 

======================================================================

 

 

CONTROLLER:-

 

public class clsonline { 
public boolean hidebttn{get;set;}
public list<Questions__c> quess{get;set;}
set<integer> i= new set<integer>();
public pageReference CallAction() {


pageReference pgref=new pageReference('/apex/onlineexam?pagID=1');
pgref.setRedirect(true);

return pgref;

}
public integer timer;
list<Questions__c> ques=new list<Questions__c>();

public clsonline(){

hidebttn=true;
if(ApexPages.currentpage().getParameters().get('pagID')!=null)

hidebttn=false;
}
}
public pageReference Ques()
{


Integer rand = Math.floor(Math.random()*14).intValue();


quess = new list<Questions__c>();
if(!i.contains(rand)){
quess = [SELECT Name FROM Questions__c limit 1 OFFSET :rand];
}
i.add(rand);
System.debug('@@@@Account@@@@@'+quess); 
return null;
}
public pagereference nxt()
{
Integer rand = Math.floor(Math.random()*14).intValue();

quess = new list<Questions__c>();
if(!i.contains(rand)){
quess = [SELECT name,a__c,b__c,c__c,d__c FROM Questions__c limit 1 OFFSET :rand];
}
System.debug('@@@@Account@@@@@'+quess); 
return null;
}
}

When creating a online exam on vf page,how to build logic.?? when i click on start exam(button),the javascript BACK timer and question should start coming randomly with out repeating and start exam button should dissapear after user click.how to do this?? am having prblm to call both javascript and apex methods at a time on button click..here is my code please resolve ..


vf page:-


<apex:page sidebar="false" showHeader="false" controller="clsonline">
<form>
<html>
<body style="background-image:url('{!$Resource.Background}');">

<table border="1" cellpadding="14px" width="1200px" align="center" style= "font-size:25px; color: #686868 ;font-family:Verdana;">
<tr><th><center>SalesForce DEV-401 Examination</center></th></tr>
</table>
<table border="1" cellpadding="210px" width="1300px" style= "font-size:25px; color:#F00000 ;font-family:Verdana;">
<tr><td width="12%">

</td>

<td width="6px"> Answer the Following<BR/><BR/><BR/>
<apex:pageBlock >
<apex:pageblockTable value="{!quess}" var="ques" columnsWidth="100%, 100%" >
<apex:column value="{!ques.Name}" headerValue=""/>
<apex:column value="{!ques.a__c}" headerValue=""/>
<apex:column value="{!ques.b__c}" headerValue=""/>
<apex:column value="{!ques.c__c}" headerValue=""/>
<apex:column value="{!ques.d__c}" headerValue=""/>
</apex:pageblockTable>

</apex:pageBlock>
<!-- TIMER CODING STARTS / -->

<script type="text/javascript">

var sec = 00; // set the seconds
var min = 60; // set the minutes

function countDown() {
sec--;
if (sec == -01)
{
sec = 59;
min = min - 1;
}
else
{
min = min;
}

if (sec<=9)
{
sec = "0" + sec;
}

time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec ";

if (document.getElementById) { document.getElementById('theTime').innerHTML = time; }

SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); }
}
<!--window.onload = countDown;-->

</script>

<style type="text/css">

.timeClass {
font-family:arial,verdana,helvetica,sans-serif, color:yellow;
font-weight:normal;
font-size:20pt;
}

</style>

<!-- This goes into the BODY of the file -->

<table width="100%">
<tr><td width="100%" align="center"><span id="theTime" class="timeClass"></span></td></tr>
</table>

<div id="mydiv"></div>


<center><input type= "button" id="button1" value="StartExam" onclick="countDown()" /></center>
<apex:form >
<!--<apex:commandButton onclick="countDown();" action="{!Ques}" value="Start Exam"/>-->
<apex:commandButton value="Next" action="{!nxt}"/>
<!--<apex:commandButton value="start exam" onClick="if(!countDown()) return true;" action="{!CallAction}" rendered="{!hidebttn}" />-->
</apex:form>

</td><td width="22%">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <apex:image url="{!$Resource.pic}" width="80" height="50"/></td> </tr>
</table>
<table border="1" cellpadding="14px" width="1000px" align="center" style= "font-size:15px;color:#660000;font-family:Verdana;">
<th > <center><marquee behavior="alternate">360 Degree Cloud 2013.All Rights Reserved</marquee></center> </th>
</table>
</body>
</html>
</form>
</apex:page>

 

======================================================================

 

 

CONTROLLER:-

 

public class clsonline {
public boolean hidebttn{get;set;}
public list<Questions__c> quess{get;set;}
set<integer> i= new set<integer>();
public pageReference CallAction() {


pageReference pgref=new pageReference('/apex/onlineexam?pagID=1');
pgref.setRedirect(true);

return pgref;

}
public integer timer;
list<Questions__c> ques=new list<Questions__c>();

public clsonline(){

hidebttn=true;
if(ApexPages.currentpage().getParameters().get('pagID')!=null)
{
hidebttn=false;
}
}
public pageReference Ques()
{


Integer rand = Math.floor(Math.random()*14).intValue();


quess = new list<Questions__c>();
if(!i.contains(rand)){
quess = [SELECT Name FROM Questions__c limit 1 OFFSET :rand];
}
i.add(rand);
System.debug('@@@@Account@@@@@'+quess);
return null;
}
public pagereference nxt()
{
Integer rand = Math.floor(Math.random()*14).intValue();

quess = new list<Questions__c>();
if(!i.contains(rand)){
quess = [SELECT name,a__c,b__c,c__c,d__c FROM Questions__c limit 1 OFFSET :rand];
}
System.debug('@@@@Account@@@@@'+quess);
return null;
}
}

Hi all.i created 2 users(A,B), "A" as system admin and other "B" as Standard User, i created OWD setting as private for lead. so "B" cannot see Lead records.

Requirement: if suppose lead in "A" with email as "S@gmail.com"

WHEN LEAD "B" Tries to create a record with email as "S@gmail.com"(same as already existed). i need to show an popup as "LEAD ALREADY EXISTS. you want to see the lead??"aLSO i need to show the already existed lead reecord("S@gmail.com").this popup and showing the record will happen after click on save.

I think i need create a trigger that shows popup message if email already exists.next i need to create a vf page that shows the already existed record (same email is record). can any one help me how to design.?? because iam not sure how to display the record after save with existing email

How a particular record with already email record will come after click on save , but owd is private. need to show after click on save only after email matches.

 

Thanks

 

Hi i created a trigger which is working.but not working with bulkified(dataloader).please see my code,and let me know to bulkify this code

field in account object (Status_Contact) to be updated when a custom field (Project Status) on the custom Project Object gets updated.
i HAVE LOOKUP FROM PROJECT TO CONTACT(Contact__c)..

 

 

trigger contactlookup on Project__c (after insert,after update) {

list<Project__c> proj=new list<Project__c>();
Map<Id,List<Project__c>> mapProject = New Map<Id,List<Project__c>>();
set<id>ids=new set<id>();
for(Project__c p1:trigger.new)
{
ids.add(p1.Contact__c);
}

proj=[SELECT id,contact__r.Client_Status_Contact__c,contact__r.id from Project__c where Contact__c in:ids];


for(Project__c po :proj)

{
if(po.Contact__c != null)
{
List<Project__c> ProjectForKey =mapProject.get(po.Contact__c);
if(ProjectForKey == null)
{
ProjectForKey = new List<Project__c>();
mapProject.put(po.Contact__c, ProjectForKey);
}


list<contact> cont= new list<contact>();
cont=[select id ,name,Client_Status_Contact__c from contact];
contact c= new contact();
c.Client_Status_Contact__c =proj[0].contact__r.Client_Status_Contact__c;
c.id=proj[0].contact__r.id;
system.debug('##############################'+c.Client_Status_Contact__c);
for(Project__c p:trigger.new)
{
if(p.Project_Status__c!=null)
c.Client_Status_Contact__c=p.Project_Status__c;
system.debug('prrrr^^^^^^^^^^^^^^^^^^^^^^^'+p.Project_Status__c);
system.debug('accccccccc******************************************'+c.Client_Status_Contact__c);
}
Update c;
}
}
}

Hi all,  i am facing a issue, which i never faced.can any one work around it?

 

Need to send email before 1day,1hour,3hours. based on duedate__c . so i have created time based workflow  with rule criteria as Lead:duedate NOT equal to Null.

 

 

i am creating 3 dummy records to check giving before 1day,3hrs,1hr.

 

But surprise, iam getting 2 emails of 1hr,1day   to the email given in 1hour record.

 

but getting 1 email before 1 day. and 3hours which i expected..

 

 

issue :Why iam getting 2 mails for the email where i have to recieve only 1 hour template..

 


is i need to go for schedular class??
suggest me

How to stamp a date in custom field . i have created a formula field    IF(  ISPICKVAL(Confirmed__c, 'yes') , today() ,'').

 

in picklist if yes is selected, today date should populate, when no is selected it should give no value.

 

How to stamp a date in custom field . i have created a formula field    IF(  ISPICKVAL(Confirmed__c, 'yes') , today() ,'').

 

in picklist if yes is selected, today date should populate, when no is selected it should give no value.

 

Hi all i had written a class, due_date__c is date/Time field in Lead
Requirement:-I need due date reminders sent to whomever sets the due date. For example, if an agent completes a task then sets a date for the next action, a reminder needs to go to that agent to remind him/her that they have tasks to complete. Reminders should come the day before the event is due, again at 3 hours before due date and then one hour before due date.

need to schedule before 3hrs,before 1day and before 1 hour.

QUdos in Advance..Thank uu

 

 

My code

 

global class Sending_Email_SINGLECLASS implements Schedulable
{
public List<Lead> led=new List<Lead> ();
public list<lead> led1= new List<Lead> ();
public List<Lead> led2=new List<Lead> ();
list<id> leadid=new list<id>();

global void execute(SchedulableContext ctx)
{

Datetime d=system.TODAY();

 led=[select id,DUEDATETIME__c,Email from lead where DUEDATETIME__c=:date.valueOf(d.addHours(-1))];
system.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'+led);
led1=[select id,DUEDATETIME__c,Email from lead where DUEDATETIME__c=:date.valueOf(d.addHours(-2))];
system.debug('@++++++++++++++++++++++++++++++++++++++'+led1); */
led2=[select id,Due_Date__c,Email from lead where Due_Date__c=:date.valueOf(d.adddays(-1))];
system.debug('@*************************************'+led2);



for(Lead l:led)
{
leadid.add(l.id);
system.debug('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'+leadid);
}


for(Lead l:led1)
{
leadid.add(l.id);
system.debug('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'+leadid);
}


for(Lead l:led2)
{
leadid.add(l.id);
system.debug('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'+leadid);
}
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setTargetObjectIds(leadid); // assign the all emails
//mail.setReplyTo('exemple@exemple.ex');
EmailTemplate et= [SELECT id FROM EmailTemplate WHERE developerName = 'birth_day'];
mail.setSenderDisplayName('SirdikChowdary Marella'); // displaying the senders name
mail.setTemplateId(et.id); // adding the templete id,here we are taken subject,body.
Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
system.debug('********mail *@@@@@@@'+mail );
}
}

i have a custom field in lead and opportunity as AGE__C.and age__c field in lead is mapped to account.but now i need the same age__c field to be mapped to opportunity also...how it can be possible..how can i write a trigger for this scenario????

Hi,I am having questions__c(parent) and answers__c(child) are 2 custom objects which are having MDR relation.
Requirement:-
Need to create ONLINE EXAM on if page have 1000 records in questions__c object I need to fetch records from questions__c. Randomly to if page and need to show different questions which should not repeat.
question =60. no question should reapeat for a single participant.
Can any one make me out from this???

Thanx in advance...!!!

I have used the getshopped (for wordpress) . Actually i used wp-ecommerce for shopping and trying to use the salesforce intgration.
Could you please tell me how can do this?

HI All, 

 

 I have 20 records in My  custom object , I need to diplay  records random , no t sam e in order if  I refresh the page How can i solve  this solution

 

Hi,

 

In contracts I have a custom field No of Visits. Based on this and contract period (in months) I will have to update a date field - next visit. So Next_Visit_Date__c will be ContractTerm/No_of_Visits__c months ahead of start date (for the first time). Once this date is over, I need to override the same field, this time Next_Visit_Date__c will be ContractTerm/No_of_Visits__c months ahead of previous Next_Visit_Date__c. I have created WFR on creation to fill the next visit date for the first time also have created time based workflow rule which creates a task to notify, as well as update the Next_Visit_date__c. Everything works fine!!

 

But the time based workflow doesn't fire again. I cannot use ISCHANGED() or PRIORVALUE() functions in Evaluation Criteria : When a record is created, or when a record is edited and did not previously meet the rule criteria.

 

I am thinking of creating a custom date field which will store the previous value of Next_Visit_Date__c and use that in the Rule criteria of time based workflow. Is there any better suggestion?

Please let me know.

Hi ,

 

I was wondering if we can create a Quiz using SFDC and assess the results as well. Any ideas on how to go about it would certainly be of great help.

 

Thanks,

Sales4ce

I am trying to develop an online exam.

 

I was successful in keeping all the questions and writing class for them.

It works fine, but I need some questions which should be randomly picked from object.

Every time these questions should be different.

How can we achieve randomly ques from db?

 

Help me out at earliest.

Hi,

 

In contracts I have a custom field No of Visits. Based on this and contract period (in months) I will have to update a date field - next visit. So Next_Visit_Date__c will be ContractTerm/No_of_Visits__c months ahead of start date (for the first time). Once this date is over, I need to override the same field, this time Next_Visit_Date__c will be ContractTerm/No_of_Visits__c months ahead of previous Next_Visit_Date__c. I have created WFR on creation to fill the next visit date for the first time also have created time based workflow rule which creates a task to notify, as well as update the Next_Visit_date__c. Everything works fine!!

 

But the time based workflow doesn't fire again. I cannot use ISCHANGED() or PRIORVALUE() functions in Evaluation Criteria : When a record is created, or when a record is edited and did not previously meet the rule criteria.

 

I am thinking of creating a custom date field which will store the previous value of Next_Visit_Date__c and use that in the Rule criteria of time based workflow. Is there any better suggestion?

Please let me know.