Ask Search:
Sandy UssiaSandy Ussia 
Hi,
I'm relatively new to Salesforce... not a developer, but I have a background in power user type stuff in SharePoint/Microsoft stack. So not entirely clueless, but also struggling a bit to understand the Salesforce lingo and structure :-)
I've been creating a custom SF app which generally works quite well. But I've run into a problem on a Visualforce page I created, which I just can't seem to get past, after days of searching the forums and documentation, and trying different things - I hope someone can help...
The standard controller I'm using for my "WorkOrder" page is a custom object called WorkOrder, and it has a related object called Piece (i.e. each WorkOrder has multiple Pieces). I'm displaying all of the Pieces for a given Work Order, based on the id being passed in the URL from a button on the Work Order page. I want the Pieces to be displayed in order by Shop Ticket #, but they're in some random order I can't make out. Here's what I've done so far:
- I see some references in the forums to using a custom controller to sort items, but that's not an option for me because I'm on Professional Edition.
- I learned from my research that items within a PageBlockTable are sorted by default in the order of the "current view", and if I create a list view of Pieces where the first column is Shop Tkt #, then if I'm using the Piece controller, this works great. But I need to use the Work Order controller, because I'm displaying all the pieces related to a single Work Order.
- I can see how a SOQL query would be easy (ORDER BY), but I can't find a way to use SOQL outside of a custom controller... Is my understanding correct on this? i.e. is it possible to use SOQL inline somehow within a VF page (not in separate Apex code which I can't do because of my SF edition)? Or can something be passed in the URL of the VF page?
- I also tried implementing a javaScript solution I found called TableSorter, but I couldn't get it to work even with a simple sample table on a VF page in Edge/IE/Chrome, so I wonder if the code is too old or something. Also, it was a bit of overkill, as I don't need to have dynamically sortable columns, I only want to sort the Shop Ticket column before rendering the data.
It seems to me this should be an easy thing to do - like there should be a Sort attribute in the Column or something. As far as I can tell from my research, there's not a solution, but I hope I'm missing something...?
Thanks for any help! 
- Sandy
Best Answer chosen by Sandy Ussia
Nitish SinghalNitish Singhal
Hi Sandy, there is no out of the box solution from Salesforce like putting some attribute in pageblocktable and get the data sorted by column. 

You may need to implement some javascript only, which can help you out.

And yes, if you need more help I would suggest that you will have a better chance of getting relevant answers if you post it on one of the following forums [lots of talented developers out there who must have worked on similar problems before.

StackExchange [http://salesforce.stackexchange.com (http://salesforce.stackexchange.com)]
Official Developer Forum [https://developer.salesforce.com/forums]

For any configuration changes and point and click design solutions, feel free to post in this community and we will be glad to help you out. 

Regards
Chris RobertsonChris Robertson 
Anyone have any best practices or guidance on whether it is best to use the Chatter feed on a case or Case Comments.  For this particular org, 100% of the users submitting cases are internal users.  Now that Chatter posts are reportable AND "mentionable" I'm curious as to the pros and cons of each.  Any insight is appreciated!!
Best Answer chosen by Moderator (salesforce.com) 
Mamoon HajjaMamoon Hajja
So, here is how it goes:

Case Comments are to be reserved and to be available for all those who see the case, it's meant for more important things AND for the owner of the case mostly.

Chatter is nice to have when co-workers are to interact and advise each other on that case. Or, for the case owner to notify his/her manager about a special issue hapenning on that specific case.

So, I would say, you would want to use both. Case owners are to record their information on case comments. External ineractions with users other than the owner can be chattered.

Please mark this answer as the best answer if it answered your question, thanks!
Satheeskumar ISatheeskumar I 
Hi,
   I am planing to give ADM201 Exam within this week.
   As preparation alone not sufficient for the exam I need MOCK exam papers for ADM201 which will help me to clear this exam.
   If you have MOCK Exam papers for ADM201, please provide me.

Many thanks
Satheeskumar
Best Answer chosen by Moderator (salesforce.com) 
Matthew LambMatthew Lamb
Shubham sinhaShubham sinha 
I need to add conditions like if a field has greater than 1 sept 2018 in apex code.How to add this?
Best Answer chosen by Shubham sinha
Mayank JainMayank Jain
You may consider using Date.valueof('2018-09-01').
For eg: 
list<Account> acclst = [select id,createddate from account limit 10];
for(Account acc: acclst){ 
    if(acc.createddate <= Date.valueof('2018-10-01')){
        system.debug(acc);
    }
}
Vincent BartolomaVincent Bartoloma 
This is probably a silly question - Can Salesforce Platform licensed users use the Task\Activity object ? I know they can use Account ; Contact ; and several others. I just want to confirm that they can use Task\Activity because I can't find it specifically stated anywhere. 

Thank you.
Best Answer chosen by Vincent Bartoloma
Kris RyanKris Ryan
Hi Vincent,
Provided the user with the standard platform license has the appropriate permission on Accounts (Read/Edit), no one can stop him/her from logging an activity on the Account. Sharing settings will also be a consideration here but the platform license type definitely allows for the above.
You should be able to test this out by logging in as a user that has been setup with a platform license.
Ed BurlsEd Burls 
Hello,

We would like to be able to create a case and send an email to the customer in a single action.  Has anyone done anything similar or have any suggestions?  I'm thinking about a button that creates a case, which then triggers a process to send the email to the create contact.

Many thanks!

Ed
Best Answer chosen by Ed Burls
Sid SehgalSid Sehgal
Hi Ed Burls, 

I think the best way to achieve your requirement is, Create workflow Rule which on case object. Whenever the case is created then workflow will fire then it will send Email Alert to the User or Related to Contact. 
Please review the screenshot below 

User-added image

Hope this helps!
Thanks!
 
Ankita agrawalAnkita agrawal 
@isTest(seealldata=true)
private class TestClosingtoOpportunity {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
        //List<rethink3__Closing__c> CollectionOfClosing = new List<rethink3__Closing__c>();
        Contact con =  [select AccountId from Contact limit 1];
        RecordType rectype = [Select id from RecordType where RecordType.Name =: 'Commercial Deal Sheet'];
        RecordType rect = [Select id from RecordType where RecordType.Name =: 'Residential Rental Deal Sheet'];
        RecordType record = [Select id from RecordType where RecordType.Name =: 'Residential Sale Deal Sheet'];
        RecordType recordtype = [Select id from RecordType where RecordType.Name =: 'Referral Deal Sheet'];
      
       
        rethink3__Closing__c sl = new rethink3__Closing__c();
        sl.RecordTypeId = rectype.Id ;//'012E0000000dpZOIAY'
        sl.Name = 'goli-test';
        sl.rethink3__Closing_Status__c = 'Approved';
        sl.s_Commission_Schedule__c = 'Full at Signing';
        sl.s_Tenant_Buyer_Client_1__c = con.Id;
        sl.s_Payment_1__c = 11.11;
        sl.s_Payment_1_Date__c = date.today(); 
        insert sl;
       
        rethink3__Closing__c cls = new rethink3__Closing__c();
        cls.RecordTypeId = rect.Id;//'012E0000000dpZYIAY';
        cls.Name = 'moli-test';
        cls.rethink3__Closing_Status__c = 'Approved';
        //cls.s_Commission_Schedule__c = 'Full at Signing';
        cls.Commission_Paid_By__c ='OP';
        //Contact con =  [select id from Contact limit 1];
        cls.s_Tenant_Buyer_Client_1__c = con.Id;
        cls.s_OP_Commission__c = 4.00;
        cls.s_Payment_1__c = 11.11;
        cls.s_Payment_1_Date__c = date.today();
        insert cls;
       
        rethink3__Closing__c close = new rethink3__Closing__c();
        close .RecordTypeId = rect.Id;//'012E0000000dpZYIAY';
        close .Name = 'mani-test';
        close .rethink3__Closing_Status__c = 'Approved';
        //cls.s_Commission_Schedule__c = 'Full at Signing';
        close .Commission_Paid_By__c ='Client';
        //Contact conc =  [select id from Contact limit 1];
        close.s_Client_Commission__c = 5.00;
        close .s_Tenant_Buyer_Client_1__c = con.Id;
        close .s_Payment_1__c = 11.11;
        close .s_Payment_1_Date__c = date.today();
        insert close ;
       
        rethink3__Closing__c closes= new rethink3__Closing__c();
        closes.rethink3__Closing_Status__c = 'Approved';
        closes.RecordTypeId = rect.Id;//'012E0000000dpZYIAY';
        closes.Commission_Paid_By__c = 'Both';
        closes.s_Client_Commission__c = 5.00;
        closes.s_OP_Commission__c = 4.00;
        closes.Name = 'chunnu-test';
        closes.s_Tenant_Buyer_Client_1__c = con.Id;
        closes.s_Payment_1__c = 11.11;
        closes.s_Payment_1_Date__c = date.today();
        insert closes;
               
        rethink3__Closing__c BuyerCls = new rethink3__Closing__c();
        BuyerCls.rethink3__Closing_Status__c = 'Approved';
        BuyerCls.RecordTypeId = record.Id;//'012E0000000dpZdIAI';
        BuyerCls.Commission_Paid_By__c = 'Buyer';
        BuyerCls.s_Total_Commission__c = 5.00;
        BuyerCls.Name = 'salman-test';
        BuyerCls.s_Tenant_Buyer_Client_1__c = con.Id;
        BuyerCls.s_Payment_1__c = 11.11;
        BuyerCls.s_Payment_1_Date__c = date.today();
        insert BuyerCls;
       
        rethink3__Closing__c referalcls = new rethink3__Closing__c();
        referalcls.rethink3__Closing_Status__c = 'Approved';
        referalcls.RecordTypeId = recordtype.Id;//'012E0000000dpZTIAY';
        //referalcls.Commission_Paid_By__c = 'Buyer';
        referalcls.s_Total_Commission__c = 5.00;
        referalcls.Name = 'arjun-test';
        referalcls.s_Tenant_Buyer_Client_1__c = con.Id;
        referalcls.s_Payment_1__c = 11.11;
        referalcls.s_Payment_1_Date__c = date.today();
        insert referalcls;
        
      
     if(sl.rethink3__Closing_Status__c == 'Approved')          
      {
        if(sl.RecordTypeId == rectype.Id)//Commercial Deal Sheet
        {
         if(sl.s_Commission_Schedule__c =='Full at Signing')
            {
               rethink3__Closing__c closing = sl;
               closing.Buyer_Attorney_Phone__c = '4444';
               update closing;
             }
            
        }
        if(cls.RecordTypeId == rect.Id)//Residential Rental Deal Sheet
        {
          if(cls.Commission_Paid_By__c =='OP')
           { 
               rethink3__Closing__c closing = cls;
               closing.Buyer_Attorney_Phone__c = '4444';
               update closing;
            }
           if(close.Commission_Paid_By__c =='Client')
            { 
               rethink3__Closing__c closing = close;
               closing.Buyer_Attorney_Phone__c = '4444';
               update closing;
            }
           if(closes.Commission_Paid_By__c =='Both')
            { 
                   rethink3__Closing__c closing = closes;
                   closing.Buyer_Attorney_Phone__c = '4444';
                   update closing;
             }
          }
          if(BuyerCls.RecordTypeId == record.Id)//Residential Sale Deal Sheet
          {
               if(BuyerCls.Commission_Paid_By__c =='Buyer')
                { 
                      rethink3__Closing__c closing = BuyerCls;
                      closing.Buyer_Attorney_Phone__c = '4444';
                      update closing;  
                }
          }
          if(referalcls.RecordTypeId == recordtype.Id) //Referral Deal Sheet
          {
               rethink3__Closing__c closing = referalcls;
               closing.Buyer_Attorney_Phone__c = '4444';
               update closing;
          }
         
        }
      }   
  }
This is my test class. I m getting limitexception error in this. please help me with this. :') its urgent.
Best Answer chosen by Ankita agrawal
David LiuDavid Liu
Hey Ankita,

Here are some tips that will improve your code and boost your stock on the Salesforce job market!

1. Avoid using Seealldata=true if possible.  It's better to just create these records from scratch in your Test Class.  This is not only a good Salesforce practice, but also a good coding practice in general.  Plus, you'll save on SOQL queries.

2. Combine your SOQL queries - for example, you could have done this instead:
List<RecordType> recordTypes = [SELECT Id FROM RecordType WHERE Name IN ('Commercial Deal Sheet', 'Residential Rental Deal Sheet', 'Residential Sale Deal Sheet', 'Referral Deal Sheet')];

3. Combine your DML statements by using update on a list instead of individual records.  All SOQL queries from your triggers will fire with each update statement, which is causing you to hit your limit.  It looks like in this case you might need to use each update call, so check out tip #4

4. Separate your test class into multiple test classes.  This is the easiest way to get by governor limits in test classes - just split your test class in half and make it into two separate test classes.  You'll get double the governor limits!

5. Use Test.startTest() and Test.stopTest().  You can do all your queries in the beginning of your class, then do all your updates inside Test.startTest() and Test.stopTest().  You get a fresh set of governor limits inside these too!

"Any code that executes after the call to startTest and before stopTest is assigned a new set of governor limits."
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_test.htm

Hope this helps  =)  Your code is great already, but like all code, it can be improved!
David
Diane HackbarthDiane Hackbarth 
From time to time we have users that represent two (or more) accounts.  They would like the ability to create cases from the community for those accounts.  What is the best way to set them up?  
Best Answer chosen by Diane Hackbarth
Julian Juez AlfaroJulian Juez Alfaro
Hi Diane,

It turns you are not alone! 
Same question: https://success.salesforce.com/answers?id=9063A000000ZofSQAS
Salesforce Idea: https://success.salesforce.com/ideaView?id=0873A000000cMWv

And what's best: the functionality is in PILOT status! We may need to wait a bit but there is hope :-) You may be able to apply and participate in the pilot. Release Notes: https://releasenotes.docs.salesforce.com/en-us/summer18/release-notes/rn_networks_sharing_sets_cma_support.htm?edition=&impact=

Julian
 
MJ23 BMJ23 B 
Hi 

I want to create a rule that only one specific user can check or uncheck the field Follow On, this what i have done so far but it won't work:

AND(  PRIORVALUE(Participate_Follow_ons__c),  ISPICKVAL( PR_Type__c, "Portfolio Reserve") && $User.Id != '00520000006V4PM')

can you assist?
Best Answer chosen by MJ23 B
Prashant PandeyPrashant Pandey
+All..
I would not recommend to hard to user id...
AND(ISCHANGED(Participate_Follow_ons__c),  
            ISPICKVAL( PR_Type__c, "Portfolio Reserve") , 
                 $User.username != 'Your Name')

--
Thanks,
Prashant
Nilyan Genesis Berti CalvettiNilyan Genesis Berti Calvetti 
Hi,

I have the mentioned error in the challenge from module
"Track Field Service", I have completed the status of the service appointmment and I have also placed the status of work order line item as completed. Also the description of my work line item is "Drill".

I appreciate your help in advance.

Regards
Best Answer chosen by Nilyan Genesis Berti Calvetti
Nilyan Genesis Berti CalvettiNilyan Genesis Berti Calvetti
I was able to solve it, the problem was that the "Completed" value in the "Status" field was in Spanish, add the new value in english to the list .

Thanks!!