• snippets@sf
  • NEWBIE
  • 10 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 36
    Replies
What is working 
sfdx force:source:retrieve -p  force-app\main\default\classes  -u <username>
retrieves all classes.

What is not working 
sfdx force:source:retrieve -p  force-app\main\default\lwc-u lwc@popcornapps.com

Dose not retrieve all LightningWebComponents.

I had also tried -m for metatdata
for the following and did not work
1. LightningComponentBundle

Please help to fetch all LWC componets from the source org
According to the below link "Build Your Own" template has all the components, but in community builder very few components are visible.

https://help.salesforce.com/articleView?id=rss_component_reference_table.htm&type=0

How can i get all components displayed/reused.

User-added image
I have configured in Theams Settings > User Profile Menu. inspite of the configuration i could not see the component displayed in the page.

Please help me understand what is that i am missing to reuse the component.

I am missing a fundamental step which i am not ware at this moment.

User-added image
 
Requirement : To get All States based on country selected in Lightning Custom Component. [Behaviour similar to MailingAddress in Contact Object]

Scenario : MailingCountry and MailingState are Compound fields in MailingAddress.

                 If onlly those two fields are required, in the custom object we would have to create a Custom Dependent Picklist Define all values.
                 This force for a maintenance whenever the data changes globally 
Classic Version: 
                  In Classic version of VF Page and Controller we could do the following.
                  Create a virtual contact varirable c and use like c.MailingCountry and c.MailingState
                  and map the same in CustomObject via controller logic [This Workarrond works perfectly without any maintenance involved]

Lightning Version:
                 We could use only the mailingaddress as compound field in the component,
                 But this would give me all the other fields too...  like Postal code, and city etc...
                
                 I would like to see only those two fields. How can we achieve this in lightning without custom maintenace of Country and State.

Thanks in advance! for taking time to read this completely to get a solution.
                I am open for sharing screenshots over this requirement. please let me know if it is needed.




 
I Need to restrict the Object Tab Settings as Hidden for a specific mobile, and also be able to search in global search.

If we set Tab settings to Default OFF User will be able to still access the object  
We created Connected App in SANDBOX-1, implented REST , Oauth User Authentication flow by using grant_type = user, valid user credentials of sandbox1. IT WORKS (Know scenario)

Later when we tried to just Modify the user credentials with valid user credentials of SANDBOX-2 also worked and was able to access SANDBOX-2.

Is this the normal Behaviour, or this is documented anywhere for me to relate this scenario.
 
I am Using the below line in  a static class method called from the trigger.  it is so unusual why two different records are getting overiden. 
when ownerid is different every time.

insert new OpportunityTeamMember(TeamMemberRole = 'Venue Expert', OpportunityId = op.id, UserId = op.OwnerId);

Did anyone experience this before.
In order to avoid user liscence and communities. if we implement a custom users object and validate the user login from the custom object. what are the drawbacks seen in such implementation.

PHP System uses (Sales force Admin user) to get access to Salesforce data 
then reads the custom object(External users) and allow e-user to athenticate to other visual force pages.




List<Accounts> accList = [ Select Id, Name, (Select Id, Name From Contacts) From Account];

 

This will retrun all the accounts and like each account's Contacts

 

Now what i is needed is i want to restrict the accounts who has no contacts to be retrived.

 

Note the Query should be on Account.

 

 

 

Query 

List<Account> accounts =  [Select Id, Name, (Select Id, Name From Contacts) From Account ]

 

for(Account a : accounts){
for(Integer i=0; i < a.Contacts.size() ; i++){
if(someCondition){ a.Contacts.remove(i);
} } }

 This should idealy remove contacts where condition is satisfied

 

But it dose not happen

 

 

 

 

Is There a better Solution ? .

 

Custom Object : Math

    Custom  Field : N1

    Custom  Field : N2

 

Calculated fields/Formula fields : ((n3*n2__c)+n1__c) Where n3 is a range of value 10 to 500 in multiples of 10.

 

Sol 1 :

====

Each record having 50 ff fields with n1 and n2


 
 Click to View sample structure

==== 

 Problems :

1. Increases the count of fields 50 // downside is if we forsee range in multiples of one. we would have 500 fields.

2. n3 is a range entered by the "end user"  So system should be able to query shown below

 

Scenario 1 :

End user  searches for n3 = 30 

Search_Value < 3800  // This could be any value

 

 [Select n1__c, n2__c WHERE FF30 =:Search_Value] ; // Note FF30 is Dynamically Placed as n3 = 30

 

 

Scenario 2 : 

End user  searches for n3 = 40 

Search_Value < 5000 // This could be any value

 [Select n1__c, n2__c WHERE FF40 =:Search_Value] ; // Note FF30 is Dynamically Placed as n3 = 40

 

Search field should be dynamically changed based on the users input which is not a good practice too.

 

 

Sol 2 :

Create a child object for Math Say Math_subset__c

====

 

  Click to View sample structure
=====
 

Problems :

1. This will increase 50 Child records for each Math Record. if we foresee  this n3 in multiples of 1 then 500 records.

Imagine we have 2000 Math records this will increase the record count of subset 2000*500 ie. 2,500,000 records which is not a feasible solution seen.

 

2. Will reduce the performance of search.

 

 

Sol 3 : Hackers Solution

create a string field which holds those precalculated values as shown below.

=====

 

Click to View sample structure
====  

Search as :

[Select n1__c, n2__c WHERE String_Field__C LIKE '%Search_Value%'] ;

 

It has its own code complexity.

 

You may wonder why we need to store n3 as precalculated value. to get an answer please check More Info

 

 

 

 

 

 

 

 

 

 

Can anyone suggest the best way to achive this.

 

1. A Number value say 2500.00. has to be displayed in visual force page.

 

Things to consider is 

1. Whole no should be displayed

2. if no value then display "n/a".

 

Final Expected value if not null is : $ 2500

Final value if null is : n/a

 

We can get number format by this

<apex:outputText value="{0,number,#,###,###}">
<apex:param value="{!Lead.number__c}"/>
</apex:outputText>

 

They way I have implemented is 

 

<apex:outputPanel id="years_of_exp" rendered="{!IF(Lead.number__c==null || Lead.number__c==0, true,false)}">
N/A
</apex:outputPanel>
<apex:outputText rendered="{!IF(Lead.number__c!=null, true,false)}">
$
</apex:outputText>
<apex:outputText value="{0,number,#,###,###}">
<apex:param value="{!Lead.Number__C}"/>
</apex:outputText>

 

2. i have multi picklist values to be displayed.

 

Eg:  value in db is light;bulb;tube;led;

 

but i want to display as

 

light, bulb, tube, led.

 

Right now i am using javascript at the front end and displaying the expected output.

 

i wam wondering there should be a better way.

 

 

Above two solution are expected in front end..

 

 

Thanks ,

Snippets

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Below is the snippet from the test method moved successfully in production so far never had issues. but now in winter 14 it fails.

 

 

-----

Test.starttest();

ReassignmentBatch lrb = new ReassignmentBatch(strSOQL);
ID batchprocessid = Database.executeBatch(lrb,100);
System.debug('strSOQL: ' + strSOQL);
System.abortJob(batchprocessid);
Test.stoptest();

-----

 

When I comment "System.abortJob(batchprocessid);" it succeeds.  

 

But found a wierd behaviour i created only 3 records in test class for tesing but it started itterating for more than 100 of scope. and it fails.



Has anyone come accross the same.

 

May be a SF Known Issue

Dose SOQL Support Calculating values.

 

For Example a Custom Object Math__c  has fields n1_c , and n2_c

 

what I am looking for is 

User enters a Value form UI say n3 = 50

 

My Query should work something like

 

SELECT n1__c , n2__c FROM MATH__c WHERE n1+n2+n3 = 100

 

Value 100 is a static value.

 

 

Please suggest how can i achieve this in single Query/ or is ther a alternate way.

 

Thanks

 

 

 

 

 

 

I am Trying to Create Page Number Navigation for a Standard set controller.

 

Client  Needs buttons with page Number like 

 [First Page1] ... [5] - [6] - [7] - [8] - [9] - [10] ... [60-Last Page]

 

As Know we can have Nav Buttons like 

First -  Next - Previous - Last  given as a standard.

 

Now out of the box 

for Offset i have tried to get this form this link 

http://demo.redpointsolutions.com/Dynamic_Visualforce_with_SOQL_Offset

 

But when i did the same For standard set controller. i was unable to get it on load all the buttons. but when i hit next button and rerender the pannel i am able to get the Expected functionality as stated above.

 

Observations

Dynamic Components cannot be serialized. either they need to be transient to the view state.

My Dynamic component is loaded before the set con is constructed. such that to total number of pages is Zero on load.

now when i hit next button of SScont now as the total number of pages is available to the my component it displays the message.

 

What should i do to get it on load its sef please help if any one has come across the same issue.

 

Thanks 

Pravin

 

 

 

 

 

 

 

 

 

 

 

 

Hi, 

After clinking  an action in Component controller. i would like to call and method in PageController. and rerender a pannel in Main Page.

 

Page Start --------

<MyComponent>

[Component Action]      ------[ onclick of this action in Component Controller this component will rerender, but how can i rerender my pannel]     

</MyComponent>

 

 

<my pannel>

</my pannel>

Page Close -------

 

Please Help..

 

Has any tried to customize the standard login page. is it possible in Hydrid android devlopement

 

can anyone confirm out of yyour experience

 

Thanks 

Snippets

 

 

 

I am a new bee to this

 

I used android salesforce sdk with smartstore i was sucessfully able to get the Appliction working for 

Production or Devloper account where the url is login.salesforce.com

 

Can any one tell me to get this working for SANDBOX what should i do where should i make the change

 

Thanks 

Your help can save tons of time.

Please help if any one has come across the same issue

 

 

 

Hi,

 

Can we remove Help & Training Link from the standard salesforce pages or while the creating a custom object.

 

Regards,

Pravin.

can we get assigned permission sets in apex of the user in salesforce,

 

probably with out an SOQL

 

Thanks in Advance

 

 

According to the below link "Build Your Own" template has all the components, but in community builder very few components are visible.

https://help.salesforce.com/articleView?id=rss_component_reference_table.htm&type=0

How can i get all components displayed/reused.

User-added image
Requirement : To get All States based on country selected in Lightning Custom Component. [Behaviour similar to MailingAddress in Contact Object]

Scenario : MailingCountry and MailingState are Compound fields in MailingAddress.

                 If onlly those two fields are required, in the custom object we would have to create a Custom Dependent Picklist Define all values.
                 This force for a maintenance whenever the data changes globally 
Classic Version: 
                  In Classic version of VF Page and Controller we could do the following.
                  Create a virtual contact varirable c and use like c.MailingCountry and c.MailingState
                  and map the same in CustomObject via controller logic [This Workarrond works perfectly without any maintenance involved]

Lightning Version:
                 We could use only the mailingaddress as compound field in the component,
                 But this would give me all the other fields too...  like Postal code, and city etc...
                
                 I would like to see only those two fields. How can we achieve this in lightning without custom maintenace of Country and State.

Thanks in advance! for taking time to read this completely to get a solution.
                I am open for sharing screenshots over this requirement. please let me know if it is needed.




 
We created Connected App in SANDBOX-1, implented REST , Oauth User Authentication flow by using grant_type = user, valid user credentials of sandbox1. IT WORKS (Know scenario)

Later when we tried to just Modify the user credentials with valid user credentials of SANDBOX-2 also worked and was able to access SANDBOX-2.

Is this the normal Behaviour, or this is documented anywhere for me to relate this scenario.
 
I am Using the below line in  a static class method called from the trigger.  it is so unusual why two different records are getting overiden. 
when ownerid is different every time.

insert new OpportunityTeamMember(TeamMemberRole = 'Venue Expert', OpportunityId = op.id, UserId = op.OwnerId);

Did anyone experience this before.
In order to avoid user liscence and communities. if we implement a custom users object and validate the user login from the custom object. what are the drawbacks seen in such implementation.

PHP System uses (Sales force Admin user) to get access to Salesforce data 
then reads the custom object(External users) and allow e-user to athenticate to other visual force pages.




Hi friends,
I am having an issue with inputcheckbox/commandlink when rendering.
Below is my page code.

<apex:dataTable value="{!VenueList}" var="v" rowClasses="even,odd" cellpadding="5" styleClass="table_vl" id="table_List"  rendered="{!VenueList.size > 0}">
         <!-- Action Checkbox -->
         <apex:column headerValue="REFER">
    <apex:outputPanel id="recomendationNotcreated" rendered="{!IF((v.rec==null), 'true', 'false')}">
           <apex:inputCheckbox value="{!v.isSelected}" id="referLabel" styleClass="referLabel" style="margin-left: 15px;" rendered="{!IF((v.noOfServiceProviders == 1), 'true','false')}">
            <apex:actionSupport event="onclick" action="{!createRecomendation}" rerender="headerComponent,table_List" status="RecomendingStatus">
      <apex:param name="vid" value="{!v.VenueDB.id}" assignTo="{!venueRefId}"/>
                  <apex:param name="venueRefd" value="{!v.vpi.id}" assignTo="{!venuePricingInfoRefId}"/>
                  <apex:param name="locationRefd" value="{!v.vpi.MD_Locations_Serviced__c}" assignTo="{!locationServicedRefId}"/>
     </apex:actionSupport>
     </apex:inputCheckbox>
    </apex:outputPanel>
     <apex:actionStatus id="RecomendingStatus">
     <apex:facet name="start">
         <!-- <div class="vd-processing">&nbsp;&nbsp;<apex:outputLabel value="Processing..." for="referLabel"/></div> -->
         <div class="loading_Text"></div>
      <div class="innerBlock_Text">
             <img  src="{!URLFOR($Resource.VenueSearch,'images/130.gif')}" width="16px" height="16px" title="Please Wait..." />
         </div>
        </apex:facet>
    </apex:actionStatus>
   <apex:outputPanel id="recomendationcreated" rendered="{!IF((v.rec!=null), 'true', 'false')}">
           <apex:commandLink styleClass="clearRefer Remove" value="Remove" action="{!updateRecomendation}" rerender="headerComponent,table_List" status="loadingStatus" >
                  <apex:param name="dvid" value="{!v.vpi.id}" assignTo="{!venuePricingInfoRefId}"/>
                  <apex:param name="recommendId" value="{!v.rec.Id}" assignTo="{!recomendUpdateId}"/>
                  <apex:param name="vid" value="{!v.VenueDB.id}" assignTo="{!venueRefId}"/>
              </apex:commandLink>
           </apex:outputPanel>
              <apex:actionStatus id="loadingStatus">
               <apex:facet name="start">
               <!-- <div class="vd-place">&nbsp;&nbsp;Please wait...</div> -->
                 <div class="loading-Txt"></div>
                 <div class="innerBlocktxt">
                  <img  src="{!URLFOR($Resource.VenueSearch,'images/130.gif')}" width="16px" height="16px" title="Please Wait..." />
                 </div>
              </apex:facet>
              </apex:actionStatus>
        </apex:column>
</apex:datatable>

Here I am rendering commandlink when I click on checkbox and when I click on command link I am rendering checkbox. Here it is working only when the page get refreshed manually. I need to render those without loading the page. Please post your comments if I have made any mistake in the page...

List<Accounts> accList = [ Select Id, Name, (Select Id, Name From Contacts) From Account];

 

This will retrun all the accounts and like each account's Contacts

 

Now what i is needed is i want to restrict the accounts who has no contacts to be retrived.

 

Note the Query should be on Account.

 

 

 

Query 

List<Account> accounts =  [Select Id, Name, (Select Id, Name From Contacts) From Account ]

 

for(Account a : accounts){
for(Integer i=0; i < a.Contacts.size() ; i++){
if(someCondition){ a.Contacts.remove(i);
} } }

 This should idealy remove contacts where condition is satisfied

 

But it dose not happen

 

 

 

 

Is There a better Solution ? .

 

Custom Object : Math

    Custom  Field : N1

    Custom  Field : N2

 

Calculated fields/Formula fields : ((n3*n2__c)+n1__c) Where n3 is a range of value 10 to 500 in multiples of 10.

 

Sol 1 :

====

Each record having 50 ff fields with n1 and n2


 
 Click to View sample structure

==== 

 Problems :

1. Increases the count of fields 50 // downside is if we forsee range in multiples of one. we would have 500 fields.

2. n3 is a range entered by the "end user"  So system should be able to query shown below

 

Scenario 1 :

End user  searches for n3 = 30 

Search_Value < 3800  // This could be any value

 

 [Select n1__c, n2__c WHERE FF30 =:Search_Value] ; // Note FF30 is Dynamically Placed as n3 = 30

 

 

Scenario 2 : 

End user  searches for n3 = 40 

Search_Value < 5000 // This could be any value

 [Select n1__c, n2__c WHERE FF40 =:Search_Value] ; // Note FF30 is Dynamically Placed as n3 = 40

 

Search field should be dynamically changed based on the users input which is not a good practice too.

 

 

Sol 2 :

Create a child object for Math Say Math_subset__c

====

 

  Click to View sample structure
=====
 

Problems :

1. This will increase 50 Child records for each Math Record. if we foresee  this n3 in multiples of 1 then 500 records.

Imagine we have 2000 Math records this will increase the record count of subset 2000*500 ie. 2,500,000 records which is not a feasible solution seen.

 

2. Will reduce the performance of search.

 

 

Sol 3 : Hackers Solution

create a string field which holds those precalculated values as shown below.

=====

 

Click to View sample structure
====  

Search as :

[Select n1__c, n2__c WHERE String_Field__C LIKE '%Search_Value%'] ;

 

It has its own code complexity.

 

You may wonder why we need to store n3 as precalculated value. to get an answer please check More Info

 

 

 

 

 

 

 

 

 

 

Can anyone suggest the best way to achive this.

 

1. A Number value say 2500.00. has to be displayed in visual force page.

 

Things to consider is 

1. Whole no should be displayed

2. if no value then display "n/a".

 

Final Expected value if not null is : $ 2500

Final value if null is : n/a

 

We can get number format by this

<apex:outputText value="{0,number,#,###,###}">
<apex:param value="{!Lead.number__c}"/>
</apex:outputText>

 

They way I have implemented is 

 

<apex:outputPanel id="years_of_exp" rendered="{!IF(Lead.number__c==null || Lead.number__c==0, true,false)}">
N/A
</apex:outputPanel>
<apex:outputText rendered="{!IF(Lead.number__c!=null, true,false)}">
$
</apex:outputText>
<apex:outputText value="{0,number,#,###,###}">
<apex:param value="{!Lead.Number__C}"/>
</apex:outputText>

 

2. i have multi picklist values to be displayed.

 

Eg:  value in db is light;bulb;tube;led;

 

but i want to display as

 

light, bulb, tube, led.

 

Right now i am using javascript at the front end and displaying the expected output.

 

i wam wondering there should be a better way.

 

 

Above two solution are expected in front end..

 

 

Thanks ,

Snippets

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Below is the snippet from the test method moved successfully in production so far never had issues. but now in winter 14 it fails.

 

 

-----

Test.starttest();

ReassignmentBatch lrb = new ReassignmentBatch(strSOQL);
ID batchprocessid = Database.executeBatch(lrb,100);
System.debug('strSOQL: ' + strSOQL);
System.abortJob(batchprocessid);
Test.stoptest();

-----

 

When I comment "System.abortJob(batchprocessid);" it succeeds.  

 

But found a wierd behaviour i created only 3 records in test class for tesing but it started itterating for more than 100 of scope. and it fails.



Has anyone come accross the same.

 

May be a SF Known Issue

Dose SOQL Support Calculating values.

 

For Example a Custom Object Math__c  has fields n1_c , and n2_c

 

what I am looking for is 

User enters a Value form UI say n3 = 50

 

My Query should work something like

 

SELECT n1__c , n2__c FROM MATH__c WHERE n1+n2+n3 = 100

 

Value 100 is a static value.

 

 

Please suggest how can i achieve this in single Query/ or is ther a alternate way.

 

Thanks

 

 

 

 

 

 

How use batch apex in controller and display the list of records that processed by batch to display on visualforce . If any one have the code then it will be very helpful.Thanks in advance

  • December 28, 2011
  • Like
  • 0