• trounger
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 10
    Replies
"https://login.salesforce.com/services/oauth2/success" I uesd this url as my call back url to get accesstoken and refresh token, Iam developing code for middleware to integrate with IOS. I got access token as well refresh token also but by using that access token I could not pull data from server. I think access token is not correct. Excatly i dont know. Please some body help

hi guys i wrote a rest program like this 

 

@RestResource(urlMapping='/json1/*')
global with sharing class restclass
{
 @HttpPOST
   global static list<Account> getaccount()
   {
       list<Account> acclist = new list<Account>([Select id,Name,billingcity
       from account]);
       return acclist;
       }

 

but i want to display data on browser like if some one hit the method  url it has to display json data regarding all accounts

please help me to solve this issue 

 

Hi

guys

 

this is harsha 

i am trying to to dispaly diffrent fields on diffrent picklist option like assume that i have contact object consit of 30 fields and i have diffrent views like school contacts, working contacts etc... now if i choose school conatcts on the view i have  to dispaly only  10 fields in page so remaining fields in page has to be in hidden and if i choose  working conatcts i have display 25 fields so remaining 5 fields has to be in hidden 

 

here is another example

 

i have two diffrent types of leads like “Personal” or “Commercial”. This field exists today. When he selects  Personal in the dropdown, he expects to see a set of fields. When he selects Commercial a different set of fields should show up.

so how can i achieve this in SF.

 

please anyone let me know how i can achive this

 

Regards,

Harsha

hi guys  i am writing test class for scheduled apex class i wrote test class like regular apex class this but its showing 0% coverage after that i learned i have to write diffrently just like in this meterial http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm

 

But the i am allways writing scheduled apex class and  schedule those classes using schedule  button using develop ->apexclass->schedule button i never used cron expression and interface class so i am not getting how to write test class using above meterial anyone please help  me with this issue  here its my schedule class

 

global class shedulingaemail implements Schedulable{
   public date d2;
    global void execute(SchedulableContext ctx) {  
               d2 = system.today();         
    for(Contact c:[ select Id,Next_Due_Date__c,Next_Due_Date1__c,Personal_Email__c,acknowledgement__c from Contact] )  
    {
         if(c.Next_Due_Date1__c == d2 && c.acknowledgement__c != 'Received')
        {    
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(new String[] {c.Personal_Email__c} );
       // mail.setToAddresses(new String[] {c.Alternate_Email__c});
            mail.setReplyTo('lakshmid@bighelp.org');
            mail.setSenderDisplayName('Bighelp Notifications!');
            mail.setSubject('Renewal Request');
            mail.setBccSender(false);
            mail.setUseSignature(false);
               mail.setHtmlBody('<p> Dear <b> ' +c.Name +', </b></p>'+'<br></br>'+
                                   '<p>Bighelp For Education would like to thank you for kindly sponsoring the education of underprivileged children in India. Your support gave the hope for the bright future for the children who otherwise could not even dream about having any future! Following link has the information about your sponsoring children.</p>'+'<br></br>'+
                                   '<p>The next due date to renew your sponsorship'+c.Next_Due_Date__c+'. We request you to kindly renew your sponsorship so that we can continue supporting your sponsoring children. </p>'+'<br></br>'+
                                   '<p>If you decide to continue your sponsorship, please mail the donation for $132 ($11/month per child) to continue your sponsorship for one year. Please write check payable to "Bighelp For Education" and mail to following address.</p>'+'<br></br>'+
                                   '<p>Bighelp For Education</p>'+
                                   '<p>21C Hawthorne Village</p>'+
                                   '<p>Frankline,MA 02038, USA</p>'+'<br></br>'+
                                  '<p>Donation can also be made online through credit card or PayPal at following link.</p>'+'<br></br>'+
                                  '<p>http://www.bighelp.org/bhp/site/donatenow</p>'+'<br></br>'+
                                  '<p>Thank you so much for your continued support. We look forward to hear from you soon.</p>'+'<br></br>'+
                                  '<p>With best regards, </p>'+
                                 '<p>Bighelp For Education</p>'+
                                 '<p>www.bighelp.org</p>');
              //mail.setPlainTextBody('Hi a harsha this is sheduling mail cheking');
 // Send the email
         Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
            C.Next_due_date1__c = c.Next_due_date1__c + 7;
            update c;
             
    }
    }
}
}

Thanks in Advance

Hi guys i am new to salesforce  anyone plese tell how to write a test class for fallowing apex class

 

public with sharing class ChildrenwithNoDonor2 {
public id conid;
public id conid1;
public ChildrenwithNoDonor2(ApexPages.StandardController controller) {
conid = Apexpages.currentpage().getparameters().get('cid');
conid1 = conid;
}


//Our collection of the class/wrapper objects cContact

public list<sstudent> studentlist{get; set;}

//Our collection of the class/wrapper objects cContact
public list<sstudent> getstudent(){
if(studentlist == null)
{
studentlist = new list<sstudent>();
for(student__c s: [select id,name,Contact__c,First_Name__c,Village__c,Available_Date__c,District__c,Close_Date1__c,Start_Date1__c from Student__c where contact__c = null ])
{
// As each contact is processed we create a new cContact object and add it to the contactList

studentlist.add(new sstudent(s));
}
}
return studentlist;
}
public PageReference AddtoTheDonar() {
//We create a new list of Contacts that we be populated only with Contacts if they are selected

list<student__c> selectedstudent = new list<student__c>();
//We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
for(sstudent sstu: getstudent()){
if(sstu.selected == true){
//sstu.contact__c = conid;
//upsert sstu;
selectedstudent.add(sstu.stu);

}
else{

}
}
// Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc

system.debug('these are the selected contacts');
for(student__c ss: selectedstudent){
// Integer size = ss.size();
// for(Integer i=0;i<ss.size();i++)
// {
// Student__C s = ss.get(i);
ss.Contact__c = conid;
update ss;

// }

}
// system.debug(ss);
// }

studentlist = null;
// we need this line if we performed a write operation because getContacts gets a fresh list now
return null;
}
public PageReference Back() {

PageReference secondPage = new PageReference ('/'+conid1);
secondPage.setRedirect(true);
return secondPage;
}
// This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value

public class sstudent{
public student__c stu {get; set;}
public Boolean selected {get; set;}
//This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false

public sstudent(student__c s){
stu = s;
selected = false;
}
}
}

Thanks in advance

 hi guys I am new to sales force I am trying to display my standard page in visual force page like this 

 

<apex:page standardController="Student__c">
<apex:detail subject="{!Student__c}" relatedList="false" />
</apex:page>

 

if I mention id then it displaying that page 

but I want to display that page like read only 

but when I try the previous scenario if I modify the vales in the fields those refeleting the original standerd page   

i am trying to avoid it but it is working out

 

please any one let me know how to set readonly condition for that page

 

Thanks in advance

Hi i am new to salesforce 

i have a custom object named donation__c i wrote a trigger on donaton__c for calculate the days and denpend on that i am updating the date on his parent object  field next_due_date__c 

this is my trigger

 

trigger caldays on Donation__c (after insert, after update) {
    public decimal i;
for(donation__c s : trigger.new)
    {
        donation__c dd = [select id,Project_Type__c,amount__c,contact__c,amount_type__c,Date_Of_Donation__c from donation__c where id = :s.id];
        if(dd.amount_type__c == 'USD' && dd.amount__c != null)
        {
             i = dd.amount__c / 0.361643856164384;
        }
         else if(dd.amount_type__c == 'INR' && dd.amount__c != null)
         {
             i = dd.amount__c / 1.095890410958904;
                 
         }
            if(dd.Project_Type__c == 'Sponsor A Child' )
            {
                long l1 = i.round();
                id a = dd.contact__c;
                contact c = [ select id,Next_Due_Date__c from contact where id = :a];
            c.Next_Due_Date__c = dd.Date_Of_Donation__c + l1;
                update c;
            }
            }
    }

 

and i am trying to write test case for this trigger

 

@istest
private class caldaystest{

static testmethod void unittest()
{
decimal i;
donation__c d = new donation__c();
d.Date_Of_Donation__c = system.today() ;
d.amount_type__c = 'USD' ;
//d.Project_Type__c = 'Sponsor A Child';
d.amount__C = 250;
insert d;
if(d.Project_Type__c == 'Sponsor A Child' )
{
id a = d.contact__c;
long l1 = i.round();
contact c = [ select id,Next_Due_Date__c from contact where id = '003J000000eqnHh'];
c.Next_Due_Date__c = d.Date_Of_Donation__c + l1 ;
upsert c;
}


donation__c d1 = new donation__c();
d1.Date_Of_Donation__c = system.today() ;
d1.amount_type__c = 'INR' ;
d1.Project_Type__c = 'Sponsor A Child';
d1.amount__C = 250;
insert d1;
if(d1.Project_Type__c == 'Sponsor A Child' )
{
// id a1 = d1.contact__c;
long l1 = i.round();
contact c1 = [ select id,Next_Due_Date__c from contact where id = '003J000000eqnHh'];
c1.Next_Due_Date__c = d1.Date_Of_Donation__c + l1 ;
upsert c1;
}
}
}

like this its covering up to 84 percent but getting error like this

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, caldays: execution of AfterInsert

 

can any one help me solve this

 

Hi guys I got admin account from my company so I create a sand box from that for usage of development now my project is done when I tried to import my app from sand box to production its saying 
Managed package dependency detected
Change sets may not contain components that are part of a managed package, as indicated by the managed icon below. To deploy this change set into another organization, you must first install the AppExchange package(s) containing the managed components into that organization, if they are not already installed.

Then in the dependences I checked all except the managed package then its saying that like this 

You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. 

Can any one please help how to solve the issue

Hi guys I am new to sales force

 

I am trying to create a managed package from my sandbox but its saying that its possible in your organization please try developer edition like that but I created lot of things in sandbox 

can any tell how to create a managed package in sandbox

 

Thanks in advance

 

Hi every one i am new to salesforce 

currently i am trying tracking the a field named contact in custom object student

then in the student history i am getting 3 fields named as date, user, action 

'date' is showing that last modified date and time of the contact field 

and 'user' shows that who is owner

and 'action' showing that created , changed  and deleted like that

but student history table does not consist of any of these values 

 

 

now the problem is i want use 'date' field value that is last change of the perticular field (contact) then i want to update that value in visual force page page block table

 

so any one please tell me how to get that values

 

Thanks in advance

 

Hi

guys

 

this is harsha 

i am trying to to dispaly diffrent fields on diffrent picklist option like assume that i have contact object consit of 30 fields and i have diffrent views like school contacts, working contacts etc... now if i choose school conatcts on the view i have  to dispaly only  10 fields in page so remaining fields in page has to be in hidden and if i choose  working conatcts i have display 25 fields so remaining 5 fields has to be in hidden 

 

here is another example

 

i have two diffrent types of leads like “Personal” or “Commercial”. This field exists today. When he selects  Personal in the dropdown, he expects to see a set of fields. When he selects Commercial a different set of fields should show up.

so how can i achieve this in SF.

 

please anyone let me know how i can achive this

 

Regards,

Harsha

hi guys  i am writing test class for scheduled apex class i wrote test class like regular apex class this but its showing 0% coverage after that i learned i have to write diffrently just like in this meterial http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm

 

But the i am allways writing scheduled apex class and  schedule those classes using schedule  button using develop ->apexclass->schedule button i never used cron expression and interface class so i am not getting how to write test class using above meterial anyone please help  me with this issue  here its my schedule class

 

global class shedulingaemail implements Schedulable{
   public date d2;
    global void execute(SchedulableContext ctx) {  
               d2 = system.today();         
    for(Contact c:[ select Id,Next_Due_Date__c,Next_Due_Date1__c,Personal_Email__c,acknowledgement__c from Contact] )  
    {
         if(c.Next_Due_Date1__c == d2 && c.acknowledgement__c != 'Received')
        {    
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(new String[] {c.Personal_Email__c} );
       // mail.setToAddresses(new String[] {c.Alternate_Email__c});
            mail.setReplyTo('lakshmid@bighelp.org');
            mail.setSenderDisplayName('Bighelp Notifications!');
            mail.setSubject('Renewal Request');
            mail.setBccSender(false);
            mail.setUseSignature(false);
               mail.setHtmlBody('<p> Dear <b> ' +c.Name +', </b></p>'+'<br></br>'+
                                   '<p>Bighelp For Education would like to thank you for kindly sponsoring the education of underprivileged children in India. Your support gave the hope for the bright future for the children who otherwise could not even dream about having any future! Following link has the information about your sponsoring children.</p>'+'<br></br>'+
                                   '<p>The next due date to renew your sponsorship'+c.Next_Due_Date__c+'. We request you to kindly renew your sponsorship so that we can continue supporting your sponsoring children. </p>'+'<br></br>'+
                                   '<p>If you decide to continue your sponsorship, please mail the donation for $132 ($11/month per child) to continue your sponsorship for one year. Please write check payable to "Bighelp For Education" and mail to following address.</p>'+'<br></br>'+
                                   '<p>Bighelp For Education</p>'+
                                   '<p>21C Hawthorne Village</p>'+
                                   '<p>Frankline,MA 02038, USA</p>'+'<br></br>'+
                                  '<p>Donation can also be made online through credit card or PayPal at following link.</p>'+'<br></br>'+
                                  '<p>http://www.bighelp.org/bhp/site/donatenow</p>'+'<br></br>'+
                                  '<p>Thank you so much for your continued support. We look forward to hear from you soon.</p>'+'<br></br>'+
                                  '<p>With best regards, </p>'+
                                 '<p>Bighelp For Education</p>'+
                                 '<p>www.bighelp.org</p>');
              //mail.setPlainTextBody('Hi a harsha this is sheduling mail cheking');
 // Send the email
         Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
            C.Next_due_date1__c = c.Next_due_date1__c + 7;
            update c;
             
    }
    }
}
}

Thanks in Advance

Hi guys i am new to salesforce  anyone plese tell how to write a test class for fallowing apex class

 

public with sharing class ChildrenwithNoDonor2 {
public id conid;
public id conid1;
public ChildrenwithNoDonor2(ApexPages.StandardController controller) {
conid = Apexpages.currentpage().getparameters().get('cid');
conid1 = conid;
}


//Our collection of the class/wrapper objects cContact

public list<sstudent> studentlist{get; set;}

//Our collection of the class/wrapper objects cContact
public list<sstudent> getstudent(){
if(studentlist == null)
{
studentlist = new list<sstudent>();
for(student__c s: [select id,name,Contact__c,First_Name__c,Village__c,Available_Date__c,District__c,Close_Date1__c,Start_Date1__c from Student__c where contact__c = null ])
{
// As each contact is processed we create a new cContact object and add it to the contactList

studentlist.add(new sstudent(s));
}
}
return studentlist;
}
public PageReference AddtoTheDonar() {
//We create a new list of Contacts that we be populated only with Contacts if they are selected

list<student__c> selectedstudent = new list<student__c>();
//We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
for(sstudent sstu: getstudent()){
if(sstu.selected == true){
//sstu.contact__c = conid;
//upsert sstu;
selectedstudent.add(sstu.stu);

}
else{

}
}
// Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc

system.debug('these are the selected contacts');
for(student__c ss: selectedstudent){
// Integer size = ss.size();
// for(Integer i=0;i<ss.size();i++)
// {
// Student__C s = ss.get(i);
ss.Contact__c = conid;
update ss;

// }

}
// system.debug(ss);
// }

studentlist = null;
// we need this line if we performed a write operation because getContacts gets a fresh list now
return null;
}
public PageReference Back() {

PageReference secondPage = new PageReference ('/'+conid1);
secondPage.setRedirect(true);
return secondPage;
}
// This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value

public class sstudent{
public student__c stu {get; set;}
public Boolean selected {get; set;}
//This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false

public sstudent(student__c s){
stu = s;
selected = false;
}
}
}

Thanks in advance

 hi guys I am new to sales force I am trying to display my standard page in visual force page like this 

 

<apex:page standardController="Student__c">
<apex:detail subject="{!Student__c}" relatedList="false" />
</apex:page>

 

if I mention id then it displaying that page 

but I want to display that page like read only 

but when I try the previous scenario if I modify the vales in the fields those refeleting the original standerd page   

i am trying to avoid it but it is working out

 

please any one let me know how to set readonly condition for that page

 

Thanks in advance

Hi i am new to salesforce 

i have a custom object named donation__c i wrote a trigger on donaton__c for calculate the days and denpend on that i am updating the date on his parent object  field next_due_date__c 

this is my trigger

 

trigger caldays on Donation__c (after insert, after update) {
    public decimal i;
for(donation__c s : trigger.new)
    {
        donation__c dd = [select id,Project_Type__c,amount__c,contact__c,amount_type__c,Date_Of_Donation__c from donation__c where id = :s.id];
        if(dd.amount_type__c == 'USD' && dd.amount__c != null)
        {
             i = dd.amount__c / 0.361643856164384;
        }
         else if(dd.amount_type__c == 'INR' && dd.amount__c != null)
         {
             i = dd.amount__c / 1.095890410958904;
                 
         }
            if(dd.Project_Type__c == 'Sponsor A Child' )
            {
                long l1 = i.round();
                id a = dd.contact__c;
                contact c = [ select id,Next_Due_Date__c from contact where id = :a];
            c.Next_Due_Date__c = dd.Date_Of_Donation__c + l1;
                update c;
            }
            }
    }

 

and i am trying to write test case for this trigger

 

@istest
private class caldaystest{

static testmethod void unittest()
{
decimal i;
donation__c d = new donation__c();
d.Date_Of_Donation__c = system.today() ;
d.amount_type__c = 'USD' ;
//d.Project_Type__c = 'Sponsor A Child';
d.amount__C = 250;
insert d;
if(d.Project_Type__c == 'Sponsor A Child' )
{
id a = d.contact__c;
long l1 = i.round();
contact c = [ select id,Next_Due_Date__c from contact where id = '003J000000eqnHh'];
c.Next_Due_Date__c = d.Date_Of_Donation__c + l1 ;
upsert c;
}


donation__c d1 = new donation__c();
d1.Date_Of_Donation__c = system.today() ;
d1.amount_type__c = 'INR' ;
d1.Project_Type__c = 'Sponsor A Child';
d1.amount__C = 250;
insert d1;
if(d1.Project_Type__c == 'Sponsor A Child' )
{
// id a1 = d1.contact__c;
long l1 = i.round();
contact c1 = [ select id,Next_Due_Date__c from contact where id = '003J000000eqnHh'];
c1.Next_Due_Date__c = d1.Date_Of_Donation__c + l1 ;
upsert c1;
}
}
}

like this its covering up to 84 percent but getting error like this

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, caldays: execution of AfterInsert

 

can any one help me solve this

 

Hi every one i am new to salesforce 

currently i am trying tracking the a field named contact in custom object student

then in the student history i am getting 3 fields named as date, user, action 

'date' is showing that last modified date and time of the contact field 

and 'user' shows that who is owner

and 'action' showing that created , changed  and deleted like that

but student history table does not consist of any of these values 

 

 

now the problem is i want use 'date' field value that is last change of the perticular field (contact) then i want to update that value in visual force page page block table

 

so any one please tell me how to get that values

 

Thanks in advance

 

Hi,

 

Please help me to write test class for the following code......

 

 

global class TaskRemainder implements Schedulable
 {
  global void execute(SchedulableContext ctx)
  {
    List<Task> a = [SELECT id,CreatedDate,LastModifiedDate,Status,Subject FROM Task where Status='Not Started' and CreatedDate <: System.now()-2];
    String tmpmarkEmail='karanrajforu@gmail.com';
    String[] markEmail=tmpmarkEmail.split(',');
    for(Integer i=0;i<a.Size();i++)
      {
       Task t=[SELECT id,CreatedDate,LastModifiedDate,Status,OwnerId,WhoId,Subject,Priority FROM Task where Id =: a[i].Id];
       Lead l=[Select Id,OwnerId,Email,Phone,Description,Title,LastName,FirstName,Company From Lead where Id =:t.WhoId];
       User u=[Select FirstName,LastName from User where Id=:l.OwnerId];
       Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
       mail.setTargetObjectId(t.OwnerId);
       mail.setSubject('Remainder for Task');
       if(t.CreatedDate<System.now()-4)
       {
         mail.setCcAddresses(markEmail);
       }
       mail.setPlainTextBody('This is Remainder Mail\n\n\nThe Following Task is assigned For you\n\n\t Subject :  '+t.Subject+'\n'+'\n'+'\t Priority : '+t.Priority
                         +'\n'+'\n'+'\t Contact Name : '+l.LastName+' '+l.FirstName+'\n'+'\n'+'\t Email : '+l.Email+'\n'+'\n'+'\t Phone : '+l.Phone+'\n'+'\n'+'\t Title : '+l.Title+'\n'+'\n'+'\t Describtion : '+l.Description
                         + '\n\n\n');
       mail.setSaveAsActivity(false);    
       Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
  
      }
   }   
}

 

 

I dont have any idea to write test class for this code..please help me