• J&A_Dev
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 15
    Replies

Hello,

 

I am available to take on small Force.com projects as a part-time freelancer. I have over 6 years of development experience on the Force.com platform.

 

Here is a list of skill sets that I would be providing to clients:

- Experience with numerous Javascript frameworks such as jQuery, jQuery Mobile, YUI2, and Google Maps API V2.

- Experience integrating Java applications (via the SFDC WSC library) with Force.com applications.

- Extensive experience with developing Visualforce pages, Apex classes and triggers and Batch Apex jobs.

- Experience with creating SFDC reports and dashboards.

 

Please send me an email at thesfdcfreelancer@gmail.com for any questions you have. 

 

Thanks!

Hi,

 

I'm planning to take the Dev 401 Exam and was wondering what the best approach would be to prepare for it. Also, If you have recently taken the exam, any feedback on it would be appreciated as well.

 

Thanks in advance.

Responsibilities:

  • Assist third-party developers to troubleshoot their integration with salesforce.com APIs, Apex, Visualforce and implementation

          of other salesforce.com developer products. This will involve debugging, troubleshooting, and taking

          responsibility to see that the issue is fully resolved.

  • Write sample code, client libraries, and contribute to Open Source projects.
  •  The Developer Support Engineer will take the initiative to create knowledge base materials dedicated

          towards operational efficiency while also empowering and enabling the developer community.

 

Please reach out to nsyed@salesforce.com or apply below!

 

https://careers.secure.force.com/internal/ts2__JobDetails?jobId=a1k700000006MjNAAU&tSource=

  • November 26, 2012
  • Like
  • 0

Help please! I'm trying to setup a trigger for when an account owner changes that all contact owners change with the account owner EXCEPT for one individual (contact owner)..Can anyone help me add a line of code to say if the contact owner is 'Richard W' then don't change the contact owner, but if it's anyone else then change. My code so far is:

 

trigger reassignRelatedContactsAndOpportunities on Account (after update) {
   try {
      Set<Id> accountIds = new Set<Id>(); //set for holding the Ids of all Accounts that have been assigned to new Owners
      Map<Id, String> oldOwnerIds = new Map<Id, String>(); //map for holding the old account ownerId
      Map<Id, String> newOwnerIds = new Map<Id, String>(); //map for holding the new account ownerId
      Contact[] contactUpdates = new Contact[0]; //Contact sObject to hold OwnerId updates
      Opportunity[] opportunityUpdates = new Opportunity[0]; //Opportunity sObject to hold OwnerId updates
     
      for (Account a : Trigger.new) { //for all records
         if (a.OwnerId != Trigger.oldMap.get(a.Id).OwnerId) {
            oldOwnerIds.put(a.Id, Trigger.oldMap.get(a.Id).OwnerId); //put the old OwnerId value in a map
            newOwnerIds.put(a.Id, a.OwnerId); //put the new OwnerId value in a map
            accountIds.add(a.Id); //add the Account Id to the set
         }
      }
     
      if (!accountIds.isEmpty()) { //if the accountIds Set is not empty
         for (Account act : [SELECT Id, (SELECT Id, OwnerId FROM Contacts), (SELECT Id, OwnerId FROM Opportunities WHERE IsClosed = False) FROM Account WHERE Id in :accountIds]) { //SOQL to get Contacts and Opportunities for updated Accounts
            String newOwnerId = newOwnerIds.get(act.Id); //get the new OwnerId value for the account
            String oldOwnerId = oldOwnerIds.get(act.Id); //get the old OwnerId value for the account
            for (Contact c : act.Contacts) { //for all contacts
            if (c.Contact Owner == 'Richard W')
            if (c.OwnerId == c.OwnerId) { //if the contact is assigned to the old account Owner      
                  Contact updatedContact = new Contact(Id = c.Id, OwnerId = newOwnerId); //create a new Contact sObject
                  contactUpdates.add(updatedContact); //add the contact to our List of updates
               }
            }
            for (Opportunity o : act.Opportunities) { //for all opportunities
               if (o.OwnerId == oldOwnerId) { //if the opportunity is assigned to the old account Owner
                  Opportunity updatedOpportunity = new Opportunity(Id = o.Id, OwnerId = newOwnerId); //create a new Opportunity sObject
                  opportunityUpdates.add(updatedOpportunity); //add the opportunity to our List of updates
               }
            }
         }
         update contactUpdates; //update the Contacts
         update opportunityUpdates; //update the Opportunities
      }
   } catch(Exception e) { //catch errors
      System.Debug('reassignRelatedContactsAndOpportunities failure: '+e.getMessage()); //write error to the debug log
   }
}

I have some javascript and I was wondering if anyone could tell me a good way to optimize the code. I am checking the length of a string in the javascript and reducing the number of characters if it goes over a certain number. At the moment the visualforce page that the javascript is on will lag if the character count for the string goes over 2500 or so. This however only happens on Internet Explorer. Every other brower works fine. Is this a problem with the browser or is it a problem with my code. Thanks.

 

function textCounter(field, cntfield, fieldName) {

    var strSpcCounter = 0;
    for(var i = 0; i < document.getElementById(field).value.length; i++){
        var strChar = document.getElementById(field).value.substring(i, i + 1);
    
        if(strChar == '\n'){

            strSpcCounter ++;
        }
    }
    InterviewFormController.getLimit(fieldName, function(result, event){
    if ((document.getElementById(field).value.length + strSpcCounter)  > result) // if too long...trim it!
    document.getElementById(field).value = document.getElementById(field).value.substring(0, (result - strSpcCounter));
// otherwise, update 'characters left' counter
    else
    document.getElementById(cntfield).value = 'You have ' + (result - (document.getElementById(field).value.length + strSpcCounter)) + ' Characters Left';
    document.getElementById(cntfield).align = 'middle';
    }, {escape:true});
}

 

Hi All,

 

I have implemented the Select All checkbox functionality in a VF Page. This functionality works fine with all browsers EXCEPT IE9.

In IE9 the master checkbox, if clicked, doesnt select all the child check boxes.

The Strange thing is that, there is another page which i have built which is exactly same as this page, but the multiselect  functionality works fine for that page in IE9 also.

I am surprised with this strange behaviour of IE9 for different pages.

Any guidance in this perspective will be very much helpful for me.

 

Thanks in Advance.

 

Regards,

Kaushik

I am fairly new to Visualforce, and am trying to get to grips with the more complex sides, such as Custom controllers and extensions, etc. 

 

I have been looking at this problem for a while, and have found a few possible solutions, though none have worked.

 

The problem:

I am trying to create a list of invoices that can be generated for any particular Account. The list setup is fine, an I am happy with it. What I lack is a final total of the 'Gross Unpaid' column.

 

Possible solutions:

Following a lot of research, I found the following page:

Sum value that is within apex:repeat

 

Which suggested there were three ways to do this:

1. You can have a trigger on case on inset, delete, update event you can modify the sum of Cx_Case_Hours__c  in this trigger.
2. Also you can use java script code to find the repeat column values and add them through  loop which will display in the html variable
3. Or can use a separate function in your controller for the above calculation.

 

I have now tried all of these, with no joy.

 

No.1

This didn't work because Trigger wasn't being fired correctly

No. 2

I got an example from this page:

How to Count and Sum the Items and display it outside the apex:repeat

But it didn't work for me (not sure why, it just didn't bring back any values).

No.3

I tried pages like this one:

Can't figure out how to display a simple SUM function on my VF Page

But I'm not confident enough with Extensions to implement it, and the errors I got were a mystery to me!

 

Can anyone advise a good solution to do this.

 

My code is below - just to confirm, I want to finish the page with a sum of the Sales_Invoice__r.Gross__c field where Sales_Invoice__r.Status__c = 'Unpaid'.

 

Hope someone can help. Here's my page:

<apex:page renderAs="pdf" standardController="Account">

<apex:stylesheet value="{!URLFOR($Resource.A4Page, 'A4Page.css')}"/>

<apex:image id="CampdenLogo" value="https://emea.salesforce.com/servlet/servlet.ImageServer?id=01520000000liQP&oid=00D2000000075hl"
width="650" height="200"/><br></br>

<table cellpadding="0" cellspacing="0" align="right">
<tr><td>
<strong>Campden Media</strong><br/>
1 St John's Lane<br/>
London<br/>
EC1M 4PN<br/>
</td></tr>
</table>
<br/><br/><br/><br/><br/>

<table cellpadding="0" cellspacing="0">
<tr><td>
<strong>{!account.Name}</strong><br/>
</td></tr>
<tr><td>
{!account.BillingStreet}<br/>
</td></tr>
<tr><td>
{!account.BillingCity}<br/>
</td></tr>
<tr style="display: {!IF(account.BillingState == NULL, 'none', 'block')};"><td>
{!account.BillingState}<br/>
</td></tr>
<tr><td>
{!account.BillingPostalCode}<br/>
</td></tr>
<tr><td>
{!account.BillingCountry}<br/><br/>
</td></tr>
<tr><td>
<strong>Date:</strong> <apex:outputText value="{0,date, dd/MM/yyyy}"><apex:param value="{!NOW()}"/></apex:outputText><br/><br/>
</td></tr>
</table>
<br/>

<table cellpadding="0" cellspacing="0" align="center" style="font-weight:bold; text-align:center;">
<tr>
<td style="height:30px; width:120px;  border-left:1px solid black; border-bottom:1px solid black; border-top:1px solid black;">
Invoice Date
</td>
<td style="height:30px; width:100px;  border-left:1px solid black; border-bottom:1px solid black; border-top:1px solid black;">
Invoice No
</td>
<td style="height:30px; width:120px;  border-left:1px solid black; border-bottom:1px solid black; border-top:1px solid black;">
Gross
</td>
<td style="height:30px; width:120px;  border-left:1px solid black; border-bottom:1px solid black; border-top:1px solid black;">
Due Date
</td>
<td style="height:30px; width:100px;  border-left:1px solid black; border-bottom:1px solid black; border-top:1px solid black;">
Days Aged
</td>
<td style="height:30px; width:100px;  border:1px solid black;">
Status
</td>
</tr>
</table>

<apex:repeat var="cx" value="{!account.Sales_Invoices2__r}">
<table cellpadding="0" cellspacing="0" align="center" style="text-align:center;">
<tr style="display: {!IF(cx.Status__c == "Unpaid", 'block', 'none')};">

<td style="height:30px; width:120px;  border-left:1px solid black; border-bottom:1px solid black;">
<apex:outputText value="{0,date,dd/MM/yyyy}"><apex:param value="{!cx.Invoice_Date__c}"/></apex:outputText>
</td>

<td style="height:30px; width:100px;  border-left:1px solid black; border-bottom:1px solid black;">
{!cx.Name}
</td>

<td style="height:30px; width:120px;  border-left:1px solid black; border-bottom:1px solid black;">
<apex:outputText value="{0,number, £#,##0.00}"> <apex:param value="{!cx.Gross__c}"/></apex:outputText>
</td>

<td style="height:30px; width:120px;  border-left:1px solid black; border-bottom:1px solid black;">
{!DAY(cx.Due_Date_New__c)}/{!MONTH(cx.Due_Date_New__c)}/{!YEAR(cx.Due_Date_New__c)}
</td>

<td style="height:30px; width:100px;  border-left:1px solid black; border-bottom:1px solid black;">
{!cx.Days_Aged__c}
</td>

<td style="height:30px; width:100px;  border-left:1px solid black; border-bottom:1px solid black; border-right:1px solid black;">
{!cx.Status__c}
</td>

</tr>
</table>
</apex:repeat>
<br/><br/>

<p>
<strong>Total Gross Amount:</strong> <apex:outputText value="{0,number, £#,##0.00}"> <apex:param value="{!account.Gross_Unpaid__c}"/></apex:outputText>
</p>

</apex:page>

 Thanks in advance!

Can any one help me on this error?.. I am trying to get the Ip address of system through a custom link.. Here is my code. ANy help will be appreciated. Thanks

 

Controller:

public

withsharingclassIpaddress {

 

public string ipaddress{get;set;}

 

publicIpaddress(ApexPages.StandardController controller) {

 

//String Ipaddress= ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');

 

}

 

 

publicstring ipvalue(){

Ipaddress= ApexPages.currentPage().getHeaders().get(

'X-Salesforce-SIP');

 

//ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'your address '+Ipaddress));returnIpaddress;

 

 

}

 

}

 

Page:

<

apex:pagestandardcontroller="Account"extensions="Ipaddress"><!-- Begin Default Content REMOVE THIS -->

<

apex:form><apex:pageblockid="test"><apex:commandLink action="{!ipvalue}"rerender="test"> ipaddress </apex:commandLink></apex:pageblock></apex:form></apex:page>

Hello guys,

 

I'm facing with a weird problem,

I have a simple page to show a image using img tag, and i'm calling scaleImage javascript onload.

example:

<apex:page>
	<img id="imageId" src='http://freeimagesarchive.com/data/media/131/1_images.jpg' onload="javascript&colon;scaleImage(this,70,250);" /> 
</apex:page>

 but when i disable the header of the page using:

<apex:page showheader="false">
	<img id="imageId" src='http://freeimagesarchive.com/data/media/131/1_images.jpg' onload="javascript&colon;scaleImage(this,70,250);" /> 
</apex:page>

javascript&colon;scaleImage(this,70,250);

 Then its throwing error as : scaleImage is not defined

Please let me know if there's any workaround for this, i want to disable the page header and also use the ScaleImage function.

 

Thanks in advance!