• Anuj Joshi 42
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 37
    Questions
  • 24
    Replies
Hi All,
I have a requirement in my code where I need to convert uploaded Excel file into CSV.
Can anyone tell me how to do this ?

Thanks and Regards,
Naznin
Hi All,

I have a custom bar chart written in VF page where we are dsipalying records based on controller. Currently we are displayng the values in generic way. But we want to display values differently based on user locale/country. For example the value shown to Indian user will be 1,00,000 but the same value shown to US user will be in the format 100,000. Kindly provide me solution.

Thanks,
Anuj
Hello , 

When I try to complete a superbadge "Apex specialist" , shows me a error message and does not login to my org:

The error message is:

"Houston, we have a problem.
You are attempting to log into Trailhead to complete challenges with an org that isn't supported.
Please make sure that your Org is
A Developer Edition Org (it cannot be a Production or Sandbox Org) and
The Developer Edition Org does not have a namespace assigned to it."


I do have a namespace in my org. If required I can delete them as well. Can anyone help me please?
 
Hi All,

I want to write a validation rule on phone number custom field. I want to check if the phone number cotains the user's iso country code. For example the user creating or updatin the record has its iso country as INDIA. The validation rule must check if the phone number contains +91. I want to write that for many countries.

Thanks,
Anuj
Hi All,

We have client who has its own website. When the user clicks in a link he is redirected to force.com site. But he is redirected to site URL which is is in HTTP. My requirement is that the URL should be changed from HTTP to HTTPS. The HTTPS setting checkbox in session settings is enabled. In the login settings of site, the secure web address is given as HTTPS. Is there any way that when user click on the link, it opens HTTPS instead of HTTP site URL. I tried to change to HTTPS in href tag of the website but its not working.

Thanks,
Anuj
Hi All,

We have a code where we are using site templates. I have to add one more div in the VF page. The site template is used in VF Page. I am not able to figure out where to add the div code. We have code like this.
<apex:composition template="{!$Site.Template}">
  <apex:define name="headerNav">
    <c:HeaderComponent id="headerComponent" displayContactUs="true" displayMyCases="true" displayMyProfile="true"/>
  </apex:define>
  <apex:define name="maincolumn">
        <a name="mainContent" id="mainContent"></a>
                           <div id="rn_dashboardwrapper">
                               <div id="rn_dashboard">
                                   <div style="padding-bottom: 10px;">
                                   <apex:outputLink value="{!$Page.InstantAnswers}"><apex:image alt="CertificationSupport" url="{!URLFOR($Resource.CiscoPortalResource, 'images/skin/CertificationsSupport.PNG')}" /></apex:outputLink>
                            <!-- banner start here on 7/21/2017 -->

I am not able to find where {$Site.Template} is used. I need to add the div code.

Thanks,
Anuj
 
Hi All,

I have a requirement that in a visualforce page i need to display case records where owner is the current logged in user. It should come in a table. Also there should be a search box on the top of table. When the user puts the case subject or number on the box and clicks on search button the table should refresh and show that particular record. When the user loads the page initially it should show user case records in table with pagination. After search button is clicked table should get refereshed.
Kindly provide me the example.

Thanks,
Anuj
Hi All,

When we write a vf page and click on security we see that some object and fioelds have permission.

User-added image

Stll do we need to check FLS conditions like isCreateable and isUpdateable in the apex class? I need to eliminate these error in checkmarx report. I have written them but i have no ides on how to test the code by looging as different users.

Thanks,
Anuj
Hi All,

I have a line of code which is written like this.
<apex:outputText escape="False" value="{!cr.Message__c}" rendered="{!(cr.Message__c)!= ''}"/><br/><br/>
I am getting an issue in the checkmarx report saying that this line is vulnerable to Cross site scripting (XSS). When i convert the above line to 
<apex:outputText escape="False" value="{!HTMLENCODE(cr.Message__c)}" rendered="{!HTMLENCODE(cr.Message__c)!= ''}"/>

I am getting a output as <p> Hi <br/> ...in this format. Kindly help me to resolve this issue. Actually I am displaying the emailmeesage content in this vf page and diplaying in case related list.

Thanks,
Anuj
 
Hi All,

I have run a checkmarx report and have been reported with FLS create issue. In my class I am writing upsert statements. I dont know how to check upsert condition. For insert i am checking if each field isCreateable() and for update i am checking if field is isUpdateable().
I also need a optimised solution. I am checking FLS like this for each field. 
 
Contact contact = [Select c.Phone, c.OtherPhone, c.MobilePhone, c.MailingStreet, c.MailingState, 
            	       c.MailingPostalCode, c.MailingCountry, c.MailingCity, c.LastName, c.Id, c.HomePhone, 
            	       c.FirstName, c.Fax, c.Email_Alt_2__c, c.Email_Alt_1__c, c.Email, c.Country__c, 
            	       c.Cisco_com_Login__c, c.Cisco_ID_CSCO__c, c.AssistantPhone, c.Country_Code__c, c.Area_Code__c From Contact c
            	       where c.Id =: user.ContactId];	
            	   if (contact != null) {
                       if(Schema.SObjectType.contact.fields.FirstName.isUpdateable() &&
                         Schema.SObjectType.contact.fields.LastName.isUpdateable() &&
                         Schema.SObjectType.contact.fields.Email.isUpdateable() &&
                         Schema.SObjectType.contact.fields.Email_Alt_1__c.isUpdateable() &&
                         Schema.SObjectType.contact.fields.Email_Alt_2__c.isUpdateable() &&
                         Schema.SObjectType.contact.fields.MailingStreet.isUpdateable() &&
                         Schema.SObjectType.contact.fields.MailingCity.isUpdateable() &&
                         Schema.SObjectType.contact.fields.MailingPostalCode.isUpdateable() &&
                         Schema.SObjectType.contact.fields.MailingState.isUpdateable() &&
                          Schema.SObjectType.contact.fields.MailingCountry.isUpdateable() &&
                          Schema.SObjectType.contact.fields.Country__c.isUpdateable() &&
                          Schema.SObjectType.contact.fields.Cisco_com_Login__c.isUpdateable() &&
                          Schema.SObjectType.contact.fields.Testing_ID__c.isUpdateable() &&
                          Schema.SObjectType.contact.fields.Cisco_ID_CSCO__c.isUpdateable() &&
                         Schema.SObjectType.contact.fields.Area_Code__c.isUpdateable() &&
                         Schema.SObjectType.contact.fields.Country_Code__c.isUpdateable() &&
                         Schema.SObjectType.contact.fields.Phone.isUpdateable() &&
                         Schema.SObjectType.contact.fields.Fax.isUpdateable() &&
                         Schema.SObjectType.contact.fields.HomePhone.isUpdateable()){
            	   	   contact.FirstName = firstname;
            	   	   contact.LastName = lastname;
            	   	   contact.Email = emailaddress;
            	   	   contact.Email_Alt_1__c = altemail1;
            	       contact.Email_Alt_2__c = altemail2;
            	       contact.MailingStreet = street;
            	       contact.MailingCity = city;
            	       contact.MailingPostalCode = postalCode;
            	       if (country == 'United States') {
            	           contact.MailingState = stateprovince;
            	       } else {
            	       	   contact.MailingState = '';
            	       }
            	       contact.MailingCountry = country;
            	       contact.Country__c = regioncountry;
            	       //contact.Audience__c = audience;
            	       contact.Cisco_com_Login__c = ciscocomlogin;
            	       contact.Testing_ID__c = testingid;
            	       contact.Cisco_ID_CSCO__c = ciscoid;
            	       contact.Area_Code__c = Integer.valueOf(areaCode.trim());
            	       contact.Country_Code__c = countryCode;
            	       contact.Phone = phonenumber;
            	       contact.Fax = faxPhone;
                       
            	       contact.HomePhone = homePhone;
            	       upsert contact;
                       }

Is there any shorter approach rather than checking each field. I checked each field but its not going away in checkmarx report.

Thanks,
Anuj​
Hi All,

I am iserting contact record in my class. I need to check if all the fields are updateble and then i will upsert the record. I have written the following code but it is not working. Kindly provide me solution.
 
if (Schema.sObjectType.Contact.isUpdateable()){
            	   	   contact.FirstName = firstname;
            	   	   contact.LastName = lastname;
            	   	   contact.Email = emailaddress;
            	   	   contact.Email_Alt_1__c = altemail1;
            	       contact.Email_Alt_2__c = altemail2;
            	       contact.MailingStreet = street;
            	       contact.MailingCity = city;
            	       contact.MailingPostalCode = postalCode;
            	       if (country == 'United States') {
            	           contact.MailingState = stateprovince;
            	       } else {
            	       	   contact.MailingState = '';
            	       }
            	       contact.MailingCountry = country;
            	       contact.Country__c = regioncountry;
            	       //contact.Audience__c = audience;
            	       contact.Cisco_com_Login__c = ciscocomlogin;
            	       contact.Testing_ID__c = testingid;
            	       contact.Cisco_ID_CSCO__c = ciscoid;
            	       contact.Area_Code__c = Integer.valueOf(areaCode.trim());
            	       contact.Country_Code__c = countryCode;
            	       contact.Phone = phonenumber;
            	       contact.Fax = faxPhone;
                       
            	       contact.HomePhone = homePhone;
            	       upsert contact;
                       }

 
Hi All,

I have a controller class which was previously written as without sharing. If I change it to with sharing will it have any impact?

Thanks,
Anuj