Ask Search:
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!!
Thomas JoyThomas Joy 
Hi Trailblazers!
We're setting up a new Customer Community using the Customer Service model, and we need the ability for users to raise cases against Entitlements - this is something we currently do using VisualForce in our old Portal. 

My thought would have been to create a new object page for 'Entitltments', which having done, I would then use the 'Record List' component and create a Quick Action against each line, but I'm unable to select 'Entitlements' as an option for the Record List.
Missing Entitlements object

Many of our customers have multiple Entitltements, but at the moment, we've hit a brick wall. 

Am I missing something totally obvious?!
Thanks 
Thomas
Best Answer chosen by Thomas Joy
Thomas JoyThomas Joy
From SFDC Support: 

Thank you for your time. As discussed, Entitlement is not yet supported in Napili Template Community. I have verified in my demo org and you should be able to add Entitlement Tab when using Salesforce Tabs + Visualforce Template in your Community.

Please see article below for list of Objects supported in Napili Template for reference:
https://help.salesforce.com/articleView?id=networks_napili_supported_objects.htm&type=0

No ETA yet when Entitlement will be available or supported in Napili Template however our R&D Team will be considering this and hopefully get implemented in the coming releases.

 
Angel EstremeraAngel Estremera 
I create formula field to set True or False by 1 or 0. In this formula if I select the field "Preferred Start Time" to Today, the formula field called "Preferred Start Date NEXT 30 DAYS" is supposed to show 1 and is showing 0. What is wrong with this formula?

IF
(
(
DATEVALUE(Preferred_Start_Time__c) - TODAY()
)
>0
&&
(
DATEVALUE(Preferred_Start_Time__c) - TODAY()
)
<=30
,1,0
)
Best Answer chosen by Angel Estremera
Steve MolisSteve Molis
Try using 
IF
(
(
DATEVALUE(Preferred_Start_Time__c) - TODAY()
)
>= 0
&&
(
DATEVALUE(Preferred_Start_Time__c) - TODAY()
)
<=30
,1,0
)

 
Antoine LeleuAntoine Leleu 
hello,

Object : Case

I would like delete 2 record type to come back with just a on master record type.
But when i want disactivate the record type, i have this message :

This record type Service Request Customer Prospect Phase cannot be deactivated because the following profiles use this record type as default.

Package License Manager
External Who
Chatter External User
 
Problem, i'm Salesforce Administrator but i cant edit  this profiles.


Thanks for your help,

Antoine
Best Answer chosen by Miglena (Salesforce.com) 
Karanraj SankaranarayananKaranraj Sankaranarayanan
Antoine,

Certain Profiles like the Chatter Free User can be assigned Record Types which cannot be removed by clicking an edit link in the Record Type Section of the Profile. This prevents Record Types from being deleted. In order to remove the record type from the Profile a URL 'Hack' must be performed.
 
First, the Enable Enhanced Profile User Interface checkbox in the User Interface must be deselected:
 
Setup> Customize> User Interface> Setup Section> Deselect  Enable Enhanced Profile User Interface> Save
 
Proceed with the following Steps:
 
1)Please follow this click path:
 
Setup> Manage Users> Profiles> System Administrator> Navigate to Record Types> Click the Edit Link on the Object in question's Section
 
At this Point you will be at the Edit Record Type Settings Page for the Object.
 
2)Copy the URL from the adress bar on your browser and paste it into note pad:
 
https://naX.salesforce.com/setup/ui/profilerecordtypeedit.jsp?id=xxxxxxxxxxxxxxx&tid=Opportunity&pn=System+Administrator&retURL=/xxxxxxxxxxxxxxx
 
3)Now follow this click path
 
Setup> Manage Users> Profiles> Chatter Free User
 
4)Copy the 15 digit Salesforce Id from the URL in the Adress bar of your Browser:
 
yyyyyyyyyyyyyyy
 
5)You are now going to replace the id in the Edit Record Type Settings Opportunity Page ( the first id number right after the "jsp?id=" in the URL ) with the Id from the Chatter Free User.
 
This:
https://naX.salesforce.com/setup/ui/profilerecordtypeedit.jsp?id=xxxxxxxxxxxxxxx&tid=Opportunity&pn=System+Administrator&retURL=/xxxxxxxxxxxxxxx
 
Should now look like this:
https://na5.salesforce.com/setup/ui/profilerecordtypeedit.jsp?id=yyyyyyyyyyyyyyy&tid=Opportunity&pn=System+Administrator&retURL=/xxxxxxxxxxxxxxx
 
xxxxxxxxxxxxxxx was replaced with yyyyyyyyyyyyyyy
 
6)Now take the modified Url and place it in the Adress bar of your browser and hit enter.
 
 
*************This will seem to have taken you to the System Administrator's edit page but you are in the right place.******************
 
7)You will now be able to remove the value by highlighting it and selecting remove. Switch the Default record type to whatever you like and hit save.
 
 
All you need to do now is repeat this for any other Profiles in which it is necessary, then Deactivate and Delete the Record Type.
Katie HambergKatie Hamberg 
I would like to give a non-admin user access to download Apex dataloader.  Is this through a permission set?
Best Answer chosen by Katie Hamberg
Mayank SrivastavaMayank Srivastava
Katie, following are the permissions that the user would need:
To insert records:	“Create” on the record
To update records:	“Edit” on the record
To upsert records:	“Create” or “Edit” on the record
To delete records:	“Delete” on the record
To hard delete records	“Delete” on the record

And finally,
API Enabled    -   Check this one

You can do it either on the profile or via a permission set.
Katie HambergKatie Hamberg 
Is it possible to have a workflow fire immediately when a date field is updated to today?  Or does this need to be a time based workflow?

Thanks!
Best Answer chosen by Katie Hamberg
Prashant PandeyPrashant Pandey
Did you try using in the rule criteria like this..
image

if this one didnt work you can go for Time Trigger.

--
Thanks,
Prashant
 
Adam RaceAdam Race 
Hi All,

I'm attempting to set up my Entitlement Management and I am having difficulties.

I've set up my Milestones and Entitlement Processes and attached it to an Entitlement, which I've then associated with an account.

If I go to the Account, I can see the Entitlement and it gives me the option to "Create case" which I do, however it then doesn't seem to actually take the Entitlement through as it seems to have no link to it. This also means that it doesn't pick up the Milestones associated with that Entitlement.

If I go to an individual Contact within the Account, again, it gives me the option to "Create case" via the Entitlements related list, but still it doesn't take the info through.

Has anyone else had this issue? I've tried almost every conceivable configuration, however I can't get it to work!

Any help would be greatly appreciated,

Thanks,

Adam
Best Answer chosen by Moderator (salesforce.com) 
Adam RaceAdam Race
In case anyone else has this same problem, after hours of searching it was a fairly simple answer!

When the entitlments are imported onto your system you need to "Set Field-Level Security" on the fields that relate to Entitlements within the Cases itself.

You need to do this on the "Entitlement Name" field, otherwise it won't work.

Thanks,

Adam