• Amit Singh1989
  • NEWBIE
  • 35 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 33
    Replies

Hi friends,

 

I have an object named as "Job" in my org,

3 Record types are there

1)HR

2)IT

3)Sales

 

different page layouts are assigned for different Record types and i am using different different fields and picklist values for record types,

its fine with standard page, but when I override Create New button with vf page it doesnt work. 

Hi friends,

 

I have a Session object and Session Line Item object (They are associated with lookup relationship, where Session is master and session line item is child),

 

I am displaying List of session records in visualforce page using <apex:pageblocktable>

I am also using Edit and delete functionality using commandbutton,

 

my requirement is that "I want to restrict user to Edit any Session if any child record is associated with this" so when a user clicks on Edit button a popup should apper with message "You can not Edit this session".

 

How to acheive this functionality?

 

<apex:commandButton value="Edit" action="{!editSession}" reRender="hiddenBlock10">
                      <apex:param name="param1" value="{!Session.id}" assignTo="{!strSessionId}"></apex:param>
              </apex:commandButton>&nbsp;
 public pagereference editSession()
    {
        Pagereference p=new Pagereference('/apex/EditSession?id='+strSessionId);
        p.setRedirect(true);
        return p;
    }

 

 

 

 

Thanks,

Amit Singh

 

Hi friends,

I had created an object Purchase Order, DataType of Its standard Name field was Text,

After packaging (Managed Package) our clients want it as Auto populated, I am not able to do this, because I can change its Datatype,

 

How to solve this Issue.?

 

Thanks,

Amit 

Hi Friends,

 

I am using an object Purchase Order which is master of Purchase Order Line item in M-D Relationship,

on Purchase Order Line Item there is a lookup field of Estimate Line Item (another Object which is master of Estimate Spec Item in Master - Detail Relationship),

 

 

I want to display a partcular Purchase Order with its Purchse Order Line Item on Visualforce page, also want to display each Estimate Spec Item of Purchase Order Line Item's Estimate Line Item in the same page.

 

for Example -:

 

PO-001 (This is My Purchase Order for which i want to display POLI and Estimate Spec Items)


   POLI 1(Name)         EstimateLineItem1(Lookup to Estimate Line Item)            20Days(Quanityt)           100$(Amount)     --> POLI1's record......
        Spec1
        Spec2    (these 3 are spec of Estimate Line Item 1)
        Spec3
 
 POLI2          EstimateLineItem2              40Days            200$           -->POLI2's Record....
      Spec999
      Spec998 (there 3 are spec of Estimate Line Item 2)
      Spec997

 

 

 

How to do this?

 

Thanks

 

 

 

 

 

 

 

Hi Board,

 

I have installed my Application (Managed Package) into trialforce master org, Done all the customization,

 

but next time after login, if i try to go any of my custom tab it throws me following error and asks for enter login credentials

 

"You have attempted to access a page that requires a salesforce.com login. If you are already a user of the system, please login below."

 

Now after login i can access my App. (Earlier i was not this problem).

 

 

 

Thanks

Hi friends,

I have created a object Job in my developer org, written a trigger to avoid Duplicate Record Name,and it is working fine in case of duplicate case insensitive record Name,
for example -:
i have created a Job with Name -->  JOB
next time if I try to create new job with Name JOB I will get an error message "Duplicate Job Name" , that means it is working fine.

 

but if I try to use case sensitive record say job , it will throw an error "Attempt to de-reference a null object", How to fix this issue.

 

i am using this link for Trigger.

Trigger to avoid duplicate lead email

 

here is my code,

 

trigger AvoidDuplicateJobName on Job__c(before insert, before update) 
{

    Map<String, Job__c> jobMap = new Map<String, Job__c>();
    for (Job__c job : System.Trigger.new) 
    {
 
        if ((job.Name != null) && (System.Trigger.isInsert || (job.Name != System.Trigger.oldMap.get(job.Id).Name))) 
        {
            if (jobMap.containsKey(job.Name)) 
            {
                job.Name.addError('Another new Job has the '+ 'same Name.');
            }
            else 
            {
                jobMap.put(job.Name, job);
            }
       }
    }
    
    for (Job__c job : [SELECT Name FROM Job__c WHERE Name IN :jobMap.KeySet()])
    {   
     
        Job__c newjob = jobMap.get(job.Name);
        newjob.Name.addError('A Job with this Name '+ ' already exists.');
       
    }
}

 

 

Hello,

 

I have two custom objects job and Campaign with Lookup relationship. (Campaign is Master and Job is Child)

 

i want to display list of Campaign with its child records in a visualforce page , and i am using this code -:

 

public with sharing class JobTest1

{

    // Global variables

     public String JName {get; set;}

   

     // Start Constructor

     public JobTest1()

     {

         today=System.Today();

     }

     // End of Constructor

 

    public class cNodes

    {

         public List<Job__c> parent {get; set;}

         Public Campaign__c gparent {get;set;}

         public cNodes(Campaign__c  gp, List<Job__c> p)

         {

             parent = p;

             gparent = gp;

         }

    }

 

    Public List<cNodes> hierarchy;

 

    Public List<cNodes> getmainnodes()

    {

        hierarchy = new List<cNodes>();

        List<Campaign__c> tempparent = [Select Id,Name from Campaign__c LIMIT 10000];

        for (Integer i =0; i< tempparent.size() ; i++)

        {

               List<Job__c> tempchildren = [Select Id,Name,Job_Id__c,Client__c,Client__r.Name,Campaign__c,Completion_Date__c,Start_Date__c,Due_Date__c from Job__c where Campaign__c = :tempparent[i].Id Order By Name];

               hierarchy.add(new cNodes(tempparent[i],tempchildren));

        }  

        return hierarchy;

    }  

}

 It works if there is less record,but if records are huge it throws following error -:

 

 System.LimitException: JobSuite:Too many SOQL queries: 101

How can we fix this issue.

 

Thanks

 

 

  

 

Hi friends,
i have one requirement which is given below,

I have an object Object1 with two fields
1)Size (Number)
2)Description (Long Text)

another object is object2 which has similar fields like object1 i.e. Size,Description

user can not create/update object2's record manually it will be created or updated based on object1's record
means
there should be a trigger on object1 which will be fired when any record of object1 is created/updated/deleted,

How to do this?

 

Thanks

Hi all,

I got trialforce management org from partner portal which is a Developer org.

from this i have create Trialforce master org (which is Enterprise),
when i was trying to upload my package in this org i was getting following error,

Problem:

1.  Custom Tab Limit Exceeded
You've exceeded the maximum number of custom tabs allowed in your organization. (Required: 33, Available: 25) To learn about options for increasing the custom tab limit, please contact your administrator or salesforce.com.


Note -: i have installed same package into test org (Enterprise) and it installed without any error.

 

Thanks,

Amit Singh

Hi friends,


I have created a managed package for my application JS and uploaded its first version JS 1.0 (Developer,AppExchange),
earlier i had given my application for scan to SOURCE CODE SCANNER, and they respond back with "no issues".

then i had submitted my application for Security review  (fom appexchange),done all the formalities,
after three weeks salesforce respond with a mail which shows failure of application because of one vulnerabilities,that is :

 1)MIXED CONTENT VULNERABILITY

for this line
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
 </script>


and for highlighted lines

function showMessage(event, jsEvent, view)
    {
        document.getElementById("NoticeDiv_"+event.id).style.left = jsEvent.pageX+'px';+'px';
        document.getElementById("NoticeDiv_"+event.id).style.top = jsEvent.pageY+'px';
        document.getElementById("NoticeDiv_"+event.id).innerHTML = '<div id="TitleBar_'+event.id+'" class="drsMoveHandle">'+event.title+'<img src="http://images.fpitesters.com/shared/application_close_fade.png" id="closeButton_'+event.id+'" name="closeButton_'+event.id+'" onmouseover=\'javascript&colon;roll_over("closeButton_'+event.id+'", "http://images.fpitesters.com/shared/application_close.png");\' onmouseout= \'javascript&colon;roll_over("closeButton_'+event.id+'", "http://images.fpitesters.com/shared/application_close_fade.png");\' onClick="javascript&colon;hideMessage(\''+event.id+'\');" ></div> \
                                                          Staff: '+event.staff+'<br>'
          $("#NoticeDiv_"+event.id).slideDown('fast', function()
          {
          });   
 }



could anyone please help me how to fix this issue.

I think i should use static resource instead of url.

please correct me.




Thanks,
Amit Singh

I am not able to start security review process.


when I clicked on the "Start Review" link i am getting following error.

"To security review your application, you must be a salesforce.com partner and connect your partnership information to your provider profile. To connect this information, please login using your master AppExchange Publishing Organization and edit your provider profile."

 

Till yesterday It was working fine , i was able to start my security review process. but today i am not able to do this.

Following are the steps which i have used in this process.

Step (1) I have created a managed package into my developer org .

Step (2) I logged into Appexchange by using developer org credentials (Now i am able to see my Package here under "Your uploaded package" section). i click on "Manage licenses" Link next to package name, i got a question which asked "What organization do you use to manage your licenses (LMO)?" i had given sales org credentials.

(Note. earlier I logged a case into partner portal to get sales org, i got a sales org and i had installed LMA into my sales org)

Step (3) I logged into appexchange using my sales org credential,then from "your organization" section linked above developer org,and now i was able to see JobSuite 1.0 Package under your uploaded package. Till this everything was working fine and i was not getting any error even though i was clicking on "Start Review" link.

I have started receiving an error after 4th Step:

Step (4) Logged in appexchange using sales org credentials and clicked on Your organization link from here i clicked on "Change My AppExchange Publishing Organization" and given credentials for another org. now i am not getting any package under "Your uploaded Package" section (while going to appexchange using sales org credentials.)


After step (4) i am not able to start security review process. How can i fixed the issue cause by step 4?

 

Thanks

Amit Singh

I have made managed package entries into appExchange (initial step) It was just to try out how appExchange process works.But now i want to remove those entries from my aPPexchange.

once these older entries are removed, i am going to list my final package.

 

 

Thanks,

Amit Singh 

 


Hi friend,

i have created an visualforce page where i have used <apex:inputFile /> to take any CSV file as input

then i am displaying that CSV file's data into the same vf page in tabular format...

 

but i want that selected CSV's data should be displayed in another vf page. (so by setting attribute renderas="pdf" i can view CSV's data in a PDF format)

 

 

how can i do this?

 

 

here is my code...

 

<apex:page controller="uploadCSVcontroller">
  <apex:form >
  <apex:pageMessages id="pm"/>
  <apex:inputFile value="{!contentFile}" filename="{!nameFile}"/>
  <apex:commandButton value="Display" id="theButton"/>  
  
  
  
  <apex:pageBlock >
  <apex:outputPanel id="results">
  <p>nameFile: {!nameFile}</p>
  <p>rowCount: {!rowCount}</p>
  <p>colCount: {!colCount}</p>
    <table title="CSV Output" border="1" width="100%">
       <apex:repeat value="{!results}" var="row">
           <tr>
               <apex:repeat value="{!row}" var="cell">
                   <td> {!cell} </td>
               </apex:repeat>
           </tr>
       </apex:repeat>
     </table>
  </apex:outputPanel>
  </apex:pageBlock>
  </apex:form>
</apex:page>







Controller


public class uploadCSVcontroller 
  {

    public Blob contentFile { get; set; }
    public String nameFile { get; set; }
    public Integer rowCount { get; set; }
    public Integer colCount { get; set; }
    
    public List<List<String>> getResults() 
    {
        List<List<String>> parsedCSV = new List<List<String>>();
        rowCount = 0;
        colCount = 0;
        if (contentFile != null)
        {
            String fileString = contentFile.toString();
            parsedCSV = parseCSV(fileString, False);
            rowCount = parsedCSV.size();
            for (List<String> row : parsedCSV)
            {
                if (row.size() > colCount)
                {
                    colCount = row.size();
                }
            }
        }
        return parsedCSV;
    }
    
    public Pagereference CreatePDF()
     {
      pagereference pr = new pagereference('/apex/FinalReport1');
      pr.setredirect(true);
      return pr;
     }
    
    public static List<List<String>> parseCSV(String contents,Boolean skipHeaders) 
     {
        List<List<String>> allFields = new List<List<String>>();
        contents = contents.replaceAll(',"""',',"DBLQT').replaceall('""",','DBLQT",');
        contents = contents.replaceAll('""','DBLQT');
        List<String> lines = new List<String>();
        try 
        {
          lines = contents.split('\r'); // using carriage return accomodates windows, unix, and mac files
        }
        catch (System.ListException e) 
        {
            System.debug('Limits exceeded?' + e.getMessage());
        }
        Integer num = 0;
        for(String line: lines) 
        {
           if (line.replaceAll(',','').trim().length() == 0) break;
            List<String> fields = line.split(',');  
            List<String> cleanFields = new List<String>();
            String compositeField;
            Boolean makeCompositeField = false;
            for(String field: fields) 
            {
                if (field.startsWith('"') && field.endsWith('"')) 
                {
                    cleanFields.add(field.replaceAll('DBLQT','"'));
                }
                else if (field.startsWith('"')) 
                {
                    makeCompositeField = true;
                    compositeField = field;
                }
                else if (field.endsWith('"')) 
                {
                    compositeField += ',' + field;
                    cleanFields.add(compositeField.replaceAll('DBLQT','"'));
                    makeCompositeField = false;
                }
                else if (makeCompositeField) 
                {
                    compositeField +=  ',' + field;
                }
                else
                {
                    cleanFields.add(field.replaceAll('DBLQT','"'));
                }
            }
            
            allFields.add(cleanFields);
        }
        if (skipHeaders) allFields.remove(0);
        return allFields;       
     }

}

 

 

 

Thanks,

Amit Singh

Hi Friends,

 

here is my problem

"I want to display Excel data in visualforce page".

could any one please explain me that how to do this?

 

 

Thanks,

Amit Singh

Hi friends,

I have created an object named as Schedule Task.and i am overriding its delete button with vf page(to fix navigation when record is deleted)...

code is working properly...but when i used Source code scanner tool ,i got XSRF issue for this vf page and its apex class....

 

Snapshot and source code are given below....

 

 

 

Thank you.

Amit Singh

 

XSRF issue

Severity - Serious
1. <apex:page standardController="Schedule_Task__c" extensions="DeleteScheduleTask" action="!
CheckDelete}"> //deletescheduletask.apexp

 

23. public PageReference checkDelete() //deletescheduletask.cls
...
27. Database.delete(objST);

 

<!-- VF PAGE  -->

<apex:page standardController="Schedule_Task__c" extensions="DeleteScheduleTask" action="{!CheckDelete}">
  
</apex:page>



/* Apex class */

public with sharing class DeleteScheduleTask 
{

    public Id STId;
    private final Schedule_Task__c objST;
      
    /* Standard Controller Constructor */
    public DeleteScheduleTask(ApexPages.StandardController con) 
    {
         this.objST=(Schedule_Task__c)con.getrecord();
STId = [Select Id, Schedule_Template__c from Schedule_Task__c where Id =:objST.Id].Schedule_Template__c;
    
    }
    /* ENd of Standard Controller Constructor */
    
    
    /* Method called on to Delete Schedule Task */
     public PageReference checkDelete()
     {
        try
        {
            Database.delete(objST);  
        }
        catch(System.DMLException e)
        {
            return null;
        }
         PageReference p =  new Pagereference('/apex/ScheduleTemplateTabOverride?id='+STId);
            p.setRedirect(true);
            return p;
     }



 

Hi,

 

I am trying to include a custom profile settings into my managed - beta package components. I am unable to do so. When I have added the custom profile setting to the components of the package it says 'N/A' in 'Available in Versions' column next to the custom profile setting entry.

 

Are we allowed to include Profile Setting into packages and use them to get installed with the package in other orgs?

 

Thanks

Amit Singh

I am getting issue while dealing with record types.

 

i have an object Estimate.

followng are the fields...

Name

Date

Desctiption

and Approve (Check box)....

 

i have two different pagelayouts based on Approve check box...

(i am using record type and assigning them layout and based on workflow rule i am updating the field type)

 

 

it works fine in my dev org,,, but when i am creating package and installing it in new org then i am not getting such kind of assignment for Recordtypes as i did in my org....

what i am doing wrong?

Hi friend,

i have created an visualforce page where i have used <apex:inputFile /> to take any CSV file as input

then i am displaying that CSV file's data into the same vf page in tabular format...

 

but i want that selected CSV's data should be displayed in another vf page. (so by setting attribute renderas="pdf" i can view CSV's data in a PDF format)

 

 

how can i do this?

 

 

here is my code...

 

<apex:page controller="uploadCSVcontroller">
  <apex:form >
  <apex:pageMessages id="pm"/>
  <apex:inputFile value="{!contentFile}" filename="{!nameFile}"/>
  <apex:commandButton value="Display" id="theButton"/>  
  
  
  
  <apex:pageBlock >
  <apex:outputPanel id="results">
  <p>nameFile: {!nameFile}</p>
  <p>rowCount: {!rowCount}</p>
  <p>colCount: {!colCount}</p>
    <table title="CSV Output" border="1" width="100%">
       <apex:repeat value="{!results}" var="row">
           <tr>
               <apex:repeat value="{!row}" var="cell">
                   <td> {!cell} </td>
               </apex:repeat>
           </tr>
       </apex:repeat>
     </table>
  </apex:outputPanel>
  </apex:pageBlock>
  </apex:form>
</apex:page>







Controller


public class uploadCSVcontroller 
  {

    public Blob contentFile { get; set; }
    public String nameFile { get; set; }
    public Integer rowCount { get; set; }
    public Integer colCount { get; set; }
    
    public List<List<String>> getResults() 
    {
        List<List<String>> parsedCSV = new List<List<String>>();
        rowCount = 0;
        colCount = 0;
        if (contentFile != null)
        {
            String fileString = contentFile.toString();
            parsedCSV = parseCSV(fileString, False);
            rowCount = parsedCSV.size();
            for (List<String> row : parsedCSV)
            {
                if (row.size() > colCount)
                {
                    colCount = row.size();
                }
            }
        }
        return parsedCSV;
    }
    
    public Pagereference CreatePDF()
     {
      pagereference pr = new pagereference('/apex/FinalReport1');
      pr.setredirect(true);
      return pr;
     }
    
    public static List<List<String>> parseCSV(String contents,Boolean skipHeaders) 
     {
        List<List<String>> allFields = new List<List<String>>();
        contents = contents.replaceAll(',"""',',"DBLQT').replaceall('""",','DBLQT",');
        contents = contents.replaceAll('""','DBLQT');
        List<String> lines = new List<String>();
        try 
        {
          lines = contents.split('\r'); // using carriage return accomodates windows, unix, and mac files
        }
        catch (System.ListException e) 
        {
            System.debug('Limits exceeded?' + e.getMessage());
        }
        Integer num = 0;
        for(String line: lines) 
        {
           if (line.replaceAll(',','').trim().length() == 0) break;
            List<String> fields = line.split(',');  
            List<String> cleanFields = new List<String>();
            String compositeField;
            Boolean makeCompositeField = false;
            for(String field: fields) 
            {
                if (field.startsWith('"') && field.endsWith('"')) 
                {
                    cleanFields.add(field.replaceAll('DBLQT','"'));
                }
                else if (field.startsWith('"')) 
                {
                    makeCompositeField = true;
                    compositeField = field;
                }
                else if (field.endsWith('"')) 
                {
                    compositeField += ',' + field;
                    cleanFields.add(compositeField.replaceAll('DBLQT','"'));
                    makeCompositeField = false;
                }
                else if (makeCompositeField) 
                {
                    compositeField +=  ',' + field;
                }
                else
                {
                    cleanFields.add(field.replaceAll('DBLQT','"'));
                }
            }
            
            allFields.add(cleanFields);
        }
        if (skipHeaders) allFields.remove(0);
        return allFields;       
     }

}

 

 

 

Thanks,

Amit Singh

Hi friends,

 

I have an object named as "Job" in my org,

3 Record types are there

1)HR

2)IT

3)Sales

 

different page layouts are assigned for different Record types and i am using different different fields and picklist values for record types,

its fine with standard page, but when I override Create New button with vf page it doesnt work. 

Hi friends,

 

I have a Session object and Session Line Item object (They are associated with lookup relationship, where Session is master and session line item is child),

 

I am displaying List of session records in visualforce page using <apex:pageblocktable>

I am also using Edit and delete functionality using commandbutton,

 

my requirement is that "I want to restrict user to Edit any Session if any child record is associated with this" so when a user clicks on Edit button a popup should apper with message "You can not Edit this session".

 

How to acheive this functionality?

 

<apex:commandButton value="Edit" action="{!editSession}" reRender="hiddenBlock10">
                      <apex:param name="param1" value="{!Session.id}" assignTo="{!strSessionId}"></apex:param>
              </apex:commandButton>&nbsp;
 public pagereference editSession()
    {
        Pagereference p=new Pagereference('/apex/EditSession?id='+strSessionId);
        p.setRedirect(true);
        return p;
    }

 

 

 

 

Thanks,

Amit Singh

 

Hi friends,

I had created an object Purchase Order, DataType of Its standard Name field was Text,

After packaging (Managed Package) our clients want it as Auto populated, I am not able to do this, because I can change its Datatype,

 

How to solve this Issue.?

 

Thanks,

Amit 

Hi all,

I want to display Account History as a related list in Visual force page. I am trying below syntax

<apex:page standardController="Account">
        <apex:relatedList list="AccountHistory"/>
</apex:page>

But it is giving error as 'AccountHistory' is not a valid child relationship name for entity Account '

Please let me know the correct syntax of API name for account history to display it as a related list.

Thanks,
Yogesh Agashe

Hi friends,

I have created a object Job in my developer org, written a trigger to avoid Duplicate Record Name,and it is working fine in case of duplicate case insensitive record Name,
for example -:
i have created a Job with Name -->  JOB
next time if I try to create new job with Name JOB I will get an error message "Duplicate Job Name" , that means it is working fine.

 

but if I try to use case sensitive record say job , it will throw an error "Attempt to de-reference a null object", How to fix this issue.

 

i am using this link for Trigger.

Trigger to avoid duplicate lead email

 

here is my code,

 

trigger AvoidDuplicateJobName on Job__c(before insert, before update) 
{

    Map<String, Job__c> jobMap = new Map<String, Job__c>();
    for (Job__c job : System.Trigger.new) 
    {
 
        if ((job.Name != null) && (System.Trigger.isInsert || (job.Name != System.Trigger.oldMap.get(job.Id).Name))) 
        {
            if (jobMap.containsKey(job.Name)) 
            {
                job.Name.addError('Another new Job has the '+ 'same Name.');
            }
            else 
            {
                jobMap.put(job.Name, job);
            }
       }
    }
    
    for (Job__c job : [SELECT Name FROM Job__c WHERE Name IN :jobMap.KeySet()])
    {   
     
        Job__c newjob = jobMap.get(job.Name);
        newjob.Name.addError('A Job with this Name '+ ' already exists.');
       
    }
}

 

 

Hello,

 

I have two custom objects job and Campaign with Lookup relationship. (Campaign is Master and Job is Child)

 

i want to display list of Campaign with its child records in a visualforce page , and i am using this code -:

 

public with sharing class JobTest1

{

    // Global variables

     public String JName {get; set;}

   

     // Start Constructor

     public JobTest1()

     {

         today=System.Today();

     }

     // End of Constructor

 

    public class cNodes

    {

         public List<Job__c> parent {get; set;}

         Public Campaign__c gparent {get;set;}

         public cNodes(Campaign__c  gp, List<Job__c> p)

         {

             parent = p;

             gparent = gp;

         }

    }

 

    Public List<cNodes> hierarchy;

 

    Public List<cNodes> getmainnodes()

    {

        hierarchy = new List<cNodes>();

        List<Campaign__c> tempparent = [Select Id,Name from Campaign__c LIMIT 10000];

        for (Integer i =0; i< tempparent.size() ; i++)

        {

               List<Job__c> tempchildren = [Select Id,Name,Job_Id__c,Client__c,Client__r.Name,Campaign__c,Completion_Date__c,Start_Date__c,Due_Date__c from Job__c where Campaign__c = :tempparent[i].Id Order By Name];

               hierarchy.add(new cNodes(tempparent[i],tempchildren));

        }  

        return hierarchy;

    }  

}

 It works if there is less record,but if records are huge it throws following error -:

 

 System.LimitException: JobSuite:Too many SOQL queries: 101

How can we fix this issue.

 

Thanks

 

 

  

 

I have been attempting to use .css styling to achieve rounded corners for the active and inactive tabs for the standard apex:tabPanel. Rounded corners do appear but only on the "inner frame" of the tab header. There seems to be a hard coded light grey rectangular outer border around each of the tabs that I dont understand how to remove. There also seems to be a hard coded horizontal border between the top of the tab content frame and the bottom of each of the tabs. I have tried border: none, color and size options but they dont seem to affect this additional border. I would appreciate any thoughts or suggestions.

  • February 26, 2012
  • Like
  • 0

Hi friends,


I have created a managed package for my application JS and uploaded its first version JS 1.0 (Developer,AppExchange),
earlier i had given my application for scan to SOURCE CODE SCANNER, and they respond back with "no issues".

then i had submitted my application for Security review  (fom appexchange),done all the formalities,
after three weeks salesforce respond with a mail which shows failure of application because of one vulnerabilities,that is :

 1)MIXED CONTENT VULNERABILITY

for this line
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
 </script>


and for highlighted lines

function showMessage(event, jsEvent, view)
    {
        document.getElementById("NoticeDiv_"+event.id).style.left = jsEvent.pageX+'px';+'px';
        document.getElementById("NoticeDiv_"+event.id).style.top = jsEvent.pageY+'px';
        document.getElementById("NoticeDiv_"+event.id).innerHTML = '<div id="TitleBar_'+event.id+'" class="drsMoveHandle">'+event.title+'<img src="http://images.fpitesters.com/shared/application_close_fade.png" id="closeButton_'+event.id+'" name="closeButton_'+event.id+'" onmouseover=\'javascript&colon;roll_over("closeButton_'+event.id+'", "http://images.fpitesters.com/shared/application_close.png");\' onmouseout= \'javascript&colon;roll_over("closeButton_'+event.id+'", "http://images.fpitesters.com/shared/application_close_fade.png");\' onClick="javascript&colon;hideMessage(\''+event.id+'\');" ></div> \
                                                          Staff: '+event.staff+'<br>'
          $("#NoticeDiv_"+event.id).slideDown('fast', function()
          {
          });   
 }



could anyone please help me how to fix this issue.

I think i should use static resource instead of url.

please correct me.




Thanks,
Amit Singh

I've inherited an application that uses custom Visualforce pages to perform actions when a user presses a custom button.

 

E.g. There is a custom button on Opportunity that links to the Visualforce page and passes a query string parameter. When the users GET request arrives at the visual force page an action is fired in the custom controller to a method. The method calls out to some web services and ultimately updates the database.

 

This opens the user up to CSRF issues with the GET request ultimately updating the database.

 

CSRF and apex:page and Apex and Visualforce Applications suggest changing the visualforce page and custom controller to using a apex:form and button to trigger the database updating action though a POST. This allows the inbuilt com.salesforce.visualforce.ViewStateCSRF to ensure the user triggered the action and help avoid CSRF issues.

 

However, this requires the user to perform an extra button press.

 

Is there an alternative approach I can use to safely perform the action from the button on Opportunity without opening up CSRF issues?

 

The same question has been posted on StackOverflow: CSRF safe Custom button linked to Apex method

Hi friend,

i have created an visualforce page where i have used <apex:inputFile /> to take any CSV file as input

then i am displaying that CSV file's data into the same vf page in tabular format...

 

but i want that selected CSV's data should be displayed in another vf page. (so by setting attribute renderas="pdf" i can view CSV's data in a PDF format)

 

 

how can i do this?

 

 

here is my code...

 

<apex:page controller="uploadCSVcontroller">
  <apex:form >
  <apex:pageMessages id="pm"/>
  <apex:inputFile value="{!contentFile}" filename="{!nameFile}"/>
  <apex:commandButton value="Display" id="theButton"/>  
  
  
  
  <apex:pageBlock >
  <apex:outputPanel id="results">
  <p>nameFile: {!nameFile}</p>
  <p>rowCount: {!rowCount}</p>
  <p>colCount: {!colCount}</p>
    <table title="CSV Output" border="1" width="100%">
       <apex:repeat value="{!results}" var="row">
           <tr>
               <apex:repeat value="{!row}" var="cell">
                   <td> {!cell} </td>
               </apex:repeat>
           </tr>
       </apex:repeat>
     </table>
  </apex:outputPanel>
  </apex:pageBlock>
  </apex:form>
</apex:page>







Controller


public class uploadCSVcontroller 
  {

    public Blob contentFile { get; set; }
    public String nameFile { get; set; }
    public Integer rowCount { get; set; }
    public Integer colCount { get; set; }
    
    public List<List<String>> getResults() 
    {
        List<List<String>> parsedCSV = new List<List<String>>();
        rowCount = 0;
        colCount = 0;
        if (contentFile != null)
        {
            String fileString = contentFile.toString();
            parsedCSV = parseCSV(fileString, False);
            rowCount = parsedCSV.size();
            for (List<String> row : parsedCSV)
            {
                if (row.size() > colCount)
                {
                    colCount = row.size();
                }
            }
        }
        return parsedCSV;
    }
    
    public Pagereference CreatePDF()
     {
      pagereference pr = new pagereference('/apex/FinalReport1');
      pr.setredirect(true);
      return pr;
     }
    
    public static List<List<String>> parseCSV(String contents,Boolean skipHeaders) 
     {
        List<List<String>> allFields = new List<List<String>>();
        contents = contents.replaceAll(',"""',',"DBLQT').replaceall('""",','DBLQT",');
        contents = contents.replaceAll('""','DBLQT');
        List<String> lines = new List<String>();
        try 
        {
          lines = contents.split('\r'); // using carriage return accomodates windows, unix, and mac files
        }
        catch (System.ListException e) 
        {
            System.debug('Limits exceeded?' + e.getMessage());
        }
        Integer num = 0;
        for(String line: lines) 
        {
           if (line.replaceAll(',','').trim().length() == 0) break;
            List<String> fields = line.split(',');  
            List<String> cleanFields = new List<String>();
            String compositeField;
            Boolean makeCompositeField = false;
            for(String field: fields) 
            {
                if (field.startsWith('"') && field.endsWith('"')) 
                {
                    cleanFields.add(field.replaceAll('DBLQT','"'));
                }
                else if (field.startsWith('"')) 
                {
                    makeCompositeField = true;
                    compositeField = field;
                }
                else if (field.endsWith('"')) 
                {
                    compositeField += ',' + field;
                    cleanFields.add(compositeField.replaceAll('DBLQT','"'));
                    makeCompositeField = false;
                }
                else if (makeCompositeField) 
                {
                    compositeField +=  ',' + field;
                }
                else
                {
                    cleanFields.add(field.replaceAll('DBLQT','"'));
                }
            }
            
            allFields.add(cleanFields);
        }
        if (skipHeaders) allFields.remove(0);
        return allFields;       
     }

}

 

 

 

Thanks,

Amit Singh

Hi Friends,

 

here is my problem

"I want to display Excel data in visualforce page".

could any one please explain me that how to do this?

 

 

Thanks,

Amit Singh

How to read the .csv report data into the apex. then that csv file data send to the pdf. Please help me for this requirement.

I want to generate the report as .csv r .xls.  Then take that file data and conver into pdf. 

I've leveraged the trigger example here: http://www.anthonyvictorio.com/salesforce/roll-up-summary-trigger/ however I need to change it so that it can accomodate for 4 sum of currency fields (not just 1) to update four different rollup fields on the parent Account (Bank__c).

 

Some information: A Bank has multiple SRFs, and under each SRF are a set of Fees. There are 4 Fee fields on the SRFs that each need to roll up seperately onto their respective Fee fields on the Bank. That's why there is a Pipeline_Fees_Bank__c and Pipeline_Fees__c (SRF). There are 3 more sets of these fields.

 

How can I achieve rolling up the other three by modifying this?

 

trigger rollUpFees on Service_Request__c (after delete, after insert, after update) {

  //Limit the size of list by using Sets which do not contain duplicate elements
  set<Id> AccountIds = new set<Id>();

  //When adding new SRFs or updating existing SRFs
  if(trigger.isInsert || trigger.isUpdate){
    for(Service_Request__c p : trigger.new){
      AccountIds.add(p.Bank__c);
    }
  }

  //When deleting SRFs
  if(trigger.isDelete){
    for(Service_Request__c p : trigger.old){
      AccountIds.add(p.Bank__c);
    }
  }

  //Map will contain one Bank Id to one sum value
  map<Id,Double> AccountMap = new map <Id,Double>();

  //Produce a sum of fees on SRFs and add them to the map
  //use group by to have a single Bank Id with a single sum value
  for(AggregateResult q : [select Bank__c,sum(Pipeline_Fees__c)
    from Service_Request__c where Bank__c IN :AccountIds group by Bank__c]){
      AccountMap.put((Id)q.get('Bank__c'),(Double)q.get('expr0'));
  }

  List<Account> AccountsToUpdate = new List<Account>();

  //Run the for loop on Accounts using the non-duplicate set of Bank Ids
  //Get the sum value from the map and create a list of Accounts to update
  for(Account a : [Select Id, Pipeline_Fees_Bank__c from Account where Id IN :AccountIds]){
    Double PaymentSum = AccountMap.get(a.Id);
    a.Pipeline_Fees_Bank__c = PaymentSum;
    AccountsToUpdate.add(a);
  }

  update AccountsToUpdate;
}

 

To get an idea of what I'd like to change...There are 3 more "Fees" that need to be summed up:

 

  //Produce a sum of fees on SRFs and add them to the map
  //use group by to have a single Bank Id with a single sum value
  for(AggregateResult q : [select Bank__c,sum(Pipeline_Fees__c),sum(Incurred_Fees__c),sum(Paid_Fees__c),sum(Unpaid_Fees__c)
    from Service_Request__c where Bank__c IN :AccountIds group by Bank__c]){
      AccountMap.put((Id)q.get('Bank__c'),(Double)q.get('expr0'));
  }

 I'm new to triggers, so I'm not sure how to achieve this! I don't want to be writing four triggers, one for each one - i dont think that's the best way to achieve this...

  • November 12, 2011
  • Like
  • 0

Hi All,

 

I have heard about security audit in salesforce and I got below link for that.

 

http://wiki.developerforce.com/index.php/Requirements_Checklist

 

I have few questions on that.

 

  1. Is there really security audit from salesforce team?
  2. Is it automatical process or manual process?
  3. In Which point they perform this audit?
  4. How long they take for that process?
  5. What is the output of security audit?
  6. What if we fail the audit?
  7. Can we request for re-audit?

Thanks in Advance

 

I am trying to write a trigger that will autofollow a group users to every new record in the object MPS__c

 

I have been able to automatically follow one user to the record, but when I try to autofollow additional users, I recieve the following error:

 

Error: Compile Error: Duplicate field initialization: subscriberid at line 24 column 34

 

 

Here is my trigger:

 

 

trigger MPSFollowers on MPS__c (After Insert) {

    Set<Id> mIds = new Set<Id>();
    Set<Id> fId = new Set<Id>();
    for(MPS__c mps :trigger.new) {
    
        mids.add(mps.id);
        System.debug('**** 1 mps id : '+ mps.id);
    }
    
   List<MPS__c> p = [select id from MPS__c where id in :mIds];

   
   List<User> u1 = [select id from User where name = 'Shawn Prendiville'];
   List<User> u2 = [select id from User where name = 'Mariann Harmon'];
   List<User> u3 = [select id from User where name = 'Paul van Vugt'];
   List<User> u4 = [select id from User where name = 'Gary Brown'];
   List<User> u5 = [select id from User where name = 'Dave Setzer'];
                    
    EntitySubscription follow = new EntitySubscription (

                                 parentId = p[0].id,
                                 subscriberid = u1[0].id,
                                 subscriberid = u2[0].id
                );

    insert follow;


}

 

 

How do I bulkify this trigger and assign multiple users to follow the record?

 

Thank you,

ckellie

Hello Everyone,

I am very new to Salesforce.com, I need to read and write a CSV file using Apex code.

Functionality wants to implement : Read some records using query and write into a excel file and
read a CSV file and insert records into database.
this should be using apex code.

Please help me :)

Thanks