• Mahesh Babu 3
  • NEWBIE
  • 45 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 17
    Replies
Hi , I created a Salesforce site , to make a rest api call from out side website. Even if stop the object permission my rest api class can create records to the objects. Where as my normal class not allowing to create records in the object with out permission. Also i try to set field level permissions. How to make the rest api class to obey the object permissions ? Below is the code i used  @RestResource(urlMapping='/myservice')
global with sharing class MyService  {                  
@HttpPost            
global static void doPost()          
{            
I will get the Json string from other site and insert into my custome object.  If i remove the permission of the object it should not create records. }
}
Hi,

I have 3 http callouts in batch - execute method, i am writting test class for batch class. I have created Mock test class.
Problem is: i can able to cover first callout, but not 2nd and 3rd callout
Please tell me how many callouts we can test from test class, please advise me how can i do this

 
Hello,

I am trying to validate password and showing the error message on VF page 
Validation: Password must be mixed of alphabet and numeric

My code is in below
VF page Code:
<apex:page controller="sample123class">
    <apex:form >                
        <apex:inputText html-placeholder=" Enter user name " /> <br/><br/>
        <apex:inputText html-placeholder=" Enter password " value="{!passInput}"/> <br/>  <br/>
        <apex:commandButton action="{!loginmethod}" value="login" id="set" />                                                               
    </apex:form>
</apex:page>

Controller:
public with sharing class sample123class {
    public string passInput{get;set;}
    public PageReference loginmethod() {
       if(Pattern.matches('[[0-9][a-z][A-Z]]*',passInput)){{  
            PageReference pg = new PageReference('/apex/samplehomepage');             
            return pg;
        }
        else{
            apexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'Your password code must have a mix of letters and numbers'));    
            return null;  
        }     
    }
}


Please provide the suitable 'Regex pattern' to achieve this

 
Hi All,

I am trying to subtract two datetime fields but i got below error message,
" Date/time arithmetic expressions must use Integer, Decimal or Double arguments "

My code is in below

CronTrigger ct = [SELECT Id,NextFireTime,starttime, CronJobDetail.name FROM CronTrigger where CronJobDetail.name = 'samplejob001' limit 1];
integer temp =  ct.NextFireTime - ct.starttime;
System.debug('=====>'+temp);

Please guide me, how to solve this issue.
 
Hi All,

My requirement is, need to run the apex code (for field updation) before/after user session expiration, please advise me how to achieve this 
Info: here user is partner portal user

Thanks inadvance,
Hi All,

i have seen this from saleforce help 
-> The last three passwords are remembered and cannot be reused when you are changing your password.
Please check this link,  https://help.salesforce.com/HTViewHelpDoc?id=security_overview_passwords.htm&language=en_US

But the method System.setPassword() is not follows the above limit. I have used this method to set the password for portal users and this function used to reset the alredy used password
For example:
1 time password is demo001
2 time demo002
3 time i have used again demo001 then not showing any error its restting the password with demo001

Please advise me why is working, tell me any setups to aviod this

Thanks
Hi All,

I am trying to display the account phone on vf page in this standard phone format (xxx) xxx-xxxx
Format has displayed in required format if user inserted the account record by manual
Format has not displayed in required format if account records inserted by using any import wizards/ apex code / data loader, (displayed in normal format like xxxxxxxxxx)

Please guide me how to resolve this issue

 
Hi All,

I am using the <knowledge:articleList> component to display the article title, but i want to display custom field value also in this. Please give me the confirmation about possibility to achieve this or provide any workarounds for this
Hi All,
Issue: VF page getting the wrong votes/points if change the query dynamically

Actually i am trying to display the all ideas with votes in ascending or descending order by title.

Ascending Order: Query has built in constructor, displaying vote and title in proper manner (Working fine)

Descending Order: Query has built in method, will fire when the user click on the button 'DESC'. This should display the ideas vote and title in descending order, but this is not showing in proper manner
Problem: Idea Titles are displaying in Descending order but Votes are displaying in ascending order

Please check the below codes:
VF page:
=========
<apex:page standardController="idea" extensions="ideasample01cls" showHeader="false" standardStylesheets="false" >
    <style>
        .votePanelstyl{
           font-family:calibri;         
        }
        .IdeaListTitle{   
            float: left;  
            font-size: 14px; 
            font-family: 'Calibri'; 
            color: blue;
        } 
    </style>
    <apex:form >
        <apex:commandButton  rerender="panelid" style="margin-left:300px;margin-top:10px;margin-bottom:20px" value="Desc" action="{!samplemthod}" />
        <apex:outputPanel id="panelid">
            <apex:repeat value="{!idealistP}" var="ida">                
                <table width="100%" border="0">
                    <tr>
                        <td width="20%">
                            <div class="votePanelstyl" >
                                <apex:outputPanel id="votePanel" >                                                    
                                    <apex:vote objectId="{!ida.id}" rerender="IdeaList" /> <br/>                                                                               
                                </apex:outputPanel>
                            </div>
                        </td>
                        <td width="80%">
                            <table>
                                <tr>
                                    <td>
                                        <div class="IdeaListTitle">                                                          
                                            <apex:outputLink value="{!$Site.prefix}/apex/CPIdeaDetailPage?id={!ida.id}" styleClass="ideahometitl" > {!ida.title} </apex:outputLink>
                                        </div>
                                    </td>
                                </tr>                       
                            </table>
                        </td>
                    </tr>
                </table>                               
            </apex:repeat>
        </apex:outputPanel>        
    </apex:form>
</apex:page>

Controller:
=======
public with sharing class ideasample01cls {
    public list<idea> idealistP {set;get;}
    public ideasample01cls(ApexPages.StandardController controller) {
        this.idealistP = [select id,title,body,NumComments,VoteScore, VoteTotal,Status, CreatorFullPhotoUrl,Creatorname,CreatedDate,(Select CommentBody,CreatedById, CreatedDate From Comments limit 1) from Idea  ORDER BY title ASC];
      
    }
    public void samplemthod(){
        idealistP = [select id,title,body,NumComments,VoteScore, VoteTotal,Status, CreatorFullPhotoUrl,Creatorname,CreatedDate,(Select CommentBody,CreatedById, CreatedDate From Comments limit 1) from Idea ORDER BY title DESC];
        //return idealist;    
    }
}

Screen shorts for more clarity:

User-added imageUser-added image


Please help me to solve this issue or guide me for any work around to solve this
Hi All,
I am trying for test coverage for one class as below
Class::
Public class sample123{
    public sample123(){
    
    }
     public PageReference PostBtn(){   
    
        // Workaround for getting the current page name
        String pageName = ApexPages.CurrentPage().getUrl();          
        pageName = pageName.replaceFirst('/apex/','');         
        pageName = EncodingUtil.urlEncode(pageName, 'UTF-8');         
        string[] pageNameExtra = pageName.split('%3F',0);                    
        pageName = pageNameExtra[0];         
        
        pagereference pr = new pagereference('/apex/sample?prevpg='+pageName);
        pr.setredirect(true);
        return pr;  
    }
}

Test class::
Public class sampletest{
     public static testmethod void sample123Method(){
        sample123 smp = new sample123();
        apexpages.currentpage().getparameters().put('/','/apex/');
        smp.PostBtn();
    }

}

I am getting this error 'System.NullPointerException: Attempt to de-reference a null object' at the execution of this statement
pageName = pageName.replaceFirst('/apex/','');

Please give me solution for this test coverage, thanks in advance
 
Hi All,

I am trying to display the list of article with "Sort By Rating and Views" on VF page

I have displayed the list of articles by using the component <Knowledge:articlelist> but i want to display the rating and view images on as one column (same like standard Knowledge List)
Please help me, how to display the article list with rating and view images on VF page
Hi All,

I am trying to display the standard validation messages on VF page by using page messages components. My code is in below,

VF page:
<apex:pagemessages escap="false" />
<apex:form>
   <apex:inputtext value="{!contactemailvalue}" />
<apex:commandbutton action="{!contactSave}" value="Save Cont" />
<apex:form>

Controller:
Public string contactemailvalue {set;get;}
public pagereference contactsave(){
try{
contact contemp = new contact();
contemp.lastname = 'Sample Contact';
contemp.email.com = contactemailvalue;

}
catch(Exception ex) {   
            apexpages.addmessages(ex);
            System.debug('Error inside catch block');
            return null;
       }
}

Sample: In this, if user provided wrong format of email then showing the error message like in standard format refer the belowUser-added image

My Requirement is to show the only content of the validation message. From above example i want to show only this message
"invalid email address: asasbvudfeyg"

Please help me to solve this 

Hi All,

I am trying to display the dashboards on VF Page for community user, the code is in below

<apex:page standardController="Dashboard" cache="false" showHeader="false" sidebar="false" title="Auto-Refresh Dashboard">
  <apex:iframe src="{!URLFOR('/01Z90000000EZz0')}" scrolling="true"  />
</apex:page>

But communities user can't able to see this page on community site, getting error at this point

Please help me to solve this.



Hi All,

I want to implement 'Breadcrumb' functionality for community VF page.
My requirement is to show the navigation path to community user on community and also navigate option (Link) to redirect to his previous pages

Is there any standard functionality in salesforce for 'Breadcrumb' ?. Please give me any solutions or work around for my requirements

Thanks for in Advance
Hi All,

Is this possible the method SetPassword on formula field or workflow formula?

I want to change the password whenever user has created, this i want to acheive with out trigger/batch, is this possible?

Thanks in Advance!!
Hi All,

I have tried to pass user name and password for community site url, is look like the below.

https://Companyname-developer-edition.ap1.force.com/Support/login?un=+testuser@mm.com+&pw=+demo123@+&startURL=/apex/PartnerLandingPage

This is working fine but i want to encrypt the username and password while passing in url for security reasons and also want to decript username and password in salesforce side

In my site URL i am using the standard page, is 'login'. is this possible to decrypt the username and password from 'login' page

Over all my requirement is, we have one link in html code (external system). Link contains the above url. User can able to login to community by clicking the link without enter the credentials (Custom SSO). In this we want to make the user name and password in the form of encrypt or hide.

Please give me any solutions or work arounds for this
Hi All,

I am trying to subtract two datetime fields but i got below error message,
" Date/time arithmetic expressions must use Integer, Decimal or Double arguments "

My code is in below

CronTrigger ct = [SELECT Id,NextFireTime,starttime, CronJobDetail.name FROM CronTrigger where CronJobDetail.name = 'samplejob001' limit 1];
integer temp =  ct.NextFireTime - ct.starttime;
System.debug('=====>'+temp);

Please guide me, how to solve this issue.
 
Hi All,
I am trying for test coverage for one class as below
Class::
Public class sample123{
    public sample123(){
    
    }
     public PageReference PostBtn(){   
    
        // Workaround for getting the current page name
        String pageName = ApexPages.CurrentPage().getUrl();          
        pageName = pageName.replaceFirst('/apex/','');         
        pageName = EncodingUtil.urlEncode(pageName, 'UTF-8');         
        string[] pageNameExtra = pageName.split('%3F',0);                    
        pageName = pageNameExtra[0];         
        
        pagereference pr = new pagereference('/apex/sample?prevpg='+pageName);
        pr.setredirect(true);
        return pr;  
    }
}

Test class::
Public class sampletest{
     public static testmethod void sample123Method(){
        sample123 smp = new sample123();
        apexpages.currentpage().getparameters().put('/','/apex/');
        smp.PostBtn();
    }

}

I am getting this error 'System.NullPointerException: Attempt to de-reference a null object' at the execution of this statement
pageName = pageName.replaceFirst('/apex/','');

Please give me solution for this test coverage, thanks in advance
 
Hi,

I have 3 http callouts in batch - execute method, i am writting test class for batch class. I have created Mock test class.
Problem is: i can able to cover first callout, but not 2nd and 3rd callout
Please tell me how many callouts we can test from test class, please advise me how can i do this

 
Hello,

I am trying to validate password and showing the error message on VF page 
Validation: Password must be mixed of alphabet and numeric

My code is in below
VF page Code:
<apex:page controller="sample123class">
    <apex:form >                
        <apex:inputText html-placeholder=" Enter user name " /> <br/><br/>
        <apex:inputText html-placeholder=" Enter password " value="{!passInput}"/> <br/>  <br/>
        <apex:commandButton action="{!loginmethod}" value="login" id="set" />                                                               
    </apex:form>
</apex:page>

Controller:
public with sharing class sample123class {
    public string passInput{get;set;}
    public PageReference loginmethod() {
       if(Pattern.matches('[[0-9][a-z][A-Z]]*',passInput)){{  
            PageReference pg = new PageReference('/apex/samplehomepage');             
            return pg;
        }
        else{
            apexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'Your password code must have a mix of letters and numbers'));    
            return null;  
        }     
    }
}


Please provide the suitable 'Regex pattern' to achieve this

 
Hi All,

I am trying to subtract two datetime fields but i got below error message,
" Date/time arithmetic expressions must use Integer, Decimal or Double arguments "

My code is in below

CronTrigger ct = [SELECT Id,NextFireTime,starttime, CronJobDetail.name FROM CronTrigger where CronJobDetail.name = 'samplejob001' limit 1];
integer temp =  ct.NextFireTime - ct.starttime;
System.debug('=====>'+temp);

Please guide me, how to solve this issue.
 
Hi All,

i have seen this from saleforce help 
-> The last three passwords are remembered and cannot be reused when you are changing your password.
Please check this link,  https://help.salesforce.com/HTViewHelpDoc?id=security_overview_passwords.htm&language=en_US

But the method System.setPassword() is not follows the above limit. I have used this method to set the password for portal users and this function used to reset the alredy used password
For example:
1 time password is demo001
2 time demo002
3 time i have used again demo001 then not showing any error its restting the password with demo001

Please advise me why is working, tell me any setups to aviod this

Thanks
Hi All,

I am trying to display the account phone on vf page in this standard phone format (xxx) xxx-xxxx
Format has displayed in required format if user inserted the account record by manual
Format has not displayed in required format if account records inserted by using any import wizards/ apex code / data loader, (displayed in normal format like xxxxxxxxxx)

Please guide me how to resolve this issue

 
Hi All,
Issue: VF page getting the wrong votes/points if change the query dynamically

Actually i am trying to display the all ideas with votes in ascending or descending order by title.

Ascending Order: Query has built in constructor, displaying vote and title in proper manner (Working fine)

Descending Order: Query has built in method, will fire when the user click on the button 'DESC'. This should display the ideas vote and title in descending order, but this is not showing in proper manner
Problem: Idea Titles are displaying in Descending order but Votes are displaying in ascending order

Please check the below codes:
VF page:
=========
<apex:page standardController="idea" extensions="ideasample01cls" showHeader="false" standardStylesheets="false" >
    <style>
        .votePanelstyl{
           font-family:calibri;         
        }
        .IdeaListTitle{   
            float: left;  
            font-size: 14px; 
            font-family: 'Calibri'; 
            color: blue;
        } 
    </style>
    <apex:form >
        <apex:commandButton  rerender="panelid" style="margin-left:300px;margin-top:10px;margin-bottom:20px" value="Desc" action="{!samplemthod}" />
        <apex:outputPanel id="panelid">
            <apex:repeat value="{!idealistP}" var="ida">                
                <table width="100%" border="0">
                    <tr>
                        <td width="20%">
                            <div class="votePanelstyl" >
                                <apex:outputPanel id="votePanel" >                                                    
                                    <apex:vote objectId="{!ida.id}" rerender="IdeaList" /> <br/>                                                                               
                                </apex:outputPanel>
                            </div>
                        </td>
                        <td width="80%">
                            <table>
                                <tr>
                                    <td>
                                        <div class="IdeaListTitle">                                                          
                                            <apex:outputLink value="{!$Site.prefix}/apex/CPIdeaDetailPage?id={!ida.id}" styleClass="ideahometitl" > {!ida.title} </apex:outputLink>
                                        </div>
                                    </td>
                                </tr>                       
                            </table>
                        </td>
                    </tr>
                </table>                               
            </apex:repeat>
        </apex:outputPanel>        
    </apex:form>
</apex:page>

Controller:
=======
public with sharing class ideasample01cls {
    public list<idea> idealistP {set;get;}
    public ideasample01cls(ApexPages.StandardController controller) {
        this.idealistP = [select id,title,body,NumComments,VoteScore, VoteTotal,Status, CreatorFullPhotoUrl,Creatorname,CreatedDate,(Select CommentBody,CreatedById, CreatedDate From Comments limit 1) from Idea  ORDER BY title ASC];
      
    }
    public void samplemthod(){
        idealistP = [select id,title,body,NumComments,VoteScore, VoteTotal,Status, CreatorFullPhotoUrl,Creatorname,CreatedDate,(Select CommentBody,CreatedById, CreatedDate From Comments limit 1) from Idea ORDER BY title DESC];
        //return idealist;    
    }
}

Screen shorts for more clarity:

User-added imageUser-added image


Please help me to solve this issue or guide me for any work around to solve this
Hi All,
I am trying for test coverage for one class as below
Class::
Public class sample123{
    public sample123(){
    
    }
     public PageReference PostBtn(){   
    
        // Workaround for getting the current page name
        String pageName = ApexPages.CurrentPage().getUrl();          
        pageName = pageName.replaceFirst('/apex/','');         
        pageName = EncodingUtil.urlEncode(pageName, 'UTF-8');         
        string[] pageNameExtra = pageName.split('%3F',0);                    
        pageName = pageNameExtra[0];         
        
        pagereference pr = new pagereference('/apex/sample?prevpg='+pageName);
        pr.setredirect(true);
        return pr;  
    }
}

Test class::
Public class sampletest{
     public static testmethod void sample123Method(){
        sample123 smp = new sample123();
        apexpages.currentpage().getparameters().put('/','/apex/');
        smp.PostBtn();
    }

}

I am getting this error 'System.NullPointerException: Attempt to de-reference a null object' at the execution of this statement
pageName = pageName.replaceFirst('/apex/','');

Please give me solution for this test coverage, thanks in advance
 
Hi All,

I am trying to display the dashboards on VF Page for community user, the code is in below

<apex:page standardController="Dashboard" cache="false" showHeader="false" sidebar="false" title="Auto-Refresh Dashboard">
  <apex:iframe src="{!URLFOR('/01Z90000000EZz0')}" scrolling="true"  />
</apex:page>

But communities user can't able to see this page on community site, getting error at this point

Please help me to solve this.



Hi All,

I want to implement 'Breadcrumb' functionality for community VF page.
My requirement is to show the navigation path to community user on community and also navigate option (Link) to redirect to his previous pages

Is there any standard functionality in salesforce for 'Breadcrumb' ?. Please give me any solutions or work around for my requirements

Thanks for in Advance
Hi All,

Is this possible the method SetPassword on formula field or workflow formula?

I want to change the password whenever user has created, this i want to acheive with out trigger/batch, is this possible?

Thanks in Advance!!
Hi All,

I have tried to pass user name and password for community site url, is look like the below.

https://Companyname-developer-edition.ap1.force.com/Support/login?un=+testuser@mm.com+&pw=+demo123@+&startURL=/apex/PartnerLandingPage

This is working fine but i want to encrypt the username and password while passing in url for security reasons and also want to decript username and password in salesforce side

In my site URL i am using the standard page, is 'login'. is this possible to decrypt the username and password from 'login' page

Over all my requirement is, we have one link in html code (external system). Link contains the above url. User can able to login to community by clicking the link without enter the credentials (Custom SSO). In this we want to make the user name and password in the form of encrypt or hide.

Please give me any solutions or work arounds for this
I would like to pull the URL for the File Attachment in my Knowledge Article, is this possible? In my article type i created a data Type for File Attachment called TestImage, but unfortunately I'm unable to figure out to retrieve this URL.

I am implemententing a custom Visualforce page for Knowledge. Any assistance would be appreciated. Thanks

I'm not sure if I missed something, but I am trying to deploy numerous data categories/groups from UAT to production and I can't seem to find the selection of these in when I try to add item in the change set.

 

Is it not possible?

 

Do I have to do everything again in production?

 

Thanks