• Sagar Pareek
  • SMARTIE
  • 1084 Points
  • Member since 2013
  • Senior Salesforce Engineer
  • Kayako


  • Chatter
    Feed
  • 28
    Best Answers
  • 0
    Likes Received
  • 4
    Likes Given
  • 4
    Questions
  • 430
    Replies

in my pages i have several links to another visualforce pages in developer edition I used hard coded links such like this:
<apex:outputLink value="https://c.eu6.visual.force.com/apex/gindex" id="theLink">Back to shop</apex:outputLink>

On controller side
Public PageReference backToPage(){

            return new PageReference('/apex/gindex');
        }

How to set them properly in force.com site?
Hello,

I have a object which is like A -> B-> C with LOOkUP relationships
A is Master
B is child
C is grand child

I have created a report type and report with this relationship.

I have added this to page layour of B and C

On any record of B when the report which is added to the page layout is Clicked.
then an additional criteria is automatically added to the report like Custom Object B id = 00Ob0000004N23g

But the same thing does not happen with object C
the Custom Object C id = 00Ob0000004N23g

is added but Custom Object B id = 00Ob0000004N23g is not added.

Also does below many any difference
User-added image
Any tips ?
  • July 05, 2016
  • Like
  • 0
hi Friends,

   I am created workflow rule for ending emails..my critiria is every tiime created And Edited..but when i am creting a record the email was not send to the emails ...
what is the reason....
rule critiria is: AND(NOT( ISBLANK(Focus_ID__c )), 
NOT(ISNULL(Focus_ID__c )))
means when  foccus_ID__C created my workflow sshold be triggerd..
what is the reason....
When I click on 'Lightning Experience' link in Salesforce to enable Lightning in my org, it is showing an error message - "Exception thrown and not caught". Why is this happening? Can someone help on this please?
  • April 14, 2016
  • Like
  • 0
Hello,

How can i have lookup in on user interface using Visualforce.
I want to use list<Strings> but i can use something else too if this cannot be met.

Thank you
  • April 24, 2015
  • Like
  • 0
Hi,

I am working on some test class and got stuck at some place, need help.

My Controller class is

**************************************
public class APMP_cloneAgileProcessController {   
    public Agile_Process__c objAgile_Process{get;set;}
    public string AgileProcessId{get;set;}
    public list<Stage__c> lstAPMPStages{get;set;}    
    public APMP_cloneAgileProcessController(){
    
        AgileProcessId=ApexPages.currentPage().getParameters().get('id');
        objAgile_Process=[Select name, Process_Description__c, Active__c  from Agile_Process__c where id =:AgileProcessId];
        lstAPMPStages=[select id, name, Stage_Name__c from  Stage__c where  Agile_Process__c =:AgileProcessId];
    }    
     public PageReference Cancel() {
        return (new ApexPages.StandardController(objAgile_Process)).view();
    }
    public PageReference Save() {
        Agile_Process__c objnewAgileProc=new Agile_Process__c();    
       try{
        objnewAgileProc.Active__c= objAgile_Process.Active__c;
        objnewAgileProc.Process_Description__c=objAgile_Process.Process_Description__c;
        objnewAgileProc.Name=objAgile_Process.Name;              
       insert objnewAgileProc;         
         list<Stage__c > lstnewAPMPStgs=new list<Stage__c>();         
         for(Stage__c stg:lstAPMPStages){         
             Stage__c objstg=new Stage__c();
             objstg.Agile_Process__c=objnewAgileProc.id;
             objStg.Stage_Name__c=stg.Stage_Name__c;
             lstnewAPMPStgs.add(objStg);
         }         
         insert lstnewAPMPStgs;
         
       
       }catch(exception ex){
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,ex.getMessage());
              ApexPages.addMessage(msg);
              return null;       
       }
        return (new ApexPages.StandardController(objnewAgileProc)).view();
    }
}
***************************************
And code for  my test class is 
************************************
@istest
private class TestAPMP_cloneAgileProcessController {
static testMethod void MyTest(){
//Inserting test date for Agile_Process__c (Process) object
Agile_Process__c AP = new  Agile_Process__c (name='Test Agile Process',Process_Description__c='Test Description',Active__c=False);
insert AP;
Apexpages.standardcontroller controller = new  Apexpages.standardcontroller(AP);
Test.startTest();        
APMP_cloneAgileProcessController ObjTest = new APMP_cloneAgileProcessController ();
objtest.cancel();
test.stoptest();
}
}
************************************
Its failing the test method and saying that no wrow for assignment.

Kindly help.
HI Friends,

     I deleted some pages from my managed package, Now I want to get it back. Is there any way to do it. If you need any more information please let me know.

Thanks,
Naresh.
Hello,

I moved my code from dev to Sandbox.

The same piece of code gives very different behaviour.

Is there any particular cause or Is there some mistake at my end ?
  • March 13, 2015
  • Like
  • 0
Hello,

I am looking for simple tutorial for chattter.

I want to send information from visualforce code and not through clicks.
For example if a row is deleted from pageblocktable, i want to send infromation from 'delete' fucntion that, row has been deleted.

Thank you for suggestions.

 
  • March 10, 2015
  • Like
  • 0
The child object has two master objects. master1 has rollup summary field. Whereas master2 does not have any rollup summary field. I want to convert master2 field to look up. But I am not getting "Change field type" button on edit. Can someone help! Very urgent..
Hi Experts,

I enabled Chatter Answers in my Community and added Q&A tab to it. With Admistrator profile, i can post question and answer , but with other profile i am not able to do this. There's no button displayed like the snapshot below.  Anyone can tell me the  required permission do this for custom profile?
User-added image
Hi, I would like to know how to lock a field when a check box is checked. the field i would like to lock has picklist values. I tried validation rule but its not working. Any help?
Hi,

I'm working to identify some options around how to improve our knowledge search performance.

At the moment, our knowledge search is coming from a custom controller where the query seems to be something like this:
 
public PageReference searchArticle(){
    
        //Set<Id> articleIds = new Set<Id>();
            
        SearchArticlesByCategory sabc = new SearchArticlesByCategory();
    
        allArticlesBySearch = sabc.searchArticlesByCategory(artTypes, visibleCats, searchString, language, prefix, null);
        
        Integer listSize = allArticlesBySearch.size();
        
        Integer i;
        
        for (i = 0; i < listSize; i++){
        
            articleIds.add(allArticlesBySearch[i].Id);
        }
        
        articleListBySearch = [SELECT Title,UrlName,Summary FROM KnowledgeArticleVersion WHERE Id IN :articleIds AND Title LIKE :'%' + String.escapeSingleQuotes(searchString) + '%'];
        
        if(articleListBySearch.size() == 0){
        
            articleListBySearch = allArticlesBySearch;
        }
                
        CheckAttInArticle caia = new CheckAttInArticle();
        
        attInArticle = caia.checkAttInArticle(articleListBySearch, mapContainsAtt);
        
        setPageState(method_search, articleListBySearch.size());
        
        return null;
    }

I didn't write this code, but in researching the knowledge search functionality, I've learned that the native Salesforce Knowledge search offers a lot of value in terms of things like tf/idf relevancy, lemmatization, and synonym expansion.   I also know that the newest edition includes default and/or and search term highlighting.

What I'm working to figure out is :
  1. What could be done to improve our existing custom search controller?
  2. Does the search controller as outlined in the knowledge developers guide provide the functionality mentioned above?
  3. Are there any ways to embed the salesforce knowledge search in a custom page without using the knowledge tab or completely recoding?
  4. Would using the connect api and the getSuggestions class be a way to provide more 'instant' results and utilize SFDC's native search power?
Thanks!
Hello there,

I have a Visualforce page in which I am using some CurrentPage.parameters, I understand how to use and reference these within the Visualforce page, but if I want to pass the value back to a variable in my Apex Controller, how do I do that?

I basically want to store a CurrentPage.parameters value in the database, so I want to get it from the VF page back to the controller so I can include it in a record I write to the database.

Any help much appreciated.
 
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
Hello, I need a lot of help.
Is it possible change the images of the login page?
and if I can, how?
User-added image
Hi
I have converted a certificate file PFX to JKS and tried to import it to Salesforce but without success.
I got the following error:
"Keystore contains an entry whose alias is not acceptable for import: le-eecbcd38-c185-47e6-995b-67bae7e0c4a9"

Please assist uploading the certificate.
Thanks
 

Hi,

I need help on the following requirement as follows,


I am having a owner field in my visualforce page which will display the owner where i am having a link called as [Change] which will prompt to change the user


eg :

Owner[Change]

now my req is i am having another picklist field in my VF Page called as "Account maintainence status "

i want that "Owner" field to be read only for all , and the [Change] link should be displayed only on changing my   "Account maintainence status "  in my VF Page

MY VF CODE :

<apex:outputField value="{!Account_Maintenance__c.OwnerId}">
<a href="/{!id}/a?retURL=/{!id}">[Change]</a>
</apex:outputField>


Help me how to acheive my requirement

Thanks in Advance

I am trying to edit this code so when I add a product it will add 2 custom fileds to the opprtuinty line item. " A formula field on Price book entery "Type_c" =Text (Product2.Product_Type__c) and a check box "Needs_Approval__c"  I can't seem to get it added with out an error.  

public void addToShoppingCart(){
    
        // This function runs when a user hits "select" button next to a product
    
        for(PricebookEntry d : AvailableProducts){
            if((String)d.Id==toSelect){
                shoppingCart.add(new opportunityLineItem(OpportunityId=theOpp.Id, PriceBookEntry=d, PriceBookEntryId=d.Id, UnitPrice=d.UnitPrice, ));
                break;
            }
        }
        
        updateAvailableList();  
    }
Hi,
Whats the right way of enforcing the datatype for a inputfield in Visualforce page?
I have a field defined as number but still can take characters.
We have another requirement where we want another input field defined as percent to accept percent only.
Please advise.

Hi 

Do anyone ever worked with scanning barcodes from barcode reader harware into salesforce?

Hi 

I have a requirement where i need to srhink image before uploading it as an attachment through a vf page.

How i can do this?

 

I have a CSS file I want my site to use it .

How do i implement it?

 Uploading CSS i am not able to call it getting "." as disallowed character

 

 

and getting error as 

rror: siteMain line 12, column 3: The element type "link" must be terminated by the matching end-tag "</link>" 
ErrorError: The element type "link" must be terminated by the matching end-tag "</link>".

When i am opening developer console i am getting this error message :

Requested entity 07LK0000000nKzE was not found. Error open request failed.

and Failed to load entity.

Have added the &RecordType text to the custom button URL to be placed within our Partner Community but it doesn't appear to be redirecting the Users to the correct Record type:

https://XXXXX.force.com/technicians/a0o/e?CF00Nw0000003MFwU={!Case.CaseNumber}&Name=QA{!Case.CaseNumber}&CF00Nw0000003MFwU_1kid={!Case.Id}&retURL={!Case.Id}&RecordType=012w0000003IUB

Have already checked the following
1) Record Type id is correct:
 id=012w00000003IUB&type=01Iw0000000UUiw&setupid=CustomObjects%3Fsetupid%3DCustomObjects

2) Profile has access to the specified Record Type:
User-added imagePlease see attached screenshot
  • September 04, 2017
  • Like
  • 0
Hi All

I have set up my force.com custom domain (http://memobottle.force.com/tradegecko) for the tradegecko integration. However when I try to save it I am presented with the below error message. Has anyone else experienced this issue and if so what was the solution? Any help would be appreciated.

"Upsert failed. First exception on row 0; first error: STRING_TOO_LONG, Redirect URI: data value too large: https://tradegecko.ap5.visual.force.com/apex/tradegecko__tradegeckoconfig?sfdc.tabname=01r7f0000009zqn&amp;vfreturlinsfx=%2fhome%2fhome.jsp&amp;nonce=a17df2fb5c8d25cad3f41a923dd26b0be63b23e06b80c619d2b8d6c31fa2e241&amp;sfdciframeorigin=https%3a%2f%2fap5.lightning.force.com&amp;tour=&amp;isdtp=p1 (max length=255): [tradegecko__Redirect_URI__c]
Error is in expression '{!saveWebhookURL}' in component <apex:commandButton> in page tradegecko:tradegeckoconfig: (tradegecko)
An unexpected error has occurred. Your solution provider has been notified. (tradegecko)"
This is my first batch class ever written, and I have finally gotten to this point.  I have been all over and can't find info to help me with the last TODOs in the Finish.  Any help or suggestions would be greatly appreceaited.

global class AriaBatchErrors implements Database.Batchable<sOBject>, Database.Stateful{
    
    global string excelHeader = 'ApexClassID, CompletedDate , ExtendedStatus, JobItemsProcessed, JobType, MethodName, NumberOfErrors, Status, TotalJobItems \n';
    global string finalstr = '';
    
    //constructor
    global AriaBatchErrors(){
        finalstr = excelHeader;
    }
    //start method
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator('SELECT ApexClassID, CompletedDate, ExtendedStatus, JobItemsProcessed, JobType, MethodName, NumberOfErrors, Status, TotalJobItems FROM AsyncApexJob WHERE NumberOfErrors > 0');
    }

    //execute
    global void execute(Database.BatchableContext BC, List<sOBject> scope){
        string recordString;
        for(sOBject a: scope){
            // Type Cast sOBject to AsyncApexJob
            AsyncApexJob asynApexJobRecord = (AsyncApexJob) a;
            
            recordString = a.ApexClassID +',' + a.CompletedDate +','+ a.ExtendedStatus+',' + a.JobItemsProcessed + ',' + a.JobType + a.TotalJobItems + ','+ a.CreatedBy.Email + '\n';
            finalstr =+ finalstr + recordString;
            a.JobItemsProcessed',' +a.JobType+a.TotalJobItems+','+ a.CreatedBy.Email + '\n';
        }
    }

    
    //finish
    global void finish (Database.BatchableContext BC){
        
        system.debug('**** Final String *** ' + finalstr);
        //TODO: pass this string to create CSV in your CSV Method.
        //TODO: Create an generic method to send emails & pass this attachment. 
    }
}



THank you.
How to query account on basis of profile i.e.
I want to see how many records have been edited by system admin or any other profile

Thanks in Advance ...
Please help
i want to populate count field in opportunity.such that if account has 5 oppoptunites then all 5 opportunities has 5(integer) value on them..
below is my code.
trigger OpportunityCountTrigger on Opportunity (after insert,after update) {
    
     List<Opportunity> opptyList= new List<Opportunity>(); 
     Map<id,Account> acctlist= new Map<id,Account>([select id,(select id ,Opp_Count__c from opportunities) from account]);
     List<AggregateResult> count = [SELECT count(account.id),accountid FROM Opportunity WHERE accountid != null group by accountid];     
     if(Trigger.isinsert)
     {
        for(Opportunity op : Trigger.New)
       {
           Opportunity o = new Opportunity(id=op.Id);
           o.Opp_Count__c = acctlist.get(op.accountid).opportunities.size();
           opptyList.add(o);
           
           system.debug('isinsert running');
        }
        List<Opportunity> oppList = [select Opp_Count__c from Opportunity where accountid in : acctlist.id ];
        for(Opportunity optyy : oppList)
        {
            optyy.Opp_Count__c = acctlist.get(optyy.accountid).opportunities.size();
        }
         
     }
     if(Trigger.isupdate)
    {
        for(Opportunity opp: Trigger.Old)
        {
                   opp.Opp_Count__c = acctlist.get(opp.accountid).opportunities.size();
                   opptyList.add(opp);
                   system.debug('isupdate running');
        }
    }
       
    if(!opptyList.isEmpty())
    {
        upsert opptyList; 
    }
    
}

 
Hi,

Can anyone please tell me how to identify an article is attached to case using apex using Apex?
Please note that the case is not opened in the edit mode.

Thanks in advance!

Best Regards,
Nivea
Hi everyone,

How to enable Home tab as landing tab in Salesforce Setup  means If i login to salesforce it takes me to Home tab on setup page.
earlier I have lost my Home Landing tab from Setup and for last few hours i trying to customize it but unable to do.... how can i customize it...... For detail understanding of this question,please see below snapshot..

User-added image

I just want Home tab here before Accounts tab like below image.... how can i customize it....

User-added image



thanks,
Ghulam
Hi ,
I am getting below error and unable to find the root cause please advise:
@@@Error Message:SendEmail failed. First exception on row 0; first error: INVALID_CONTENT_TYPE, An invalid value (ContentPost) was specified for contentType.: [fileAttachments, ContentPost] 

Thanks
kiran
Hi,

How to write  the fallowing code in Visualforcepage (Custom form Validation)?

<apex:page >
   <script>
   function InvalidMsg(textbox) {
       
       if (textbox.value == '') {
           textbox.setCustomValidity('Enter Email');
       }
       
       else if(textbox.validity.typeMismatch){
           textbox.setCustomValidity('please enter a valid email address');
       }
           else {
               textbox.setCustomValidity('');
           }
       
       return true;
   }
   function InvalidMsg1(textbox1) {
       
       if (textbox1.value == '') {
           textbox1.setCustomValidity('Enter Last Name');
       }
       
       
       else {
           textbox1.setCustomValidity('');
       }
       
       return true;
   }
   
   
   function InvalidMsgFirstName(textbox1) {
       
       if (textbox1.value == '') {
           textbox1.setCustomValidity('Enter First name');
       }
       
       
       else {
           textbox1.setCustomValidity('');
       }
       
       return true;
   }
   
   function InvalidMsgCompany(textbox1) {
       
       if (textbox1.value == '') {
           textbox1.setCustomValidity('Enter Company ');
       }
       
       
       else {
           textbox1.setCustomValidity('');
       }
       
       return true;
   }
   </script>
   <form id="myform">
       Email:     <input id="email" oninvalid="InvalidMsg(this);" name="email" oninput="InvalidMsg(this);"  type="email" required="required" /><br/><br/>
       FirstName: <input id="FirstName" oninvalid="InvalidMsgFirstName(this);" name="FirstName" oninput="InvalidMsgFirstName(this);"  type="text" required="required" /><br/><br/>
       Company:   <input id="Company" oninvalid="InvalidMsgCompany(this);" name="Company" oninput="InvalidMsgCompany(this);"  type="text" required="required" /><br/><br/>
       lastname:  <input id="lastname" oninvalid="InvalidMsg1(this);" name="lastname" oninput="InvalidMsg1(this);"  type="text" required="required" /><br/><br/>
       <input type="submit" />
   </form>

Thanks,
Hello everyone,

I've been struggling with getting images to show in an e-mail template. I've been trying out a couple of methods on attaching an image to the template, but for some reason the images don't show when I send a preview to my company e-mail address. I've tried getting the image from the Static Resource, by Documents and via an external database (wp-content).

Weirdly, the images do show when I send a preview to my personal Hotmail.com or Gmail.com addresses.

Does anyone have experience with this? Could it be some firewall on my company e-mail address?

Kind regards,

Steven Mens

in my pages i have several links to another visualforce pages in developer edition I used hard coded links such like this:
<apex:outputLink value="https://c.eu6.visual.force.com/apex/gindex" id="theLink">Back to shop</apex:outputLink>

On controller side
Public PageReference backToPage(){

            return new PageReference('/apex/gindex');
        }

How to set them properly in force.com site?

Hi all,

can any one please help out,
how make a field required with error message on clicking ob submit button at field level using javascript  in Vf not in controller? 
Thanks ,
Ram

Hello,

I have a object which is like A -> B-> C with LOOkUP relationships
A is Master
B is child
C is grand child

I have created a report type and report with this relationship.

I have added this to page layour of B and C

On any record of B when the report which is added to the page layout is Clicked.
then an additional criteria is automatically added to the report like Custom Object B id = 00Ob0000004N23g

But the same thing does not happen with object C
the Custom Object C id = 00Ob0000004N23g

is added but Custom Object B id = 00Ob0000004N23g is not added.

Also does below many any difference
User-added image
Any tips ?
  • July 05, 2016
  • Like
  • 0
How can we downgrade unlimited edition to enterprise edition.? Is it automated process? Same org can be downgraded or we need to move all data into a new org? 
Hi All,
Where does exactly the sales process starts like the initial point of the sales process and the end point of  sales process,my guess is from Leads to Opportunities,but i was told, not correct.
  • June 21, 2016
  • Like
  • 0
i am trying to append/verify the phone number saved in my phone using any salesforce .. i am developer and read about salesforce integration . but a lil confused about what way should i follow to integrate accurate append in salesforce
Hi All,
I have working with Site.com. i want to binding html page with custome object. i have create some input field in site.com template. it possibel to stored data into custome object using site.com html page templates.
pls help me out.....
Hi,
It is not a question, I share my experience because I spent hours on this...
on my visualforce page, chrome kept telling me (in the Javascript console):
XMLHttpRequest cannot load https://eu3.salesforce.com/_ui/common/request/servlet/JsLoggingServlet.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'https://c.eu3.visual.force.com' is therefore not allowed access.
Browsing the net, I didn't find info on this error.
At the end, It appears this was due to a call to the "alert" javascript box just before the call to an "<apex:actionFunction". See below,
Javascript is:
function jsRemoveLineItemCatBtn() {
alert( 'CURRENT ID ' + vLICInProgressNum );
afRemoveLineItemCatBtn( String(vLICInProgressNum) );
}
where afRemoveLineItemCatBtn is the name of my action function.
Since I commented the call to alert, I don't have the error message anymore...
Hope to help few to save time.
 
I want to know where is the problem for this trigger
trigger updateParentQuantity on EntreeSortie__c (after insert, after update) 
    {
        Set<Id> MatPremIds= new Set<Id>();

        for (EntreeSortie__c ES: Trigger.new) 
            {
                MatPremIds.add(ES.MatierePremiere__c);
            }

        MatPremIds.remove(null);

        if (!MatPremIds.isEmpty()) 
            {
                Map<Id, Decimal> totalMap = new Map<Id, Decimal>();
                for (Id id: MatPremIds) 
                    {
                        totalMap.put(id, 0);
                    }
        
                for (AggregateResult ar : [select SUM(Quantite__c) tot, MatierePremiere__c, Type__c from EntreeSortie__c where MatierePremiere__c = :MatPremIds])
                    {   
                        Id MatPremId = ar.get('MatierePremiere__c');
                        if (ar.get('Type__c') == 'Entrée') 
                            {
                                totalMap.put(MatPremId, totalMap.get(MatPremId) + ar.get('tot'));
                            } 
                         else if (ar.get('Type__c') == 'Sortie') 
                            {
                                totalMap.put(MatPremId, totalMap.get(MatPremId) - ar.get('tot'));
                            }
                    }   

                List<MatierePremiere__c> MatToUpdate = new List<MatierePremiere__c>();

                for (Id id: totalMap.keySet()) 
                    {
                        MatToUpdate.add(new MatierePremiere__c(Id = id,Nombre_au_Stock__c = totalMap.get(id)));
                    }

                update MatToUpdate;
        }
    }

User-added image
thank you in advance for your help

Salesforce.com loves developers. And it’s amazing to see how quickly our developer community builds next-generation apps on the Salesforce Platform. So we thought we’d cook up a little surprise. OK, a huge surprise. How about the world’s first hackathon with a single $1 million prize?

It’s on. Come to Dreamforce. Build a next-generation mobile app, and change the world. And win a million bucks. Really. What better way to say thank you to our developers than to put on the biggest on-site hackathon in history. Today, we are thrilled to launch the Salesforce $1 Million Hackathon!

 

Read the full announcement at: http://blogs.developerforce.com/developer-relations/2013/10/salesforce-one-million-dollar-hackathon.html

 

Get the full details at: www.dreamforce.com/hackathon

 

Use this board to form teams, ask questions, and connect with your fellow developers!