• Shephali Swarnkar
  • NEWBIE
  • 145 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 33
    Questions
  • 59
    Replies
if I have 2430 opportunity. for how many times each LOC will execute and why?
and how it will solve the Heap size and DML issues.

1. for (List<Opportunity> Opps : [SELECT Id FROM Oportunity]) {
2.    for (Contact opp : Opps){
3.        // Modify opp
4.    }
5.    Database.update(Opps, false); 
6. }

 
INTEGER I =0;
for(List<Opportunity> accs : [Select Name from Opportunity])
  {
       System.debug('size' +accs.size());
      I++;
      System.debug('OUTsize' +I);
  } 
System.debug('OUTsize' +I);

User-added image
Hi All,
    
            'Schema.sObjectType.Contact.fields.Account.Name.isAccessible()'
 using above code trying to check the Accessibility of Merge field  "Account.Name" in Contact object but getting Error that Account is not a field in Contact.
"Compile Error: account is not a field of Contact ".
How to resolve this issue??

Thanks



         

Hi All,    
                   I have got Reflected XSS Vulnerabilities for my App.Mentioned lines in report are:

Reproduction steps:
1.Login to the native application
2.Navigate to the respective tab
3.Select user from drop down list,Intercept the request

4.Apply attack value in mention parameter name.
                           I am unable to find out that where and what needs to be changed.
Note : In the above mentioned page we used to select the user from drop down list and get the details of task assigned to that user.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Upto My understanding i may got this XSS issue because i have used following apex code to get the details of user tasklist:

<apex:pageBlock title="Details" id="block1">
    <apex:detail subject="{!$CurrentPage.parameters.UserInput}" relatedList="false"/>
 </apex:pageBlock>
  

But at the same time when i browse this link https://developer.salesforce.com/page/Secure_Coding_Cross_Site_Scripting#Apex_and_Visualforce_Applications

i found 
<apex:outputText>
  {!$CurrentPage.parameters.userInput} <!-- safe (auto HTML Encoded) -->
</apex:outputText>


Question : If this is not vulnerable to XSS then why did i got this reflected XSS for my App.

Need Help to find out exact vulnerable code and soluttion for that.

Thanks                
Hi All,

        I got little idea of CRUD/FLS Enforcement Vulnerability find the following approach to overcome it.

eg:
<!-- This would normally bypass automatic FLS enforcement for accessibility-->
<apex:outputText value="{!contactName}" 
             rendered="{!$ObjectType.Contact.fields.Name.Accessible}" />
 
public with sharing class LeadDeleteExtension {
    private Lead l;
    public LeadDeleteExtension(ApexPages.StandardController ctr) {
      l = [SELECT Id FROM Lead WHERE Id=:ctr.getRecord().Id];
    }
    
    public PageReference deleteLead() {
      // Check if the user has delete access on the Lead object
      if (!Lead.sObjectType.getDescribe().isDeletable()){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,
                                                    'Insufficient access')); 
        return null;
      }
      
      delete l;
      return null;
    }

}
Question :
     1. Do I need To write such code each field of every object Ihave used in my App or is there any other way so that I can rectify it in                 one go.
     2. I am unable to identify what is XSS(crossite scripting) security failure and how to solve such issues in App
.
 
Hi All,
       I want to know about profile adding to package(managed/unmanaged both)
1.Can we add custom profile (if it is based on standard objects ), i have created a profile with(standard object + some custom tabs + some standard object field permission).
  I have added this to my package but when it is installed on other org it is not visible there.
2. I have made some changes in standard object like replaced existing picklist options and also renaming some field's lable. How can i add these standard object with those changes to package so that it will also be visible in different org too.

Thanks
Hi All,
     I want to add standard object as i did some changes like picklist option(reaplces the existing options) and also some chages like editing lable. so now i want to add these standard objects into my package. 
   can anyone please tell me that how to add such standard objects into my package so that it will reflect when one install it.

Thanks!!
Hi All,
     Using Developer edition i have developed an app now i want to get a managed app, Here i had got an managed app but i have added something which should not be added there (some record type which is not exist) in managed app now i need to delete but when i go and check to edit it i dint find any option from where i can delete those unwanted components.

Note: I unable to delete managed package because i have generated URL using Upload option)

User-added image
    Because of this i am unable to create another manged package as ("Your organization is configured to contain one managed package and an unlimited number of unmanaged packages.")

Question: How to delete this managed package so that i can then able to create other managed package.
Hi All,
     I am getting the following error while doing compilation but unable to figure it out.User-added image
Please help
Thanks
Hi All,
     Below is my controller code how to write test Method for it:
public with sharing class assigncontact
{
    public List<ContactWrapper> conWrp { get; set; }
    public Boolean showContact { get; set; }
    public Id selectedOwnerId { get; set; }
public assigncontact()
    {
        conWrp = new List<ContactWrapper>();
        showContact = true;
        
        for( Contact c : [ Select Id, Name, Email, Phone, ACCOUNT.NAME, Owner.Name from Contact order by Name])
        {
            conWrp.add( new ContactWrapper( c ));
        }
    }
    
    public List<SelectOption> getOptions()
    {
        showContact = false;
        
        List<SelectOption> options = new List<SelectOption>();
        
        for( User b : [ Select Id, Name from User where IsActive = true order by Name ])
        {
            options.add( new SelectOption( b.Id, b.Name ));
        }
                
        return options;
    }
 public void processSelected()
    {
        List<Contact> contacts = new List<Contact>();
        system.debug('****'+selectedOwnerId);
        for( ContactWrapper wrp : conWrp )
        {
            if( wrp.isSelected )
            {
                Contact c = new Contact( Id = wrp.accn.Id, OwnerId = selectedOwnerId );
                contacts.add( c );
            }
        }       
       
        if( contacts.size() > 0 )
            update contacts;
    }
    
    public class ContactWrapper
    {    
        public Contact accn { get; set; }
        public Boolean isSelected { get; set; }     

        public ContactWrapper( Contact a )
        {    
            this.accn = a;
            this.isSelected = false;
        }
    }

Please Help
Thanks
-----------------Controller----------------------
public class search_con 
{
 
  Public List<Contact> results{Get;set;}
  public String field_name{get;set {field_name=value;} }   
  public String keyword{get; set {keyword=value;}}
   
  public void search_now()
  {
     results=(List<Contact>)[FIND :keyword IN ALL FIELDS RETURNING CONTACT(NAME, ACCOUNT.NAME, Email, PHONE, FAX, Owner.Name, MobilePhone)][0];
     
  }
  
  public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('Name','Name'));
            options.add(new SelectOption('Email','Email'));
            options.add(new SelectOption('Phone','Phone'));            
            return options;
        } 
}

----------------------------VF------------------------------------
Input:<apex:inputText value="{!keyword}" />
  In:<apex:selectList multiselect="false" size="1" value="{!field_name}">                                                 
                      <apex:selectOptions value="{!items}"/>
                   </apex:selectList>
                   
  <apex:commandButton value="search" action="{!search_now}"/>
In above code I am able to do the search using input 'keyword' but how to use 'field_name' string so that i can find the input keyword in selected field only.i tried this
 
results=(List<Contact>)[FIND :keyword IN field_name FIELDS RETURNING CONTACT(NAME, ACCOUNT.NAME, Email, PHONE, FAX, Owner.Name, MobilePhone)][0];

but it is throwing error.

Thanks
 
Hi All,
    Below is my code which i have written to display the records.i have multiple tables(showing one at time as per choice given). and in table one field i made it a link so that i can get details of that records. In this code there is no error, when i am clicking any of the link first time which are populated it displays the details of that records but when i click second time to any other link it is not showing anything. why i can't get.

------------------VF code--------------------------
    <apex:pageBlockTable value="{!num_con}" style="" var="cn" rendered="{!If(showTable == 'donotcall',true,false)}">
<apex:column headerValue="Name">
<apex:commandLink value="{!cn.Name}" reRender="block1">
<apex:param name="p1" value="{!cn.id}"/>
</apex:commandLink> 
</apex:column>
<apex:column value="{!cn.Account.Name}"/>
<apex:column value="{!cn.DoNotCall}"/>
<apex:column value="{!cn.mobilephone}"/>
<apex:column value="{!cn.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
    <apex:pageBlock id="block1">
      <apex:detail subject="{!$CurrentPage.parameters.p1}" relatedList="false"/>
    </apex:pageBlock>
</apex:pageBlockSection>
</apex:pageBlock> 
---------------------------------------Controller Code---------------------------
public void reject()
 {
   showTable = 'donotcall';
 num_con=[select Name, Email, MobilePhone, Account.Name, Phone, LeadSource,DoNotCall from Contact where rejectcontact__c='yes' and owner.alias=: Alias];     
 }

showing the records for shubham jain because its clicked first but when clicking on "Ashley James" it wont show any records
Hi All,
     I had gone through some problems working withDescription field so now I got a solution to work with "Long Text Area DataType", if you want to count() the records or other filtering things with Description.
   I made a custom field "Notes__c"(Text Area) in contact object and using Trigger i copied the contents of Description field to Notes__c.
here is the code:
trigger CopydescToNotes on Contact (before insert,before update) {
for(Contact c : Trigger.new)
if(c.Description!=null)
c.Notes__c=c.Description;
}


Thanks 
Shephali
Hi All,
        I actually want to use count() on description object so that i can count the number of records in description field of contact object but its not working as it does not support for long text area data type.so i tried it using "Field Updates" in workflow rule. 
I have a custom field Notes__c(Data type:text area) 
formula given is: LEFT (Description, FIND(" ", Description))
but it is not working.Please help so that i can count on description field.

Thanks
 
How to give access permission to user/profile on the field  'LastActivityDate' as i can not see this field name in field permission table(setup ->manage user -> profiles ->Object Settings->field permission
Hi All,
      How to get pagination for Task and Event object as list controller does not support for these objects.
I am getting the following Error:
    [Error] Error: agent_task Compile Error: Illegal assignment from List<Task> to List<Task> at line 9 column 6
Please help me to figure it out:

public class task_list
 {   
    public String str{get;set;}
    public list<task> tasklist{get;set;}    
 public task_list()
 {
       str=UserInfo.getname();
     tasklist =[Select subject,Priority, status, ActivityDate,CreatedBy.Name,Owner.Name,Who.Name,Description, ReminderDateTime from task  where Owner.name= :str];
 } 
}
Hi All,
     Below is my code which shows the table contents based on link clicked.But here it shows both the table. My requirement is to show only one table at a time and hide another one and also initially the pageblock shows the blank structure of the pageblocktable initially.Is there any way to avoid such things too???

<apex:page controller="RerenderController">
 <apex:form >
  <apex:pageBlock >
<apex:pageBlockTable value="{!num_con}" var="cn" id="p1" >
<apex:column value="{!cn.Name}" />
<apex:column value="{!cn.Account.Name}"/>
<apex:column value="{!cn.Email}"/>
<apex:column value="{!cn.mobilephone}"/>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!num_con}" var="cn" id="p2">
<apex:column value="{!cn.Name}"/>
<apex:column value="{!cn.Account.Name}"/>
<apex:column value="{!cn.Email}"/>
<apex:column value="{!cn.mobilephone}"/>
<apex:column value="{!cn.phone}"/>
<apex:column value="{!cn.Contact_Type__c}"/>
</apex:pageBlockTable>
<apex:commandLink action="{!created_con}" value="table1"  reRender="p1"/>
<apex:commandLink action="{!createdpros}" value="table2" reRender="p2"/>
</apex:pageblock>
</apex:form>
</apex:page>
==========================Controller=====================
public class RerenderController
{
    public List<contact> num_con {get;set;}      
    public void created_con()
    {  
     num_con = [select name, account.name, mobilephone, phone, Contact_Type__c, Email from contact];
     }
      public void createdpros()
     {
     num_con = [select Name, Email, MobilePhone, Account.Name, Phone, Contact_Type__c from Contact where Contact_Type__c='prospect' and owner.alias='myada'];     
     }
   
}
Hi All,
     I know two ways to get the ID of USER
1.Using query : [select id from user] here we can get all IDs of users.
2.From URL we can the specific user's ID
        here if we want to get user's detail we need supply that ID from UI an way(list, input box etc...) and then we will get the detail.

Question:i need to develop an apex class to let user see their task list and details for which i need user's ID. Is there any other way to get the user's ID without supplying anything from UI so that whenever any user login they can run this apex class and can get their task list detail.
                
Hi All,
     I had gone through some problems working withDescription field so now I got a solution to work with "Long Text Area DataType", if you want to count() the records or other filtering things with Description.
   I made a custom field "Notes__c"(Text Area) in contact object and using Trigger i copied the contents of Description field to Notes__c.
here is the code:
trigger CopydescToNotes on Contact (before insert,before update) {
for(Contact c : Trigger.new)
if(c.Description!=null)
c.Notes__c=c.Description;
}


Thanks 
Shephali
if I have 2430 opportunity. for how many times each LOC will execute and why?
and how it will solve the Heap size and DML issues.

1. for (List<Opportunity> Opps : [SELECT Id FROM Oportunity]) {
2.    for (Contact opp : Opps){
3.        // Modify opp
4.    }
5.    Database.update(Opps, false); 
6. }

 
INTEGER I =0;
for(List<Opportunity> accs : [Select Name from Opportunity])
  {
       System.debug('size' +accs.size());
      I++;
      System.debug('OUTsize' +I);
  } 
System.debug('OUTsize' +I);

User-added image
I want to send an email message using a template to all contacts related to an account when a certain event happens in the account. For this I have created a trigger. The issue is with my "mail.setTargetObjectIds(lstIds)" statement. I recieve the following error: Method does not exist or incorrect signature: void setTargetObjectIds(List<Id>) from the type Messaging.SingleEmailMessage.

The variable lstlds is a list of ids I got by quering all related contacts of the account.What could the error be? Can't I us a list on the setTargetObjectIds function?
Hi All,
    
            'Schema.sObjectType.Contact.fields.Account.Name.isAccessible()'
 using above code trying to check the Accessibility of Merge field  "Account.Name" in Contact object but getting Error that Account is not a field in Contact.
"Compile Error: account is not a field of Contact ".
How to resolve this issue??

Thanks



         

Hi All,    
                   I have got Reflected XSS Vulnerabilities for my App.Mentioned lines in report are:

Reproduction steps:
1.Login to the native application
2.Navigate to the respective tab
3.Select user from drop down list,Intercept the request

4.Apply attack value in mention parameter name.
                           I am unable to find out that where and what needs to be changed.
Note : In the above mentioned page we used to select the user from drop down list and get the details of task assigned to that user.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Upto My understanding i may got this XSS issue because i have used following apex code to get the details of user tasklist:

<apex:pageBlock title="Details" id="block1">
    <apex:detail subject="{!$CurrentPage.parameters.UserInput}" relatedList="false"/>
 </apex:pageBlock>
  

But at the same time when i browse this link https://developer.salesforce.com/page/Secure_Coding_Cross_Site_Scripting#Apex_and_Visualforce_Applications

i found 
<apex:outputText>
  {!$CurrentPage.parameters.userInput} <!-- safe (auto HTML Encoded) -->
</apex:outputText>


Question : If this is not vulnerable to XSS then why did i got this reflected XSS for my App.

Need Help to find out exact vulnerable code and soluttion for that.

Thanks                
Hi All,

        I got little idea of CRUD/FLS Enforcement Vulnerability find the following approach to overcome it.

eg:
<!-- This would normally bypass automatic FLS enforcement for accessibility-->
<apex:outputText value="{!contactName}" 
             rendered="{!$ObjectType.Contact.fields.Name.Accessible}" />
 
public with sharing class LeadDeleteExtension {
    private Lead l;
    public LeadDeleteExtension(ApexPages.StandardController ctr) {
      l = [SELECT Id FROM Lead WHERE Id=:ctr.getRecord().Id];
    }
    
    public PageReference deleteLead() {
      // Check if the user has delete access on the Lead object
      if (!Lead.sObjectType.getDescribe().isDeletable()){
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,
                                                    'Insufficient access')); 
        return null;
      }
      
      delete l;
      return null;
    }

}
Question :
     1. Do I need To write such code each field of every object Ihave used in my App or is there any other way so that I can rectify it in                 one go.
     2. I am unable to identify what is XSS(crossite scripting) security failure and how to solve such issues in App
.
 
Hi All,
       I want to know about profile adding to package(managed/unmanaged both)
1.Can we add custom profile (if it is based on standard objects ), i have created a profile with(standard object + some custom tabs + some standard object field permission).
  I have added this to my package but when it is installed on other org it is not visible there.
2. I have made some changes in standard object like replaced existing picklist options and also renaming some field's lable. How can i add these standard object with those changes to package so that it will also be visible in different org too.

Thanks
Hi All,
     Using Developer edition i have developed an app now i want to get a managed app, Here i had got an managed app but i have added something which should not be added there (some record type which is not exist) in managed app now i need to delete but when i go and check to edit it i dint find any option from where i can delete those unwanted components.

Note: I unable to delete managed package because i have generated URL using Upload option)

User-added image
    Because of this i am unable to create another manged package as ("Your organization is configured to contain one managed package and an unlimited number of unmanaged packages.")

Question: How to delete this managed package so that i can then able to create other managed package.
Hi All,
     Below is my controller code how to write test Method for it:
public with sharing class assigncontact
{
    public List<ContactWrapper> conWrp { get; set; }
    public Boolean showContact { get; set; }
    public Id selectedOwnerId { get; set; }
public assigncontact()
    {
        conWrp = new List<ContactWrapper>();
        showContact = true;
        
        for( Contact c : [ Select Id, Name, Email, Phone, ACCOUNT.NAME, Owner.Name from Contact order by Name])
        {
            conWrp.add( new ContactWrapper( c ));
        }
    }
    
    public List<SelectOption> getOptions()
    {
        showContact = false;
        
        List<SelectOption> options = new List<SelectOption>();
        
        for( User b : [ Select Id, Name from User where IsActive = true order by Name ])
        {
            options.add( new SelectOption( b.Id, b.Name ));
        }
                
        return options;
    }
 public void processSelected()
    {
        List<Contact> contacts = new List<Contact>();
        system.debug('****'+selectedOwnerId);
        for( ContactWrapper wrp : conWrp )
        {
            if( wrp.isSelected )
            {
                Contact c = new Contact( Id = wrp.accn.Id, OwnerId = selectedOwnerId );
                contacts.add( c );
            }
        }       
       
        if( contacts.size() > 0 )
            update contacts;
    }
    
    public class ContactWrapper
    {    
        public Contact accn { get; set; }
        public Boolean isSelected { get; set; }     

        public ContactWrapper( Contact a )
        {    
            this.accn = a;
            this.isSelected = false;
        }
    }

Please Help
Thanks
-----------------Controller----------------------
public class search_con 
{
 
  Public List<Contact> results{Get;set;}
  public String field_name{get;set {field_name=value;} }   
  public String keyword{get; set {keyword=value;}}
   
  public void search_now()
  {
     results=(List<Contact>)[FIND :keyword IN ALL FIELDS RETURNING CONTACT(NAME, ACCOUNT.NAME, Email, PHONE, FAX, Owner.Name, MobilePhone)][0];
     
  }
  
  public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('Name','Name'));
            options.add(new SelectOption('Email','Email'));
            options.add(new SelectOption('Phone','Phone'));            
            return options;
        } 
}

----------------------------VF------------------------------------
Input:<apex:inputText value="{!keyword}" />
  In:<apex:selectList multiselect="false" size="1" value="{!field_name}">                                                 
                      <apex:selectOptions value="{!items}"/>
                   </apex:selectList>
                   
  <apex:commandButton value="search" action="{!search_now}"/>
In above code I am able to do the search using input 'keyword' but how to use 'field_name' string so that i can find the input keyword in selected field only.i tried this
 
results=(List<Contact>)[FIND :keyword IN field_name FIELDS RETURNING CONTACT(NAME, ACCOUNT.NAME, Email, PHONE, FAX, Owner.Name, MobilePhone)][0];

but it is throwing error.

Thanks
 
Hello everyone,
Who faced a XSS (Cross-Site Scripting)?
How can emulate attack XSS in the application?
Or XSS applies only to external web pages?
|org wide email for sender not supported without a provided email

I have a flow (originating on Case Button Click) firing an email alert (sent from an org wide email) that is causing above error.

any clues?

Hai All,

 

I have one requirement, can we the get the Task list in Visualforce page?????

 

I have tried a lot but i couldnt find out the solution.

Here is the code. Im getting error as List Controllers are supported for Task

public with sharing class TaskPagination {
private final Task t;

public TaskPagination(ApexPages.StandardSetController controller) {
this.c = (Task)controller.getRecord();
}
public ApexPages.StandardSetController TaskRecords{
get {
if(TaskRecords == null) {
return new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT t.ActivityDate, t.Status FROM Task t]));
}
return TaskRecords;
}
private set;
}
public List<Task> getTaskPagination() {
return (List<Task>) TaskRecords.getRecords();
}
}

 Thanks in Advance..........

 

  • September 17, 2012
  • Like
  • 0