• Uday K
  • NEWBIE
  • 35 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 14
    Replies
Hi All,

Can someone help me out to overcome this issue please.

Contact object is parent to custom object called RA via look up relationship, OWD settings on Contact is PRIVATE and profile permission for an user is only READ permission. There is a trigger on RA object that updates the related contact when RA status is assigned. So, when an user with above permissions change the status on RA to Assigned, we are getting apex script error : INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id. 

Please can someone give any idea how to overcome this error.

Its very urgent. early response is appreciated.

Thanks,
Uday
  • November 09, 2014
  • Like
  • 1
Hi Folks,

Can someone help me,

Am not able to see the line-by-line code coverage in Developer Console, though am able to see the percentage covered.

Is it a known issue or am doing something wrong.

Please suggest.

Many Thanks,
Uday
  • September 26, 2014
  • Like
  • 0
Hi All,

Multi currency has been enabled in our ORG, Now we want to get the Exchange rates updated regularly on daily basis automatically.
I hope we can accomplish this with API.

Can anyone post some code sample to update the Exchange rates automatically.

Thnaks in advance !!!!!!
Uday
  • April 23, 2014
  • Like
  • 0
Hi All,

Multi currency has been enabled in our ORG, Now we want to get the Exchange rates updated regularly on daily basis automatically. 
I hope we can accomplish this with API.

Can anyone post some code sample to update the Exchange rates automatically.

Thnaks in advance !!!!!!
Uday
  • April 23, 2014
  • Like
  • 0
Hi all,

Please,can someone suggest me how to skip the validation rules when only inserting the records but not on Updating,in the test class. Is that Test.LoadData() works out in my case?

Thanks in Advance
Uday
  • December 30, 2014
  • Like
  • 0
Hi all,

I am showing list of attachments against a record in the visualforce page, also showing a DELETE link  before each attachment. Now i want to delete the particular attachment when clicking on DELETE button. can someone help me out.

<apex:column >
     <apex:facet name="header">Attachment</apex:facet>
           <table border = '0' cellspacing="0" cellpadding="0">
              <tr><td><b><center><apex:outputLink value="/apex/AttachmentUpload?id={!card.time.id}" rendered="{!!(card.time.id ==                                                                                                                null)}">Upload</apex:outputLink></center></b><br/></td>
                        <td><apex:repeat var="attach" value="{!card.time.Attachments}">
                            <apex:outputLink value="/servlet/servlet.FileDownload?file={!attach.id}" target="_blank">
                                {!attach.Name}
                            </apex:outputLink>&nbsp;&nbsp;&nbsp;<b><a href="javascript:if (window.confirm('Are you sure?')) DeleteFile('{!attach.Id}');" style="font-weight:bold">Del</a></b><br/>
                        </apex:repeat></td></tr></table>
                </apex:column>

 Thanks,
Uday
  • December 26, 2013
  • Like
  • 0

Hello friends,

 

I have inserted QuoteDocument object in test class like below.

        Quote Qu = New Quote();
        qu.Name = 'Test Quote';
        qu.OpportunityId = opp.Id;
        Insert qu;

        string before = 'Testing base 64 encode';
        Blob beforeblob = Blob.valueOf(before);
      
        QuoteDocument qdoc = New QuoteDocument();
        qdoc.QuoteId = qu.Id;

        qdoc.Document = body;
        insert qdoc;

 In the hightlighted its giving error :

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, This field is required: [VersionData]

 

Can someone tell What is VersionData Field, How to pass value in test class. I have searched in salesforce documentation also, I didn't find any such Field of VersionData in QuoteDocument object.

 

Looking ahead for earlier response...

 

Thanks in Advance,

Uday

Hello all,

We have two users user1 and user2, both are administrators. I have logged in as user1 and have email signature belongs to user1, one of the email which sent to contact using scheduler from the salesforce have the user2 email signature. Dont know why?
I have checked the email settings, email footer, Default Workflow user, Ran the scheduler code once again and i got the correct Email signature that is User1 Email signature.

Seeking for an immediate help......

Thanks,
Uday

 

Hello All,

 

I have duplicate Accounts in my salesforce. How to find the duplicates based on First Name and Last Name through coding or something without using app.

Ex:  Rakesh Roy and Roy Rakesh are duplicates.

 

Can someone Help me.

 

Thanks in Advance,

Uday

Hello All,


I am getting the following exception in my trigger. I understood about this exception error and i tried many ways.

I am getting exception in this query.

can someone help me.

 

lContactPh = [Select Id,Phone,Format_Phone__c,Email,Personal_Email__c,Other_Email__c,AccountId from Contact Where Format_Phone__c  != null AND Format_Phone__c IN:phoneList ORDER BY CreatedDate DESC Limit 5000];

 

Format_Phone__c  is a formula field to populate the phone without format to use in query.

I tried to create unique field so that i can give in Where filter, But unfortunately the unique field limit is also exceeded.

I have more more that 2,50,000 contacts in my organization.

 

Thanks,

Uday

 

Hello All,


I have requirement like when ever case is inserting, i have to insert Account, Contact and assign the inserted account and Contact to  the case which is inserting. For this my approach is like below, But it wont work out because it is not getting Account id for inserting contact. How to achieve this?

I reuest anyone to give solution.

 

for (Case c : Trigger.New) // I am using before insert and Before Update
        {
            Account acc = New Account();
            acc.Name = c.SuppliedName;
            acc.Phone = c.SuppliedPhone;
            CreateAccount.add(acc);
            
            Contact con = New Contact();
            con.LastName = c.SuppliedName;
            con.AccountId = acc.Id;
            con.Phone = c.SuppliedPhone;
            con.Email = c.SuppliedEmail;
            CreateContact.add(con);
 

           c.AccountId = acc.Id;
            c.ContactId = con.Id;
         }
        insert CreateAccount; //List of Account
        insert CreateContact; //List of Contact

 

Thanks,

Uday

Hello all,

This is my calss:

public class ClS_RecentItem {
public string RecOpp{get;set;}
public list<opportunity> lstOpp{get;set;}
public list<string> name{get;set;}
public list<string> ids{get;set;}
public list<string> type{get;set;}

public NewWrapperClass cls1{get;set;}

public ClS_RecentItem ()
{
   name= new list<string>();
   ids= new list<string>();
   Type= new list<string>();

Http httpProtocol = new Http();
HttpRequest request = new HttpRequest();
request.setHeader('Authorization', 'OAuth '+UserInfo.getSessionId());
request.setEndPoint('https://cs6.salesforce.com/services/data/v26.0/recent');
//request.setEndPoint('https://ap1.salesforce.com/services/data/v26.0/sobjects/Opportunity');
request.setMethod('GET');
HttpResponse response = httpProtocol.send(request);
String jsonInput = response.getBody();
jsonInput  = '{ "test1":' + jsonInput + '}';
system.debug('===>'+jsonInput);

System.JSONParser parser = JSON.createParser(jsonInput);
system.debug('aaaaaa'+parser);
System.Type tp1 = System.Type.forName('NewWrapperClass');
system.debug('===)'+tp1+'++++++'+cls1);
cls1 = (NewWrapperClass)parser.readValueAs(tp1);
System.debug('Wrap class : ' + cls1 );
}
}

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

This is my test class for the above class.

public class test_ClS_RecentItem
{
    @isTest static void testCallout()
    {
        Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());

        HttpResponse res = CalloutClass.getInfoFromExternalService();
        
         String contentType = res.getHeader('Content-Type');
        System.assert(contentType == 'application/json');
        String actualValue = res.getBody();
        String expectedValue = '{"ohhh":"good"}';
        System.assertEquals(actualValue, expectedValue);
        System.assertEquals(200, res.getStatusCode());
        NewWrapperClass nwc = New NewWrapperClass();
        List<NewWrapperClass> nwcl = New List<NewWrapperClass>();
        NewWrapperClass.SubWrapperClass nwcs= New NewWrapperClass.SubWrapperClass();
        NewWrapperClass.AttributesWrapper nwcaa = New NewWrapperClass.AttributesWrapper();
        ClS_RecentItem recItem = New ClS_RecentItem();
    }
}

 and my Wrapper class is:

public class NewWrapperClass
{
    public List<SubWrapperClass> test1{get;set;}
      
    public class SubWrapperClass
    {
        public AttributesWrapper attributes{get;set;}
        public string Id{get;set;}
        public string Name{get;set;}
        public string CaseNumber{get;set;}
    
    }
    public class AttributesWrapper
    {
        public string type{get;set;}
        public string url{get;set;}
    }
}

Can some one help me out  why i am getting the below exception. But my coverage is 100%

System.JSONException: Expected LIST<NewWrapperClass.SubWrapperClass> but found { at [line:1, column:3]

(This error is pointing to the unlined line in the class.)

 

Thanks,

Uday

 

Hello All,

 

We have site for passenger registration form. When we click a button on Opportunity, the email will be sent to the passenger with link requesting to fill the form and submit the details.

Now the problem is when the passenger clicks on the link in his mail the link is getting opened without the HTTPS.

The actual link in email is like this https://secure.travel.com/VF_BookingDetails?id=a06G000000MVuO5IAL.

But when the passenger clicks on the above link its opening like this secure.travel.com/VF_BookingDetails?id=a06G000000MVuO5IAL


Its a secure page. we want it to get encrypted and also the page should open with starting HTTPS://

 

Thanks,

Uday

  • April 04, 2013
  • Like
  • 0

Hello All,

 

Below java Script code is working fine in all browsers. But this is not working in IE.
Please anyone give an immediate response.

This is Java Script code on VF Page

function checkAcknowledgement(){
 if (acknowledgement.checked == false){
alert('Please read Agreement and Terms.');
return false;
}else {
return true;
}
}

 

This is input tag in the VF page where i used the above Java Script.

<input type="checkbox" id="acknowledgement" name="ack" />&nbsp;&nbsp; &nbsp; &nbsp;I agree to these terms &nbsp;&nbsp;  &nbsp;&nbsp; &nbsp;<apex:commandLink value="View" style="color:red;" onclick="check1();return false;" /> &nbsp;&nbsp; &nbsp; &nbsp;   </td> (This is check box.)

 

<apex:outputText rendered="{!boolimg}"><apex:commandLink action="{!insertPayInfo}"  id="theCommandLink2"     onclick="return checkAcknowledgement(this)" >  <apex:image value="{!$Resource.PayNow}" /></apex:commandLink></apex:outputText> (This is Command Button. When i click this button it should give java script alert pop up, if the checkbox is not checked)

 

Thanks,

Uday

  • March 26, 2013
  • Like
  • 0

Hello All,

 

Can anyone give idea how to achieve the below requirement?

I have Policy Custom Object, Which is related to Account. There is a "renewal due date" field 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.

 

Awaiting for early response.

Thanks,

Uday

  • March 25, 2013
  • Like
  • 0

Hello All,

 

when i try to cover the below code in the test class. The only first if condition is getting covered and it is not checking or covering the second if condition even if i write another test method in the test class.


And if i remove the return null statement and run the test class, it is covering all the blocks. But the condition is not validating (i.e., not giving any page message) and bypassing the conditions.

 

Can anyone give me an immediate reply. Would be very helpful.

 

public pagereference insertPayInfo(){

             if(creobj.CC1_Apartment__c=='' || creobj.CC1_Apartment__c == null)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Fatal,'Please Input Postal Code'));
                return null;
            }   
            if(creobj.CC1_City_Town__c=='' || creobj.CC1_City_Town__c == null)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Fatal,'Please Input City or Town'));
                return null;
            }  

pagereference pgref=new pagereference('www.salesforce.com');
return pgref;

}

 

 

Thanks,

Uday

  • March 22, 2013
  • Like
  • 0

Hello all,

Please help me how to cover the red highlighted block below.

 

I am getting the 70% coverage in the test class. The constructor block is not getting covered. Can you please help me.

 

public class CLS_AccountEditPage {
public String Account { get; set; }
Public String CompanyType{get;set;}
Public String AccountName{get;set;}
Public String Industry{get;set;}
Public String AccountSiteCity{get;set;}
Public String Phone{get;set;}
Public String Website{get;set;}
Public String ParentAccount{get;set;}
Public String AccountSiteLocation{get;set;}
public Account acc{get;set;}
public string surl = '';
public id aid{get;set;}
   
public CLS_AccountEditPage ()
{
acc=new account();
if(ApexPages.currentPage().getUrl() != null)
  {
    surl = ApexPages.currentPage().getUrl();
    if(surl.contains('001'))
   {
    aid= ApexPages.currentPage().getParameters().get('id');
    if(aid!=null  && aid!='')
    {
    acc=[select name,Industry,phone,Website,Account_Site_Location__c,Company_Type__c,Account_Site_City__c  from Account where id=:aid];
    AccountName=acc.name;
    Industry=acc.Industry;
    phone=acc.phone;
    Website=acc.Website;
    CompanyType=acc.Company_Type__c;
    AccountSiteCity=acc.Account_Site_City__c;
    AccountSiteLocation=acc.Account_Site_Location__c;
   }
    }
}
}
public  PageReference insertdata()
{
try{
acc.Name=AccountName;
acc.Industry=Industry;
acc.Phone=Phone;
acc.Website=Website;
acc.Company_Type__c=CompanyType;
acc.Account_Site_Location__c=AccountSiteLocation;
acc.Account_Site_City__c=AccountSiteCity;
insert acc;
}
catch(Exception e){
update acc;
}
PageReference pr=new PageReference('/'+acc.id);
return pr;
}
}

Test class;
@isTest
Public class Test_Cls_ContactEdit
{
   Public Static testMethod void AccountEdit()
   {
      Cls_AccountEdit cc = new Cls_ContactEdit();
      cc.title = 'Mr.';
      cc.FirstName = 'Swamy';
      cc.LastName = 'Penchal';
      cc.leadsource = 'Other';
      cc.Email = 'test@testorg.com';
      cc.Mobile = '5468745478';
      cc.Phone = '8487484568';
      cc.Description = 'Good';
      cc.insertdata();
      
      PageReference pageRef = Page.VF_AccounteditPage;
      Test.setCurrentPage(pageRef);
      Cls_ContactEdit ccc = new Cls_ContactEdit();
      ccc.LastName = 'Penchala';
      ApexPages.currentPage().getUrl();
      String s = cc.Save().getUrl();
      ccc.surl = '001';
      String c = ApexPages.currentPage().getParameters().put('id','001Z000000KRcRe');
      String d = ApexPages.currentPage().getParameters().get('id');
      System.debug('@@@@@@'+s+'$$$$$$'+c+'!!!!!!'+d);
      ccc.cid = '001Z000000KRcRe';
      System.debug('@@@@@@'+s);
      ccc.insertdata();
      ccc.Cancel();
   }
}


Thanks,

Uday

 

  • February 27, 2013
  • Like
  • 0

Hi all,

I am getting the 70% coverage in the test class and also am getting the exception error "System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []", "Class.CLS_AccountEditPage.insertdata&colon; line 60, column 1
Class.Test_CLS_AccountEditPage.AccountEditPage: line 36, column 1". The constructor block is not getting covered. Can some one help me.

 

public class CLS_AccountEditPage {
public String Account { get; set; }
Public String CompanyType{get;set;}
Public String AccountName{get;set;}
Public String Industry{get;set;}
Public String AccountSiteCity{get;set;}
Public String Phone{get;set;}
Public String Website{get;set;}
Public String ParentAccount{get;set;}
Public String AccountSiteLocation{get;set;}
public Account acc{get;set;}
public string surl = '';
public id aid{get;set;}
   
public CLS_AccountEditPage ()
{
acc=new account();
if(ApexPages.currentPage().getUrl() != null)
  {
    surl = ApexPages.currentPage().getUrl();
    if(surl.contains('001'))
   {
    aid= ApexPages.currentPage().getParameters().get('id');
    if(aid!=null  && aid!='')
    {
    acc=[select name,Industry,phone,Website,Account_Site_Location__c,Company_Type__c,Account_Site_City__c  from Account where id=:aid];
    AccountName=acc.name;
    Industry=acc.Industry;
    phone=acc.phone;
    Website=acc.Website;
    CompanyType=acc.Company_Type__c;
    AccountSiteCity=acc.Account_Site_City__c;
    AccountSiteLocation=acc.Account_Site_Location__c;
   }
    }
}
}
public  PageReference insertdata()
{
try{
acc.Name=AccountName;
acc.Industry=Industry;
acc.Phone=Phone;
acc.Website=Website;
acc.Company_Type__c=CompanyType;
acc.Account_Site_Location__c=AccountSiteLocation;
acc.Account_Site_City__c=AccountSiteCity;
insert acc;
}
catch(Exception e){
update acc;
}
PageReference pr=new PageReference('/'+acc.id);
return pr;
}
}

Test class;
@isTest
Public class Test_CLS_AccountEditPage
{
  Public static testMethod void AccountEditPage()
  {
    Account acc = new Account();
    acc.Name = 'Uday Test';
    //acc.Account = 'chatter';
    acc.Industry = 'Hotel';
    acc.Phone = '8375069778';
    acc.Website = 'www.google.com';
    acc.Company_Type__c = 'Sparkle Clean';
    acc.Account_Site_Location__c = 'India';
    acc.Account_Site_City__c = 'Delhi';
    insert acc;
    PageReference pageRef = Page.VF_AccountEditPage;
    Test.setCurrentPage(pageRef);
    CLS_AccountEditPage accEdit = new CLS_AccountEditPage();
    accEdit.surl = '001';
    accEdit.insertdata();
     apexpages.currentpage().getparameters().put('id',acc.id);
  }
}


Thanks,

Uday

  • February 22, 2013
  • Like
  • 0

Hello Friends,
I am trying to develop a visualforce page in which I am having a page block table
<apex:pageBlockTable value="{!WorkAddList}" var="WrkForecast">
<apex:column headerValue="Date ">
<apex:inputField value="{!Wrkcastt.Date__c}"/>
</apex:column>
<apex:column headerValue="Quantity">
<apex:inputField value="{!Wrkcast.Quantity__c}"/>
</apex:column>
<apex:column headerValue="Revenue">
<apex:inputField value="{!Wrkcast.Revenue__c}"/>
</apex:column>
<apex:column headerValue="Comments">
<apex:inputField value="{!Wrkcast.Comments__c}"/>
</apex:column>
<apex:column headerValue="Product Name">
<apex:outputField value="{!Wrkcast.Product_Name__c}"/>
</apex:column>
</apex:pageBlockTable>
Here wrkcast is my custom object and quote is its parent.here i am having one button named new workschedule in related list of quote which is bringing me on my VF Page.so on click i am creating some rows for wrkcast object for insering the records in wrkcast object.On click on button i want product and revenue should bring the value from quoteline object .
How can I do this?
for(i=0;i<n;i++)
{
WorkcastAddList.add(new Work_Schedule__c());
}
}

  • January 29, 2013
  • Like
  • 0

I am using iframe and giving vf page in that.In the vf page when when i am clicking to the save button it is going to the another page.but is calling the reference page in the i frame.How can i close the window which is containing the iframe and the open the referenced page in new tab.

 

<apex:page >

    <apex:form >
         <apex:commandButton value="Close" onclick="window.top.close()"/>
    </apex:form>

</apex:page>

 

Thanks,

Uday

  • January 24, 2013
  • Like
  • 0
Hi All,

Can someone help me out to overcome this issue please.

Contact object is parent to custom object called RA via look up relationship, OWD settings on Contact is PRIVATE and profile permission for an user is only READ permission. There is a trigger on RA object that updates the related contact when RA status is assigned. So, when an user with above permissions change the status on RA to Assigned, we are getting apex script error : INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id. 

Please can someone give any idea how to overcome this error.

Its very urgent. early response is appreciated.

Thanks,
Uday
  • November 09, 2014
  • Like
  • 1
Hi Folks,

Can someone help me,

Am not able to see the line-by-line code coverage in Developer Console, though am able to see the percentage covered.

Is it a known issue or am doing something wrong.

Please suggest.

Many Thanks,
Uday
  • September 26, 2014
  • Like
  • 0
Hi all,

I am showing list of attachments against a record in the visualforce page, also showing a DELETE link  before each attachment. Now i want to delete the particular attachment when clicking on DELETE button. can someone help me out.

<apex:column >
     <apex:facet name="header">Attachment</apex:facet>
           <table border = '0' cellspacing="0" cellpadding="0">
              <tr><td><b><center><apex:outputLink value="/apex/AttachmentUpload?id={!card.time.id}" rendered="{!!(card.time.id ==                                                                                                                null)}">Upload</apex:outputLink></center></b><br/></td>
                        <td><apex:repeat var="attach" value="{!card.time.Attachments}">
                            <apex:outputLink value="/servlet/servlet.FileDownload?file={!attach.id}" target="_blank">
                                {!attach.Name}
                            </apex:outputLink>&nbsp;&nbsp;&nbsp;<b><a href="javascript:if (window.confirm('Are you sure?')) DeleteFile('{!attach.Id}');" style="font-weight:bold">Del</a></b><br/>
                        </apex:repeat></td></tr></table>
                </apex:column>

 Thanks,
Uday
  • December 26, 2013
  • Like
  • 0

Hi,  I just thought I'd confirm if there are still no workarounds for pointing domains to a secure HTTPS Force.com Site URL?  

Non secure (http) URL's can be pointed to but for secure force.com site URL's this feature was previously not possible.

Domain Management is a new feature recently intriduced but I note no mention of https scenarios.

 

https://help.salesforce.com/HTViewHelpDoc?id=domain_mgmt_overview.htm&language=en_US

 

Is it correct therefore that https://<custom-demain>.secure.force.com will still be required for all HTTPS sites?

 

Thanks in advance for any help on this.

 

 

 

 

Hello friends,

 

I have inserted QuoteDocument object in test class like below.

        Quote Qu = New Quote();
        qu.Name = 'Test Quote';
        qu.OpportunityId = opp.Id;
        Insert qu;

        string before = 'Testing base 64 encode';
        Blob beforeblob = Blob.valueOf(before);
      
        QuoteDocument qdoc = New QuoteDocument();
        qdoc.QuoteId = qu.Id;

        qdoc.Document = body;
        insert qdoc;

 In the hightlighted its giving error :

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, This field is required: [VersionData]

 

Can someone tell What is VersionData Field, How to pass value in test class. I have searched in salesforce documentation also, I didn't find any such Field of VersionData in QuoteDocument object.

 

Looking ahead for earlier response...

 

Thanks in Advance,

Uday

Hello All,

 

I have duplicate Accounts in my salesforce. How to find the duplicates based on First Name and Last Name through coding or something without using app.

Ex:  Rakesh Roy and Roy Rakesh are duplicates.

 

Can someone Help me.

 

Thanks in Advance,

Uday

Hello all,

This is my calss:

public class ClS_RecentItem {
public string RecOpp{get;set;}
public list<opportunity> lstOpp{get;set;}
public list<string> name{get;set;}
public list<string> ids{get;set;}
public list<string> type{get;set;}

public NewWrapperClass cls1{get;set;}

public ClS_RecentItem ()
{
   name= new list<string>();
   ids= new list<string>();
   Type= new list<string>();

Http httpProtocol = new Http();
HttpRequest request = new HttpRequest();
request.setHeader('Authorization', 'OAuth '+UserInfo.getSessionId());
request.setEndPoint('https://cs6.salesforce.com/services/data/v26.0/recent');
//request.setEndPoint('https://ap1.salesforce.com/services/data/v26.0/sobjects/Opportunity');
request.setMethod('GET');
HttpResponse response = httpProtocol.send(request);
String jsonInput = response.getBody();
jsonInput  = '{ "test1":' + jsonInput + '}';
system.debug('===>'+jsonInput);

System.JSONParser parser = JSON.createParser(jsonInput);
system.debug('aaaaaa'+parser);
System.Type tp1 = System.Type.forName('NewWrapperClass');
system.debug('===)'+tp1+'++++++'+cls1);
cls1 = (NewWrapperClass)parser.readValueAs(tp1);
System.debug('Wrap class : ' + cls1 );
}
}

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

This is my test class for the above class.

public class test_ClS_RecentItem
{
    @isTest static void testCallout()
    {
        Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator());

        HttpResponse res = CalloutClass.getInfoFromExternalService();
        
         String contentType = res.getHeader('Content-Type');
        System.assert(contentType == 'application/json');
        String actualValue = res.getBody();
        String expectedValue = '{"ohhh":"good"}';
        System.assertEquals(actualValue, expectedValue);
        System.assertEquals(200, res.getStatusCode());
        NewWrapperClass nwc = New NewWrapperClass();
        List<NewWrapperClass> nwcl = New List<NewWrapperClass>();
        NewWrapperClass.SubWrapperClass nwcs= New NewWrapperClass.SubWrapperClass();
        NewWrapperClass.AttributesWrapper nwcaa = New NewWrapperClass.AttributesWrapper();
        ClS_RecentItem recItem = New ClS_RecentItem();
    }
}

 and my Wrapper class is:

public class NewWrapperClass
{
    public List<SubWrapperClass> test1{get;set;}
      
    public class SubWrapperClass
    {
        public AttributesWrapper attributes{get;set;}
        public string Id{get;set;}
        public string Name{get;set;}
        public string CaseNumber{get;set;}
    
    }
    public class AttributesWrapper
    {
        public string type{get;set;}
        public string url{get;set;}
    }
}

Can some one help me out  why i am getting the below exception. But my coverage is 100%

System.JSONException: Expected LIST<NewWrapperClass.SubWrapperClass> but found { at [line:1, column:3]

(This error is pointing to the unlined line in the class.)

 

Thanks,

Uday

 

Hello All,

 

We have site for passenger registration form. When we click a button on Opportunity, the email will be sent to the passenger with link requesting to fill the form and submit the details.

Now the problem is when the passenger clicks on the link in his mail the link is getting opened without the HTTPS.

The actual link in email is like this https://secure.travel.com/VF_BookingDetails?id=a06G000000MVuO5IAL.

But when the passenger clicks on the above link its opening like this secure.travel.com/VF_BookingDetails?id=a06G000000MVuO5IAL


Its a secure page. we want it to get encrypted and also the page should open with starting HTTPS://

 

Thanks,

Uday

  • April 04, 2013
  • Like
  • 0

Hello All,

 

when i try to cover the below code in the test class. The only first if condition is getting covered and it is not checking or covering the second if condition even if i write another test method in the test class.


And if i remove the return null statement and run the test class, it is covering all the blocks. But the condition is not validating (i.e., not giving any page message) and bypassing the conditions.

 

Can anyone give me an immediate reply. Would be very helpful.

 

public pagereference insertPayInfo(){

             if(creobj.CC1_Apartment__c=='' || creobj.CC1_Apartment__c == null)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Fatal,'Please Input Postal Code'));
                return null;
            }   
            if(creobj.CC1_City_Town__c=='' || creobj.CC1_City_Town__c == null)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Fatal,'Please Input City or Town'));
                return null;
            }  

pagereference pgref=new pagereference('www.salesforce.com');
return pgref;

}

 

 

Thanks,

Uday

  • March 22, 2013
  • Like
  • 0

Hello all,

Please help me how to cover the red highlighted block below.

 

I am getting the 70% coverage in the test class. The constructor block is not getting covered. Can you please help me.

 

public class CLS_AccountEditPage {
public String Account { get; set; }
Public String CompanyType{get;set;}
Public String AccountName{get;set;}
Public String Industry{get;set;}
Public String AccountSiteCity{get;set;}
Public String Phone{get;set;}
Public String Website{get;set;}
Public String ParentAccount{get;set;}
Public String AccountSiteLocation{get;set;}
public Account acc{get;set;}
public string surl = '';
public id aid{get;set;}
   
public CLS_AccountEditPage ()
{
acc=new account();
if(ApexPages.currentPage().getUrl() != null)
  {
    surl = ApexPages.currentPage().getUrl();
    if(surl.contains('001'))
   {
    aid= ApexPages.currentPage().getParameters().get('id');
    if(aid!=null  && aid!='')
    {
    acc=[select name,Industry,phone,Website,Account_Site_Location__c,Company_Type__c,Account_Site_City__c  from Account where id=:aid];
    AccountName=acc.name;
    Industry=acc.Industry;
    phone=acc.phone;
    Website=acc.Website;
    CompanyType=acc.Company_Type__c;
    AccountSiteCity=acc.Account_Site_City__c;
    AccountSiteLocation=acc.Account_Site_Location__c;
   }
    }
}
}
public  PageReference insertdata()
{
try{
acc.Name=AccountName;
acc.Industry=Industry;
acc.Phone=Phone;
acc.Website=Website;
acc.Company_Type__c=CompanyType;
acc.Account_Site_Location__c=AccountSiteLocation;
acc.Account_Site_City__c=AccountSiteCity;
insert acc;
}
catch(Exception e){
update acc;
}
PageReference pr=new PageReference('/'+acc.id);
return pr;
}
}

Test class;
@isTest
Public class Test_Cls_ContactEdit
{
   Public Static testMethod void AccountEdit()
   {
      Cls_AccountEdit cc = new Cls_ContactEdit();
      cc.title = 'Mr.';
      cc.FirstName = 'Swamy';
      cc.LastName = 'Penchal';
      cc.leadsource = 'Other';
      cc.Email = 'test@testorg.com';
      cc.Mobile = '5468745478';
      cc.Phone = '8487484568';
      cc.Description = 'Good';
      cc.insertdata();
      
      PageReference pageRef = Page.VF_AccounteditPage;
      Test.setCurrentPage(pageRef);
      Cls_ContactEdit ccc = new Cls_ContactEdit();
      ccc.LastName = 'Penchala';
      ApexPages.currentPage().getUrl();
      String s = cc.Save().getUrl();
      ccc.surl = '001';
      String c = ApexPages.currentPage().getParameters().put('id','001Z000000KRcRe');
      String d = ApexPages.currentPage().getParameters().get('id');
      System.debug('@@@@@@'+s+'$$$$$$'+c+'!!!!!!'+d);
      ccc.cid = '001Z000000KRcRe';
      System.debug('@@@@@@'+s);
      ccc.insertdata();
      ccc.Cancel();
   }
}


Thanks,

Uday

 

  • February 27, 2013
  • Like
  • 0

Hi all,

I am getting the 70% coverage in the test class and also am getting the exception error "System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []", "Class.CLS_AccountEditPage.insertdata&colon; line 60, column 1
Class.Test_CLS_AccountEditPage.AccountEditPage: line 36, column 1". The constructor block is not getting covered. Can some one help me.

 

public class CLS_AccountEditPage {
public String Account { get; set; }
Public String CompanyType{get;set;}
Public String AccountName{get;set;}
Public String Industry{get;set;}
Public String AccountSiteCity{get;set;}
Public String Phone{get;set;}
Public String Website{get;set;}
Public String ParentAccount{get;set;}
Public String AccountSiteLocation{get;set;}
public Account acc{get;set;}
public string surl = '';
public id aid{get;set;}
   
public CLS_AccountEditPage ()
{
acc=new account();
if(ApexPages.currentPage().getUrl() != null)
  {
    surl = ApexPages.currentPage().getUrl();
    if(surl.contains('001'))
   {
    aid= ApexPages.currentPage().getParameters().get('id');
    if(aid!=null  && aid!='')
    {
    acc=[select name,Industry,phone,Website,Account_Site_Location__c,Company_Type__c,Account_Site_City__c  from Account where id=:aid];
    AccountName=acc.name;
    Industry=acc.Industry;
    phone=acc.phone;
    Website=acc.Website;
    CompanyType=acc.Company_Type__c;
    AccountSiteCity=acc.Account_Site_City__c;
    AccountSiteLocation=acc.Account_Site_Location__c;
   }
    }
}
}
public  PageReference insertdata()
{
try{
acc.Name=AccountName;
acc.Industry=Industry;
acc.Phone=Phone;
acc.Website=Website;
acc.Company_Type__c=CompanyType;
acc.Account_Site_Location__c=AccountSiteLocation;
acc.Account_Site_City__c=AccountSiteCity;
insert acc;
}
catch(Exception e){
update acc;
}
PageReference pr=new PageReference('/'+acc.id);
return pr;
}
}

Test class;
@isTest
Public class Test_CLS_AccountEditPage
{
  Public static testMethod void AccountEditPage()
  {
    Account acc = new Account();
    acc.Name = 'Uday Test';
    //acc.Account = 'chatter';
    acc.Industry = 'Hotel';
    acc.Phone = '8375069778';
    acc.Website = 'www.google.com';
    acc.Company_Type__c = 'Sparkle Clean';
    acc.Account_Site_Location__c = 'India';
    acc.Account_Site_City__c = 'Delhi';
    insert acc;
    PageReference pageRef = Page.VF_AccountEditPage;
    Test.setCurrentPage(pageRef);
    CLS_AccountEditPage accEdit = new CLS_AccountEditPage();
    accEdit.surl = '001';
    accEdit.insertdata();
     apexpages.currentpage().getparameters().put('id',acc.id);
  }
}


Thanks,

Uday

  • February 22, 2013
  • Like
  • 0

I am using iframe and giving vf page in that.In the vf page when when i am clicking to the save button it is going to the another page.but is calling the reference page in the i frame.How can i close the window which is containing the iframe and the open the referenced page in new tab.

 

<apex:page >

    <apex:form >
         <apex:commandButton value="Close" onclick="window.top.close()"/>
    </apex:form>

</apex:page>

 

Thanks,

Uday

  • January 24, 2013
  • Like
  • 0
Hi Everyone,

I have taken Month, Day, Year as three different strings and assigned it to a new variable DateOfBirth. Then i passed it into the date of birth field in the object, its working fine. But when i am trying to test my test class. Its giving the following error if i pass the day, month, year individually also.

System.TypeException: Invalid date: 12/null/null.

Awaiting  for Early response. Its urgent Please.

Thanks,
Uday
  • January 08, 2013
  • Like
  • 0