• Jerome Russ
  • NEWBIE
  • 130 Points
  • Member since 2014
  • Specialist, IT Application Development
  • Nationwide Insurance


  • Chatter
    Feed
  • 3
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 35
    Replies
Hi All,

I am unable to combine the list of values into single string.

Below code gives output as:

Csvfilebody'29682
','92367
','72661
','14768
','15031
','1158'

I need output as:
Endpoint: Csvfilebody'29682','92367','72661','14768','15031','1158'
String uploadCsv = csvFileBody.toString().trim();
System.debug('Csvfilebody'+uploadCsv);
//uploadCsv:Csvfilebody29682
92367
72661
14768
15031
1158
 List<String> uploadCSVlist = new List<String>();
uploadCSVlist = uploadCsv.split('\n');
List<String> csvFieldNames = new List<String>();
 csvFieldNames = uploadCSVlist[0].split(',');
List<String> sme = new List<String>();
string allstring;
for(integer i=1;i<uploadCsvList.size();i++)
{
 allString = allString+','+'\''+uploadCSVlist[i]+'\'';
  }

 
I need help creating a dynamic query for a global newsletter unsubscribe (20 newsletters or more that can change at any given time).  I don't want to have to constantly update so many fields in the apex code every time we create new newsletters.

Here is the only code I could get working:
global static boolean unsubscribe(string user_id, string newsletterField) {
        Boolean valid = true;
         
        contacts = [SELECT field1, field2, field3
        FROM Contact
        WHERE Id = :user_id];
        
        if(contacts.size() < 1) {
            valid = false;
        } else {
            if(newsletterField == 'field1'){
                contacts[0].field1 = false;
            } else if(newsletterField == 'field2') {
                contacts[0].field2 = false;
            } else if(newsletterField == 'field3') {
                contacts[0].field3 = false;
            } 
        
            update contacts[0];
        }
            
        return valid;
    }
Basically a huge list of if/else statements and its making me crazy that I can't seem to find a way to make dynamic query where I can set the field to be updated a variable like contacts[0].myVar = false instead of hard coding every field.

Maybe I am approaching this issue completely wrong.  Some advice would be great.

Thanks!
 
Trying to layout a responsive visualforce page with the lightning design system. When I look at it in a responsive mode the fields are  jumbled. 

Example:

Regular Browser

Residential Street           Mailing Street
Residential City              Mailing City
Residential State            Mailing State
Residential Zip                Mailing Zip

Current Responsive For Phone 

Residential Street          
Mailing Street
Residential City
Mailing City
Residential State            
Mailing State
Residential Zip                
Mailing Zip


Want it like this: 

Residential Street
Residential City
Residential State
Residential Zip
Mailing Street
Mailing City
Mailing State
Mailing Zip

Current Tag:
  <div class="slds-col--padded  slds-size--1-of-1 slds-medium-size--3-of-6 slds-large-size--6-of-12 slds-m-top--medium" >
When I attempt to validate the challenge, I get this error:
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.ListException: List index out of bounds: 0

I went and looked at the External Data Source data and see this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><feed xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xml:base="http://phone-odata-demo.herokuapp.com/devices.svc/phones" xmlns="http://www.w3.org/2005/Atom"><id>http://phone-odata-demo.herokuapp.com/devices.svc/phones</id><title type="text">phones</title><updated>2016-02-27T04:59:09.327Z</updated><link href="phones" rel="self" title="phones"></link><entry><id>http://phone-odata-demo.herokuapp.com/devices.svc/phones('NTZkMGRjOGI1Nzc4YmYwMzAwMmMxYTk4')</id><category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="devices.phones"></category><link href="phones('NTZkMGRjOGI1Nzc4YmYwMzAwMmMxYTk4')" rel="edit" title="phones"></link><title></title><updated>2016-02-27T04:59:09.328Z</updated><author><name></name></author><content type="application/xml"><m:properties><d:UUID>NTZkMGRjOGI1Nzc4YmYwMzAwMmMxYTk4</d:UUID><d:Brand>HTC</d:Brand><d:PhoneNumber>555-255-5556</d:PhoneNumber></m:properties></content></entry></feed>

The debug log in Salesforce says that the data should have a UUID of '0000123442' but it is 'NTZkMGRjOGI1Nzc4YmYwMzAwMmMxYTk4' in the OData feed.

The actual SOQL query that gets ran for the validation is: 
SELECT ID, UUID__r.Name FROM Phone__x WHERE UUID__c = '0000123442' LIMIT 1

Without that data feed returning 0000123442, there is no way to pass the challenge.

Any thoughts on what I could be doing wrong to not see the correct UUID returned?
I am attempting to use the ANT Migration Tool to move code from a Sandbox to another Sandbox and I am encountering an issue where the profiles will not deploy because ' Error: Unknown user permission: OverrideForecasts'.

Note: When I save the src/Settings/Forecasting.settings file by itself it succeeds and then I can deploy all the code without errors.

This is an issue because I cannot validate to production until we turn on Forecasting (profile errors) and we don't want to turn on Forecasting until we are deployed. We could, on release day, turn on forecasting manually and then deploy but we won't be able to validate our code will deploy until we turn it on, so that isn't a good solution either.

Any ideas on what I could be doing wrong?
When I attempt to validate the challenge, I get this error:
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.ListException: List index out of bounds: 0

I went and looked at the External Data Source data and see this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><feed xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xml:base="http://phone-odata-demo.herokuapp.com/devices.svc/phones" xmlns="http://www.w3.org/2005/Atom"><id>http://phone-odata-demo.herokuapp.com/devices.svc/phones</id><title type="text">phones</title><updated>2016-02-27T04:59:09.327Z</updated><link href="phones" rel="self" title="phones"></link><entry><id>http://phone-odata-demo.herokuapp.com/devices.svc/phones('NTZkMGRjOGI1Nzc4YmYwMzAwMmMxYTk4')</id><category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="devices.phones"></category><link href="phones('NTZkMGRjOGI1Nzc4YmYwMzAwMmMxYTk4')" rel="edit" title="phones"></link><title></title><updated>2016-02-27T04:59:09.328Z</updated><author><name></name></author><content type="application/xml"><m:properties><d:UUID>NTZkMGRjOGI1Nzc4YmYwMzAwMmMxYTk4</d:UUID><d:Brand>HTC</d:Brand><d:PhoneNumber>555-255-5556</d:PhoneNumber></m:properties></content></entry></feed>

The debug log in Salesforce says that the data should have a UUID of '0000123442' but it is 'NTZkMGRjOGI1Nzc4YmYwMzAwMmMxYTk4' in the OData feed.

The actual SOQL query that gets ran for the validation is: 
SELECT ID, UUID__r.Name FROM Phone__x WHERE UUID__c = '0000123442' LIMIT 1

Without that data feed returning 0000123442, there is no way to pass the challenge.

Any thoughts on what I could be doing wrong to not see the correct UUID returned?

"Error: The Object Name field can only contain underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores."

Please advise how to complete this challenge. Thanks!
global class webportal {
    
    @future(callout=true)
    public static void Importwebportal()
    {

        string webportalURL = 'https://api.testtt.com/testtesttestttttt=json';
        string webportalResponse = ''; 
        
  
        // Instantiate a new http object
        Http h = new Http();
    
        // Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
        HttpRequest req = new HttpRequest();
        req.setEndpoint(webportalURL);
        req.setMethod('GET');
    
        // Send the request, and return a response
        try 
        {
           
            HttpResponse res = h.send(req);
            webportalResponse = res.getBody();
                  
        }
        catch (Exception ex)
        {
            System.debug('' + ex.getMessage()); 
        }
       
        webportalImport wb= new webportalImport ();
        wb.Import(webportalResponse);          
    
    }    
}

I have above code. I am not able to write test class for this..
Please tell me how to write test class for this. Iam not able to get the response from the HHTP in test class

Thanks
 
Hi All,

I am unable to combine the list of values into single string.

Below code gives output as:

Csvfilebody'29682
','92367
','72661
','14768
','15031
','1158'

I need output as:
Endpoint: Csvfilebody'29682','92367','72661','14768','15031','1158'
String uploadCsv = csvFileBody.toString().trim();
System.debug('Csvfilebody'+uploadCsv);
//uploadCsv:Csvfilebody29682
92367
72661
14768
15031
1158
 List<String> uploadCSVlist = new List<String>();
uploadCSVlist = uploadCsv.split('\n');
List<String> csvFieldNames = new List<String>();
 csvFieldNames = uploadCSVlist[0].split(',');
List<String> sme = new List<String>();
string allstring;
for(integer i=1;i<uploadCsvList.size();i++)
{
 allString = allString+','+'\''+uploadCSVlist[i]+'\'';
  }

 

Hello,I am preparing for administration certification.And for that I am following TRAILHEAD.Can you guide me TRAILHEAD follows which release or it isin general for learing purpose?
Hello,

I am getting this error while saving the case record, its pretty obvious that this error is due to the process builder, but I have cross checked the condition, everything seems to be perfect,

User-added image

Process builder is updating the ralated case record, if all the emtry condition satisfy the criteria.I have also added all the null checks in process builder.
Any one please help me in identifying the issue ?
 
  • June 11, 2016
  • Like
  • 0
Is it possible to unit-test Lightning components?

Theoretically I can't see why, say,  the Controller and Renderer parts of a component couldn't be unit-tested, as they are essentially just collections of Javascript functions. However, to do this with one of the standard testing frameworks (e.g. Jasmine, QUnit) would probably require some extra pre-processing to make those functions callable, as well as mocking Lightning variables (e.g. element, etc params of controller methods).

Is there any plan on the part of the Lightning team to integrate unit-testing into the framework?
IF( MONTH( NOW() ) = 12,
  DATE( YEAR( NOW() ), 12, 31 ),
  DATE( YEAR( NOW() ), MONTH( NOW() ) + 1, 1) - 1

Create a new formula with the same label, name, and data type that successfully compiles.
The formula should be of Date type and on the Case object
The formula should have the name Last Day of Month and the resulting API name Last_Day_of_Month__c
The formula should return the last day of the current month
Check Challenge


Can any one help me to solve this???
 
Need help!

I am trying to complete Lightning "Create and Edit Lightning Components" trailhed challenge .
Create a camping component that contains a campingHeader and a campingList component.
The campingList component contains an ordered list of camping supplies that include Bug Spray, Bear Repellant, and Goat Food.
The campingHeader component contains an H1 heading style with a font size of 18 points and displays 'Camping List'.

I created Camping Component :
<aura:component >
    <c:campingList/>
    <c:campingHeader/>
</aura:component>

campingList Component:
<aura:component >    
    <h1>  type="List" default="['Bug Spray', 'Bear Repellant', 'Goat Food']"</h1>
</aura:component>

CampingHeader Component:
<aura:component >   
    <H1>Camping List</H1>    
</aura:component>

And a css tp add font-size 
.THIS {
}
H1.THIS {
    font-size:18px;
}

But I am getting below error :

Challenge Not yet complete... here's what's wrong: 
The component is not using the correct font size.

Please help.


 
I need help creating a dynamic query for a global newsletter unsubscribe (20 newsletters or more that can change at any given time).  I don't want to have to constantly update so many fields in the apex code every time we create new newsletters.

Here is the only code I could get working:
global static boolean unsubscribe(string user_id, string newsletterField) {
        Boolean valid = true;
         
        contacts = [SELECT field1, field2, field3
        FROM Contact
        WHERE Id = :user_id];
        
        if(contacts.size() < 1) {
            valid = false;
        } else {
            if(newsletterField == 'field1'){
                contacts[0].field1 = false;
            } else if(newsletterField == 'field2') {
                contacts[0].field2 = false;
            } else if(newsletterField == 'field3') {
                contacts[0].field3 = false;
            } 
        
            update contacts[0];
        }
            
        return valid;
    }
Basically a huge list of if/else statements and its making me crazy that I can't seem to find a way to make dynamic query where I can set the field to be updated a variable like contacts[0].myVar = false instead of hard coding every field.

Maybe I am approaching this issue completely wrong.  Some advice would be great.

Thanks!
 
Hi,

I want to retrive in SOQL account record type from child object opportunity.

how can i write the query ?
Hii friends, how do I add 6 months to a date field in a formula? There are two  Date fields date of joining(DOJ_c) and  a formulafield  (Conformation_Date_c) ,if i put any date in date of joining (DOJ_c) field then in the conformation date =(date of joining + 6 month). kindly provide the formula for  conformation Date?? For the above question i have wrote the below formula=

DATE( IF(MONTH(DOJ__c )>6, YEAR(DOJ__c ) + 1 , YEAR(DOJ__c)) ,
IF( MONTH(DOJ__c)+6 > 12, (MONTH(DOJ__c)+6)-12, MONTH(DOJ__c)+6) ,
IF(OR(DAY(DOJ__c) = 31,DAY(DOJ__c) = 29,DAY(DOJ__c) = 28),
CASE(IF( MONTH(DOJ__c)+6 > 12, (MONTH(DOJ__c)+6)-12, MONTH(DOJ__c)+6), 1, 31,

2, IF(OR(MOD(IF(MONTH(DOJ__c )>6, YEAR(DOJ__c ) + 1 , YEAR(DOJ__c )),400)=0,AND(MOD(IF(MONTH(DOJ__c )>6, YEAR(DOJ__c ) + 1 , YEAR(DOJ__c )),4)=0,MOD(IF(MONTH(DOJ__c )>6, YEAR(DOJ__c ) + 1 , YEAR(DOJ__c )),100)<>0)),
29, 28),
3,31,4,30,5,31,6,31,7,30,8,31,9,30,10,31,11,30,12,31,0)
, DAY(DOJ__c)) )


The  Formula code is working but when i am trying  the date like 28,29,31 December its showing error plz suggest
Hi,

I have one object as Policy, in that object having policy number field. 
in that field upper case and lower case letters are there.So here i want to know how many policy numbers having small letters.
Is it possible in salesforce ?
Neema Gudur 
I have a requirement to geocode an address in realtime in Sales Force.
We curretly use an ESRI geocoding rest service to geocode an address in real time. This service returns a JSON response with lat/lon co-ordinates. In order to use this in sales force I could call the servoce from a controller but need a JSOn parser. Has anyone tried a similar approach? or any better approaches available?

Thank You
Neema
I'm trying to  complete the following in my Salesforce Developer Edition:
Set Up Contacts to Multiple Accounts
Setup is quick and easy. Just follow these steps.
From Setup, enter Account Settings in the Quick Find box, then select Account Settings.
Select Allow users to relate a contact to multiple accounts.
Add the Related Contacts related list to the account page layouts your reps use.
From Setup, enter Accounts in the Quick Find box, then select Page Layouts.
Next to the appropriate page layout, click Edit.
Select Related Lists.
Drag Related Contacts onto the page layout. Because the Related Contacts related list automatically includes all direct contacts, you can remove the Contacts related list on your account page layouts.

There is no option under Account Settings to "relate a contact to multiple accounts".  Also Related Contacts is not an option for me under page layout.  Only "Related Content".  Am I just not able to complete these functions with my edition?  Please help so I can complete this module and figure this out!  Thanks!

 
I keep getting errors when trying to deploy using outbound change sets... I finally copied and pasted to the sandbox, made my edits, and now SF won't let me send back to production.  Do I need to copy the Test Trigger over to the Sandbox too?
I have reffred the few links and followed the process to use the jquery tablesort plugin in visualforce page for pabeblock table sorting.
But those are not working.Please provide me inputs how to implimnet the pagination for pageblocktable from clientside and it is kind of urjency delievery.

 
Hello all

I'm new in salesforce. I have some confusing regarding requirements.

I have requirement to create an org programmatically. Is that posibale?
Can I do that those setps programmatically  in new org ? :
1. Enable Account Teams
2. Delete Duplicate Rules
3. Enable Lightning
4. Create Namespace
5. Create Dashboards folder

Thanks
Amrender