• PFang
  • NEWBIE
  • 35 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 50
    Replies

Hi Guys,

 

I need help with integrating Salesforce to Xero, an accounting software. I'm not sure where to start but if someone has tried integration with Quickbooks or other software, I will be open to suggestions. Thank you!

 

Regards,

 

Pfang

  • October 16, 2013
  • Like
  • 0

Hi guys,

 

Great day!

 

I need something that would compute for a client's report due date. The computation should be start date + 1 month - 4 days.  Help on this would be appreciated!

 

DATE( YEAR(today()),


IF ( MONTH(Start_Date__c) = 1, 2,
IF ( MONTH(Start_Date__c) = 12, 1,
MONTH(Start_Date__c) + 1)),


IF ( DAY(Start_Date__c) = 4,

CASE( MONTH(Start_Date__c),
1, 28,
3, 30,
12, 31
,null),

IF ( DAY(Start_Date__c) = 3,

CASE( MONTH(Start_Date__c),
1, 27,
3, 29,
12, 30
,null),

IF ( DAY(Start_Date__c) = 2,

CASE( MONTH(Start_Date__c),
1, 26,
3, 28,
12, 29
,null),

IF ( DAY(Start_Date__c) = 1,

CASE( MONTH(Start_Date__c),
1, 25,
3, 27,
12, 28
,null)

,DAY(Start_Date__c) -4 ))))



)

 Regards,

 

Pfang

  • September 06, 2013
  • Like
  • 0

Hi Everyone,

 

Good day!

 

I would like to request for assistance in creating a test class for this VF controller extension.

 

The draft test class

@isTest
//This is a test case for a situation where a lead will be converted.  The developer must explicitly call the convert lead
//method to simulate the user action.

private class BillofLadingtest4Extensiontest {

public List<Bill_of_Lading__c> bol {get;set;}

    static testMethod void BillofLadingtest4Extension() {
    
    //test.startTest();
    
    Bill_of_Lading__c b = new Bill_of_Lading__c(Name ='testbilloflading');
    insert b;
    update b;
    
    Skid__c skd = new Skid__c(Name ='skid', Bill_of_Lading__c = b.Id, Dimension__c ='dimension 1', Number_of_Pieces__c =1, UOM__c ='uom 1', Weight__c =12);
    insert skd;

    ApexPages.StandardController con = new ApexPages.StandardController(b);
    BillofLadingtest4Extension bole = new BillofLadingtest4Extension(con);
    PageReference ref = bole.save();
    PageReference ref1 = bole.saveAndExit();
    PageReference ref2 = bole.deliverAsPDF();
    PageReference ref3 = null;
    
    BillofLadingtest4Extension billofl = new BillofLadingtest4Extension(con);
    
    PageReference result = billofl.save();
    
    PageReference ref9 = new PageReference('/apex/billofladingtest05222013?Id=' + b.Id);
    Test.setCurrentPage(ref9);

    PageReference pageRef = Page.Billofladingtest05222013;
    Test.setCurrentPage(pageRef);
    pageRef.setRedirect(true);
//test.stopTest();

}

}

 

These are the untested parts of the extension

 public boolean updateSkids()
    {
        boolean result=true;
        if (null!=skids)
           {
              // TODO: should work out what's changed and then save, easier to update everything for prototype
           List<Skid__c> updSkids=new List<Skid__c>();
              try
              {
               update skids;
              }
              catch (Exception e)
              {
                 String msg=e.getMessage();
                 integer pos;
                  
                 // if its field validation, this will be added to the messages by default
                 if (-1==(pos=msg.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION, ')))
                 {
                    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, msg));
                 }
                  
                 result=false;
              }
           }
            
           return result;
    }

 

 public void newSkid()
    {
       if (updateSkids())
       {
          Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id);
          insert skid;
         
          newSkidName=null;
          newSkidDimension=null;
          newSkidNumberofPieces=null;
          newskidbilloflading=null; 
          newskiduom=null;
          newskidweight=null;
          skids=null;
       }
    }

 

 public void deleteSkid()
    {
       if (updateSkids())
       {
          if (null!=chosenskidId)
          {
             Skid__c skid=new Skid__c(Id=chosenskidId);
              delete skid;
        
              skids=null;
              chosenskidId=null;
          }
       }
    }

 

 public List<Skid__c> getSkids()
    {
       if ( (null!=getBillofLading().id) && (skids == null) )
       {
           skids=[SELECT Id, Name, Bill_of_Lading__c,  
                        Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c
                        FROM Skid__c 
                        WHERE Id =: getBillofLading().id
                        ORDER BY CreatedDate];
       }                           
       return skids;
    }

 

public String getChooserender() {
     if (ApexPages.currentPage().getParameters().get('p') != null)
        return 'pdf';
        else
      return null;
  }

 

Can't say thanks enough, but again, thanks in advance.

 

Regards,

 

Pfang

 

  • July 22, 2013
  • Like
  • 0

Hi,

 

Good day!

 

I need assistance with the formatting of a summary row on a child record table used in a Visualforce form.

 

This is the CSS code for the table

#TableInfo{width: 1000px; margin: 70px 0; }
#TableInfo table{border: 1px solid #f78f1e;border-collapse: collapse;border-spacing: 0;}
#TableInfo table tr th{background: #f78f1e;padding: 5px;text-align: center;color: #fff;font-size: 14px;font-weight: bold;}
#TableInfo table tr td{border: 1px solid #e3e3e3;padding: 5px;text-align: center;color: #000;font-size: 12px;font-weight: bold; height:25px;}
#TableInfo .WidthNormal{width: 240px;}
#TableInfo .WidthSmall{width: 200px;}
#TableInfo .SuperBold{font-size: 17px !important;}
#TotalWeightId{text-align: right !important;padding: 0 !important;}
#TotalWeightId span{padding: 11px 15px; background: #f78f1e; color: #fff !important;}

 

This is what the table currently looks like

http://screencast.com/t/dJgoXQBoN

 

This is what the table should look like, the total weight should be moved a bit to the left but there's a complication with the apex facet and HTML/CSS code

http://screencast.com/t/UCdLhbmNG8

 

<apex:column width="240">
<apex:facet name="header">DIMENSIONS</apex:facet>
<apex:outputText value="{!boflading.Dimension__c}"/>
<apex:facet name="footer"><font id="TotalWeightId"><span>TOTAL WEIGHT</span></font></apex:facet></apex:column>
          
<apex:column width="240">
<apex:facet name="header">WEIGHT</apex:facet>
<apex:outputText value="{!boflading.Weight__c}"/>
<apex:facet name="footer"><apex:outputText style="font-size:17px;font-weight:bold!important;" value="{!Bill_of_Lading__c.Total_Weight__c}"/></apex:facet>       </apex:column>     
            
<apex:column width="240">
<apex:facet name="header">UOM</apex:facet>
<apex:outputText value="{!boflading.UOM__c}"/>
<apex:facet name="footer"><font style="font-size:17px;font-weight:bold!important;">L</font></apex:facet>     
</apex:column>  

Thanks in advance! 

 

Regards,

 

Phil Dennison C. Fang

Salesforce Developer

  • July 14, 2013
  • Like
  • 0

Hi everyone,

 

Great day!

 

I need help with formatting a table in a visualforce form that's showing a table of related child records. It is comparable to the opportunity product table wherein products with prices are listed with a total. I will be posting screenshot links and I'm hoping you can help me with this. 

 

Table:

http://screencast.com/t/Z5A4a3gEvS0

 

 #TableInfo{width: 1000px; margin: 70px 0; }
        #TableInfo table{border: 1px solid #f78f1e;border-collapse: collapse;border-spacing: 0;}
        #TableInfo table tr th{background: #f78f1e;padding: 5px;text-align: center;color: #fff;font-size: 14px;font-weight: bold;}
        #TableInfo table tr td{border: 1px solid #e3e3e3;padding: 5px;text-align: center;color: #000;font-size: 12px;font-weight: bold; height:25px;}
        #TableInfo .WidthNormal{width: 240px;}
        #TableInfo .WidthSmall{width: 200px;}
        #TableInfo .SuperBold{font-size: 17px !important;}
        #TotalWeightId{text-align: right !important;padding: 0 !important;}
        #TotalWeightId span{padding: 10px 10px;background: #f78f1e;color: #fff !important;}

 

<div id="TableInfo">            
            <apex:dataTable value="{!Bill_of_Lading__c.Skids__r}" var="boflading" id="theTable" rowClasses="odd,even" styleClass="tableClass" border="0">                                                                                      
                                                                                                           
            <apex:column width="240">                               
            <apex:facet name="header">NO OF PCS</apex:facet>
            <apex:outputText value="{!boflading.Number_of_Pieces__c}"/>                                                                              
            </apex:column>

            <apex:column width="240">
            <apex:facet name="header">DESCRIPTION</apex:facet>
            <apex:outputText value="{!boflading.Name}"/>
            </apex:column>
            
            <apex:column width="240">
            <apex:facet name="header">DIMENSIONS</apex:facet>
            <apex:outputText value="{!boflading.Dimension__c}"/>
            </apex:column> 
            
            <apex:column width="240">
            <apex:facet name="header">WEIGHT</apex:facet>
            <apex:outputText value="{!boflading.Weight__c}"/>
            </apex:column>
            
            <apex:column width="240">
            <apex:facet name="header">UOM</apex:facet>
            <apex:outputText value="{!boflading.UOM__c}"/>      
            </apex:column>  

            <apex:column width="240">
            <tfoot>     
            <td colspan="3" id="TotalWeightId"><span>TOTAL WEIGHT</span></td>
            <td class="SuperBold" contenteditable="true"><apex:outputText value="{!Bill_of_Lading__c.Total_Weight__c}"/></td>
            <td class="SuperBold" contenteditable="true">L</td>   
            </tfoot>
            </apex:column>  

            </apex:dataTable>        
            </div>         

 

  public void newSkid()
    {
       if (updateSkids())
       {
          Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id);
          insert skid;
         
          newSkidName=null;
          newSkidDimension=null;
          newSkidNumberofPieces=null;
          newskidbilloflading=null; 
          newskiduom=null;
          newskidweight=null;
          skids=null;
       }
    }

 The table is supposed to look like this

 

http://screencast.com/t/6Aw1TMb9ng

 

Help on this would be appreciated!

 

Regards,

 

Pfang

  • July 08, 2013
  • Like
  • 0

Hi,

 

Would like to get insights on working around this error, "Error: You cannot reassign a recurring task occurrence.". Thanks!

 

Regards,

 

Pfang

  • June 21, 2013
  • Like
  • 0

Hi guys,

 

Great day!

 

As requested, I would just like to share my experience so that this might help our fellow forumers in the future. 

 

My main problem was my first forums account was associated to a Salesforce org that suddenly got expired so I wasn't able to log back with it. This was as an issue and might cause subsequent issues for those maintaining certain things for their accounts, post count, etc. Since logging in with the first account was a problem, I had to create another developer board account. I tried reaching out to people, SF support and with the aid of guys like bob_buzzard, I was pointed to the right direction. After numerous exchanges, I was referred to thisisnotapril (http://boards.developerforce.com/t5/user/viewprofilepage/user-id/89257), an admin for our boards. I didn't know that someone had such privileges at the time but there she was. She was very accommodating when I forwarded my issue and thanks to her, I have my boards account back. 

 

So for forums account problems, don't contact SF support as it's beyond their scope, messaging a forums admin should be more of an immediate remedy. 

 

Regards,

 

Pfang

  • June 19, 2013
  • Like
  • 0

Hi guys,

 

Great day!

 

As requested, I would just like to share my experience so that this might help our fellow forumers in the future. 

 

My main problem was my first forums account was associated to a Salesforce org that suddenly got expired so I wasn't able to log back with it. This was as an issue and might cause subsequent issues for those maintaining certain things for their accounts, post count, etc. Since logging in with the first account was a problem, I had to create another developer board account. I tried reaching out to people, SF support and with the aid of guys like bob_buzzard, I was pointed to the right direction. After numerous exchanges, I was referred to thisisnotapril (http://boards.developerforce.com/t5/user/viewprofilepage/user-id/89257), an admin for our boards. I didn't know that someone had such privileges at the time but there she was. She was very accommodating when I forwarded my issue and thanks to her, I have my boards account back. 

 

So for forums account problems, don't contact SF support as it's beyond their scope, messaging a forums admin should be more of an immediate remedy. 

 

Regards,

 

Pfang

  • June 19, 2013
  • Like
  • 0

Hi Guys,

I'm hoping that this reaches our board admin team. My current developer.force.com account is tied up with phildennison.fang@training11.com. Unfortunately, that org has expired and I can't login to our developer board using other devices as I'm just lucky enough to have this session cached by a browser in another computer, which is why I'm able to post this. I need to have my developer force account transferred to maximumedge@gmail.com. How is this done and any help on this would be appreciated!

Note: I apologize if I'm on the wrong board.

  • April 15, 2013
  • Like
  • 0

Hi Guys,

 

I'm hoping that this reaches our board admin team. My current developer.force.com account is tied up with phildennison.fang@training11.com. Unfortunately, that org has expired and I can't login to our developer board using other devices as I'm just lucky enough to have this session cached by a browser in another computer, which is why I'm able to post this. I need to have my developer force account transferred to maximumedge@gmail.com. How is this done and any help on this would be appreciated!

  • April 15, 2013
  • Like
  • 0

Hi Guys,

 

Good day!

 

I was able to get our web form loaded into the following Sites domain but still having issues with saving data into a related list table.

 

Site domain:

http://vitallogistics.vl.cs9.force.com/billoflading

 

Apex class extension:

public class BillofLadingtest1Extension {
 
    private ApexPages.StandardController std;
     
    // the associated contacts
    public List<Skid__c> skids;
      
    // the chosen contact id - used when deleting a contact
    public Id chosenskidId {get; set;}
     
    public String newSkidName {get; set;}
    public String newSkidDimension {get; set;}
    public Decimal newSkidNumberofPieces {get; set;} 
     
    public BillofLadingtest1Extension()
    {
    }
     
    public BillofLadingtest1Extension(ApexPages.StandardController stdCtrl)
    {
     std=stdCtrl;
    }
     
    public Bill_of_Lading__c getBillofLading()
    {
     return (Bill_of_Lading__c) std.getRecord();
    }
 
 public SObject getSobject()
 {
  return std.getRecord();
 }
      
    private boolean updateSkids()
    {
        boolean result=true;
        if (null!=skids)
           {
              // TODO: should work out what's changed and then save, easier to update everything for prototype
           List<Skid__c> updSkids=new List<Skid__c>();
              try
              {
               update skids;
              }
              catch (Exception e)
              {
                 String msg=e.getMessage();
                 integer pos;
                  
                 // if its field validation, this will be added to the messages by default
                 if (-1==(pos=msg.indexOf('FIELD_CUSTOM_VALIDATION_EXCEPTION, ')))
                 {
                    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, msg));
                 }
                  
                 result=false;
              }
           }
            
           return result;
    }
     
    public PageReference saveAndExit()
    {
     boolean result=true;
    result=updateSkids();
      
     if (result)
     {
        // call standard controller save
        return std.save();
     }
     else
     {
      return null;
     }
    }
     
    public PageReference save()
    {
     Boolean result=true;
     PageReference pr=Page.BillofLadingtest;
     if (null!=getBillofLading().id)
     {
      result=updateSkids();
     }
     else
     {
      pr.setRedirect(true);
     }
      
     if (result)
     {
        // call standard controller save, but don't capture the return value which will redirect to view page
        std.save();
           ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Changes saved'));
     }
        pr.getParameters().put('id', getBillofLading().id);
      
     return pr;
    }
 
    public void newSkid()
    {
       if (updateSkids())
       {
          Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, Bill_of_Lading__c=getBillofLading().id);
          insert skid;
         
          newSkidName=null;
          newSkidDimension=null;
          newSkidNumberofPieces=null;
          skids=null;
       }
    }
     
    public void deleteSkid()
    {
       if (updateSkids())
       {
          if (null!=chosenskidId)
          {
             Skid__c skid=new Skid__c(Id=chosenskidId);
              delete skid;
        
              skids=null;
              chosenskidId=null;
          }
       }
    }
     
   public List<Skid__c> getSkids()
    {
       if ( (null!=getBillofLading().id) && (skids == null) )
       {
           skids=[SELECT Id, Name, Bill_of_Lading__c,  
                        Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c
                        FROM Skid__c 
                        WHERE Id =: getBillofLading().id
                        ORDER BY CreatedDate];
       }                           
       return skids;
    }
}

 

Reference VF page code:

 <apex:outputPanel id="contactList"> 
                <apex:repeat value="{!contacts}" var="contact" >
                    <apex:pageBlockSection columns="1"  title="Contact {!contact.Name}" collapsible="true">
                        <apex:pageBlockSectionItem >
                              <apex:pageBlockSection columns="2">
                    <apex:inputField value="{!Contact.FirstName}" styleClass="form_field"/> 
                    <apex:inputField value="{!Contact.LastName}" styleClass="form_field"/> 
                    <apex:inputField value="{!Contact.HomePhone}" styleClass="form_field"/>                   
                              </apex:pageBlockSection>
                           </apex:pageBlockSectionItem>
                        </apex:pageBlockSection>
                       <div style="text-align:center">
                           <apex:commandButton value="Delete This Contact" onclick="idToDelete='{!contact.id}'; showpopup('deletecontent'); return false;"/>
                       </div>
                </apex:repeat>
            </apex:outputPanel>

 

Replicated using this, which is giving an error when an input field is entered under the skid object:

<apex:outputPanel id="skidList"> 
                <apex:repeat value="{!skids}" var="skid" >
                    <apex:pageBlockSection columns="1"  title="Skid {!skid.Name}" collapsible="true">
                        <apex:pageBlockSectionItem >
                              <apex:pageBlockSection columns="2">
                                         
                              </apex:pageBlockSection>
                           </apex:pageBlockSectionItem>
                        </apex:pageBlockSection>
                       <div style="text-align:center">
                           <apex:commandButton value="Delete This Skid" onclick="idToDelete='{!skid.id}'; showpopup('deletecontent'); return false;"/>
                       </div>
                </apex:repeat>
            </apex:outputPanel>  

 

Unable to save into something like this (Account with contact records in the same visualforce page):

 

http://screencast.com/t/6mstiuF5mmYJ

 

Any help would be appreciated.

 

Regards,

 

Phil Dennison C. Fang

Salesforce Developer

 

  • April 04, 2013
  • Like
  • 0

Hi Guys,

 

Hope we're all doing good!

 

I'm in the process of creating a Visualforce page with related child records arranged in a table but I'm not able to edit any of their fields or create new records. The parent object is called Bill of Lading while the child object is called Skids, it's like your opportunity to opportunity product/line item relationship wherein the Bill of Lading has child skid records. I will be posting both screenshot links of the page along with code snippets that may aid in my query on creating, editing child records on a Visualforce page, many thanks!
 

Screenshot - top section with parent object:

http://screencast.com/t/tTnX7DWGu

 

Screenshot - child record table:

http://screencast.com/t/ghfr1m9Ga

 

Non-working Visualforce code:

 

<apex:pageBlock >
<apex:pageblockTable title="Bill_of_Lading__c" value="{!Bill_of_Lading__c.Skids__r}" var="BOL">
<apex:dataTable value="{!Bill_of_Lading__c.Skids__r}"
                      var="BL"
                      cellPadding="4" border="1">    
       <apex:column headervalue="{!BOL.Dimension__c}">
       {!BOL.Dimension__c}
       </apex:column>
       <apex:column value="{!BL.Number_of_Pieces__c}">
       </apex:column>
       <apex:column >
            {!BL.UOM__c}
         </apex:column>
       </apex:dataTable>
 </apex:pageblockTable>
</apex:pageBlock>

</apex:form>

<apex:detail relatedList="false"/>
  <apex:relatedList list="Skid__c"/>

</apex:page>

 Draft extension:

    public List<Skid__c> getSkids()
    {
       if ( (null!=getBillofLading().id) && (skids == null) )
       {
           skids=[SELECT Id, Name, Bill_of_Lading__c, Dimension__c, Number_of_Pieces__c, UOM__c, Weight__c
                         FROM Skid__c
                         WHERE Id =: getBillofLading().id
                         ORDER BY CreatedDate];
       }                           
       return skids;
    }

 

 

  • March 18, 2013
  • Like
  • 0

I've begun setting up an application that would sync data between eWay, an online payment site with Salesforce and currently stuck with uncertainties on how to proceed. I'm done with testing the API's in SOAP only to be surprised with the superiority of Java and PHP. It was with this awareness that I shifted to using those languages instead but I'm not sure how to start over. I have the WSDL site, sample Java API's, and a draft application on Eclipse IDE that's not automated yet with Force.com WSC. Our requirement is for an application that would automatically sync or query data from eWay to Salesforce like transfer customer payment information to our org. I'm an integration noob, currently without direction, detailed help on this would be much appreciated!

  • January 29, 2013
  • Like
  • 0

Hi Guys,

 

I would just like to verify if it is possible to replicate pdf forms using Visualforce, like the one below:

 

 

Thanks in advance!

  • January 11, 2013
  • Like
  • 0

Hi,

 

Need help with getting the test class to 100% as I'm having trouble with a couple of lines which may help with future testing.

 

1.) Trigger on Opportunity

 

trigger SetAgent on Opportunity (before insert, before update) { 
List<String> accountIds = new List<String>();
List<Account> parentAccounts = new List<Account>();
for(Opportunity oppty : Trigger.new)
{
accountIds.add(oppty.AccountId);
}
 parentAccounts = [Select Id, Agent__c from Account where Id in :accountIds];
    Map<String,Account> accountMap = new Map<String,Account>();
     for(Account a : parentAccounts)
    {
        accountMap.put(a.Id,a);
    }
   for(Opportunity oppty : Trigger.new)
    {
        Account parentAccount = accountMap.get(oppty.AccountId);
        if(parentAccount != null)
        {
            oppty.Agent__c = parentAccount.Agent__c;
        }
    }
}

 2.) Apex Test Class 

 

@isTest
private class SetAgentTest {
    static testMethod void SetAgent() {
        Account a = new Account(Id = '001K000000KnlcE', Agent__c = 'a03K0000001A7v2');        
        Opportunity o = new Opportunity(Name = 'TestOpportunity', StageName = 'Prospecting', CloseDate = system.Today(), Agent__c = a.Agent__c);
        insert o;
        System.assertEquals(a.Agent__c, o.Agent__c);
    }
}

 3.) The 83% result tells me that these two lines from the code above were not tested, a brief explanation of why would be much appreciated.

 

accountMap.put(a.Id,a);

 

oppty.Agent__c = parentAccount.Agent__c;

 Thanks again!

  • October 26, 2012
  • Like
  • 0

Hi Everyone,

 

Great day!

 

I have this issue with using URL parameters to update field values on our web form as unfortunately the variations of codes I was able to research on didn't get that functionality to work. What we're basically trying to do here is use a URL parameter to prepopulate the account field on the VF page. So far, this is what I was able to formulate:

 

public with sharing class myQuestionnaireExtensionII {
    private final Questionnaires__c webquestionnaire;
    public myQuestionnaireExtensionII(ApexPages.StandardController
    stdController) {
        webquestionnaire = (Questionnaires__c) stdController.getRecord();
    }
    // it creates an empty record for the variable. 
    public Questionnaires__c getQuestionnaire() {
        if (webquestionnaire == null) Questionnaires__c webquestionnaire = new Questionnaires__c();
        webquestionnaire.Account__c = ApexPages.currentPage().getParameters().get('accname');
        return webquestionnaire;
    }
    public PageReference saveQuestionnaire() {
        String accname = ApexPages.currentPage().getParameters().get('Account__c');
        String acname = ApexPages.currentPage().getParameters().get('Questionnaires__c.Account__c');
        if (accname == null) {
            // Display the Visualforce page's content if no Account Name is passed over
            return null;
        }
        if (acname == null) {
            // Display the Visualforce page's content if no Account Name is passed over
            return null;
        }
        try {
            insert(webquestionnaire);
            return null;
        } catch (System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }
        PageReference p = Page.ThankYou;
        p.setRedirect(true);
        return p;
    }
}

 Here's the URL for our web form:

 

http://apex/samplequestionnairebrendandevtest

 

Here are some of the things I've tried with the class I'm working on:

 

1.) The getmethod()

 

 // it creates an empty record for the variable. 
    public Questionnaires__c getQuestionnaire() {
        if (webquestionnaire == null) Questionnaires__c webquestionnaire = new Questionnaires__c();
        webquestionnaire.Account__c = ApexPages.currentPage().getParameters().get('accname');
        return webquestionnaire;

 

which was based from this code I picked up from our boards:

 

public Opportunity getOpportunity() {
      if(opportunity == null) opportunity = new Opportunity();
      opportunity.recordtypeid = ApexPages.currentPage().getParameters().get('RecordType');
      opportunity.AccountID = ApexPages.currentPage().getParameters().get('accid');
      opportunity.Name = ApexPages.currentPage().getParameters().get('oppName');
      opportunity.StageName = ApexPages.currentPage().getParameters().get('Stage');
      return opportunity;
   }

 

2.) Other references lead me to doing this:

this.questionnaire = (Questionnaires__c)stdcontroller.getRecord();
        string actname = System.currentPageReference().getParameters().get('accname');

 

3.) Assigned page parameters to strings:

public PageReference saveQuestionnaire() {
        String accname = ApexPages.currentPage().getParameters().get('Account__c');
        String acname = ApexPages.currentPage().getParameters().get('Questionnaires__c.Account__c');
        if (accname == null) {
            // Display the Visualforce page's content if no Account Name is passed over
            return null;
        }
        if (acname == null) {
            // Display the Visualforce page's content if no Account Name is passed over
            return null;

 

4.) I even went as far as putting all these lines into the class:

 

public with sharing class myQuestionnaireExtensionII {
        Questionnaires__c questionnaire = new Questionnaires__c();          
        private final Questionnaires__c webquestionnaire;
        public myQuestionnaireExtensionII(ApexPages.StandardController
        stdController) {        
        string accountname = System.currentPageReference().getParameters().get('accname');                               
        webquestionnaire = (Questionnaires__c)stdController.getRecord();
        String aname = ApexPages.currentPage().getParameters().get('aname');
        String acname = ApexPages.currentPage().getParameters().get('Questionnaires__c.Account__c'); 
        String accname = System.currentPageReference().getParameters().get('Questionnaires__c.Account__c');                        
        }                     

    // it creates an empty record for the variable. 

 

 

5.) I've also tried these lines for our VF page:

<c:SetValue from="{!$CurrentPage.parameters.Account__c}" to="{!Questionnaires__c.Account__c}"/>
<apex:component >
    <apex:attribute name="from" type="String" description="The account name to be set"/>
    <apex:attribute name="to" type="String" description="The variable for setting the account info into"/>
</apex:component>

 

Note: I was hoping that through query strings in our URL, we'd be able to update our web form as shown here - http://http://apex/samplequestionnairebrendandevtest?accname=test (prefill account name field with 'test' value), which doesn't seem to be doing anything. 

 

Burned 48 hours for this and it still feels like nowhere, so any assistance would be superlatively appreciated!

  • August 07, 2012
  • Like
  • 0

Hi,

 

I just want to share this HTML signature that I got working for the standard Email settings signature that's on Salesforce. There is no need to rely on email templates as this code should allow for html images and formatting through this path: Name | Setup - Personal Setup | Email | My Email Settings 

 

<font face="verdana" size="3">Kind Regards,<br>
Name
Job Title
</font>
<table border=0><tr><td><img src="https://c.ap1.content.force.com/servlet/servlet.ImageServer?id=01590000000GzYX&oid=00D90000000e7Tg" width="119" height="113"></td><td><img src="https://c.ap1.content.force.com/servlet/servlet.ImageServer?id=01590000000GzaO&oid=00D90000000e7Tg" width="9" height="113"></td><td><font size="1" face="arial" color="#0099FF">Phone:</font><br><font size="1" face="arial" color="#999999">XXXX XXX XXX</font><br><font size="1" face="arial" color="#0099FF">Fax:</font><br><font size="1" face="arial" color="#999999">(XX) XXXX XXXX</font><br><font size="1" face="arial" color="#0099FF">Address:</font><br><font size="1" face="arial" color="#999999">XXXXXXXXXXXXXXXXX</font><br><font size="1" face="arial" color="#0099FF">Email:<a href="mailto:brendan@quantumlinx.com">XXXXXXXXXXX</a><br>Website:<a href="http://www.quantumlinx.com.au">www.quantumlinx.com.au</a></font></td><td>
<img src="https://c.ap1.content.force.com/servlet/servlet.ImageServer?id=01590000000GzZz&oid=00D90000000e7Tg&lastMod=1338793500000"></td></tr></table>

 

Note: The images referenced here were all uploaded into Documents but based on what I've read you can also use external images. 

 

Drop a message if you have questions.

  • July 12, 2012
  • Like
  • 0

Hi guys,

 

I need help with this Apex Class as I'm having difficulties creating a test method for it.

 

public with sharing class myQuestionnaireExtension {
private final Questionnaires__c webquestionnaire;
public myQuestionnaireExtension(ApexPages.StandardController
stdController) {
webquestionnaire = (Questionnaires__c)stdController.getRecord();
}
public PageReference saveQuestionnaire() {
try {
insert(webquestionnaire);
}
catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
PageReference p = Page.ThankYou;
p.setRedirect(true);
return p;
}
}

 

Here's what I've started with:

 

@isTest
private class myQuestionnaireExtensionTest {
    static testMethod void myQuestionnaireExtension() {
        // Set up the Account record.
        Questionnaires__c q = new Questionnaires__c(Name = 'TestQuestionnaire');
        insert q;
        
        }
}

 

Any help on this would be appreciated and be rewarded by a thousand likes! 

 

  • July 06, 2012
  • Like
  • 0

Hi guys!

 

I checked out a certain JAVA fix and noticed that it may just be the solution to this brickwall I ran into. I have the following custom button OnClick Javascript code on a sample object that should imprint both Date and Time values on a DateTime field. I did use the new Date() syntax but it only works for Date fields and not DateTime. I was wondering, how this post would fit into what I've formulated. Thanks in advance!

 

Mine:

 

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
var v=new sforce.SObject("Opportunity"); 
v.JavaDateButtonTest__c="{!Opportunity.JavaDateButtonTest__c}"; 
v.id = "{!Opportunity.Id}"; 
if((v.JavaDateButtonTest__c=='')) 

var date = new Date('{!TODAY()}'); 
v.JavaDateButtonTest__c=date; 
result=sforce.connection.update([v]); 
}

 

-----------------------------------------------------------

 

Fix:

 

function fixTime(time){
   if(time < 10) {time = "0" + time};
   return time;
}
function fixDate(date){
  var Month = fixTime(date.getMonth() + 1);
  var Day = fixTime(date.getDate());
  var UTC = date.toUTCString();
  var Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6);

  var Minutes = fixTime(date.getMinutes());
  var Seconds = fixTime(date.getSeconds());
  return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time; 
}

 -----------------------------

 

I also got this from another site and I'm not sure if this is usable for what I cited above:

 

http://www.ladysign-apps.com/blog/code/salesforce/salesforce-datetime-functions/comment-page-1/#comm...

 

/**
* Set Javascript Date Time to Salesforce Date Time;
* @param dateTimeObj - date time string
* @return salesforce date time object
**/
function setStringToDateTime(dateTimeObj){
    var dateTimeObj;
 
    if (dateTimeObj != null) {
        dateTimeObj = sforce.internal.stringToDateTime(dateTimeObj);
    }
 
    return dateTimeObj;
}
  • June 13, 2012
  • Like
  • 0

Hi guys!

 

I checked out a certain JAVA fix and noticed that it may just be the solution to this brickwall I ran into. I have the following custom button OnClick Javascript code on a sample object that should imprint both Date and Time values on a DateTime field. I did use the new Date() syntax but it only works for Date fields and not DateTime. I was wondering, how this post would fit into what I've formulated. Thanks in advance!

 

Mine:

 

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
var v=new sforce.SObject("Opportunity"); 
v.JavaDateButtonTest__c="{!Opportunity.JavaDateButtonTest__c}"; 
v.id = "{!Opportunity.Id}"; 
if((v.JavaDateButtonTest__c=='')) 

var date = new Date('{!TODAY()}'); 
v.JavaDateButtonTest__c=date; 
result=sforce.connection.update([v]); 
}

 

-----------------------------------------------------------

 

Fix:

 

function fixTime(time){
   if(time < 10) {time = "0" + time};
   return time;
}
function fixDate(date){
  var Month = fixTime(date.getMonth() + 1);
  var Day = fixTime(date.getDate());
  var UTC = date.toUTCString();
  var Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6);

  var Minutes = fixTime(date.getMinutes());
  var Seconds = fixTime(date.getSeconds());
  return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time; 
}

 -----------------------------

 

I also got this from another site and I'm not sure if this is usable for what I cited above:

 

http://www.ladysign-apps.com/blog/code/salesforce/salesforce-datetime-functions/comment-page-1/#comm...

 

/**
* Set Javascript Date Time to Salesforce Date Time;
* @param dateTimeObj - date time string
* @return salesforce date time object
**/
function setStringToDateTime(dateTimeObj){
    var dateTimeObj;
 
    if (dateTimeObj != null) {
        dateTimeObj = sforce.internal.stringToDateTime(dateTimeObj);
    }
 
    return dateTimeObj;
}
  • June 13, 2012
  • Like
  • 0

Hi Guys,

 

I need help with integrating Salesforce to Xero, an accounting software. I'm not sure where to start but if someone has tried integration with Quickbooks or other software, I will be open to suggestions. Thank you!

 

Regards,

 

Pfang

  • October 16, 2013
  • Like
  • 0

Hi,

 

Good day!

 

I need assistance with the formatting of a summary row on a child record table used in a Visualforce form.

 

This is the CSS code for the table

#TableInfo{width: 1000px; margin: 70px 0; }
#TableInfo table{border: 1px solid #f78f1e;border-collapse: collapse;border-spacing: 0;}
#TableInfo table tr th{background: #f78f1e;padding: 5px;text-align: center;color: #fff;font-size: 14px;font-weight: bold;}
#TableInfo table tr td{border: 1px solid #e3e3e3;padding: 5px;text-align: center;color: #000;font-size: 12px;font-weight: bold; height:25px;}
#TableInfo .WidthNormal{width: 240px;}
#TableInfo .WidthSmall{width: 200px;}
#TableInfo .SuperBold{font-size: 17px !important;}
#TotalWeightId{text-align: right !important;padding: 0 !important;}
#TotalWeightId span{padding: 11px 15px; background: #f78f1e; color: #fff !important;}

 

This is what the table currently looks like

http://screencast.com/t/dJgoXQBoN

 

This is what the table should look like, the total weight should be moved a bit to the left but there's a complication with the apex facet and HTML/CSS code

http://screencast.com/t/UCdLhbmNG8

 

<apex:column width="240">
<apex:facet name="header">DIMENSIONS</apex:facet>
<apex:outputText value="{!boflading.Dimension__c}"/>
<apex:facet name="footer"><font id="TotalWeightId"><span>TOTAL WEIGHT</span></font></apex:facet></apex:column>
          
<apex:column width="240">
<apex:facet name="header">WEIGHT</apex:facet>
<apex:outputText value="{!boflading.Weight__c}"/>
<apex:facet name="footer"><apex:outputText style="font-size:17px;font-weight:bold!important;" value="{!Bill_of_Lading__c.Total_Weight__c}"/></apex:facet>       </apex:column>     
            
<apex:column width="240">
<apex:facet name="header">UOM</apex:facet>
<apex:outputText value="{!boflading.UOM__c}"/>
<apex:facet name="footer"><font style="font-size:17px;font-weight:bold!important;">L</font></apex:facet>     
</apex:column>  

Thanks in advance! 

 

Regards,

 

Phil Dennison C. Fang

Salesforce Developer

  • July 14, 2013
  • Like
  • 0

Hi everyone,

 

Great day!

 

I need help with formatting a table in a visualforce form that's showing a table of related child records. It is comparable to the opportunity product table wherein products with prices are listed with a total. I will be posting screenshot links and I'm hoping you can help me with this. 

 

Table:

http://screencast.com/t/Z5A4a3gEvS0

 

 #TableInfo{width: 1000px; margin: 70px 0; }
        #TableInfo table{border: 1px solid #f78f1e;border-collapse: collapse;border-spacing: 0;}
        #TableInfo table tr th{background: #f78f1e;padding: 5px;text-align: center;color: #fff;font-size: 14px;font-weight: bold;}
        #TableInfo table tr td{border: 1px solid #e3e3e3;padding: 5px;text-align: center;color: #000;font-size: 12px;font-weight: bold; height:25px;}
        #TableInfo .WidthNormal{width: 240px;}
        #TableInfo .WidthSmall{width: 200px;}
        #TableInfo .SuperBold{font-size: 17px !important;}
        #TotalWeightId{text-align: right !important;padding: 0 !important;}
        #TotalWeightId span{padding: 10px 10px;background: #f78f1e;color: #fff !important;}

 

<div id="TableInfo">            
            <apex:dataTable value="{!Bill_of_Lading__c.Skids__r}" var="boflading" id="theTable" rowClasses="odd,even" styleClass="tableClass" border="0">                                                                                      
                                                                                                           
            <apex:column width="240">                               
            <apex:facet name="header">NO OF PCS</apex:facet>
            <apex:outputText value="{!boflading.Number_of_Pieces__c}"/>                                                                              
            </apex:column>

            <apex:column width="240">
            <apex:facet name="header">DESCRIPTION</apex:facet>
            <apex:outputText value="{!boflading.Name}"/>
            </apex:column>
            
            <apex:column width="240">
            <apex:facet name="header">DIMENSIONS</apex:facet>
            <apex:outputText value="{!boflading.Dimension__c}"/>
            </apex:column> 
            
            <apex:column width="240">
            <apex:facet name="header">WEIGHT</apex:facet>
            <apex:outputText value="{!boflading.Weight__c}"/>
            </apex:column>
            
            <apex:column width="240">
            <apex:facet name="header">UOM</apex:facet>
            <apex:outputText value="{!boflading.UOM__c}"/>      
            </apex:column>  

            <apex:column width="240">
            <tfoot>     
            <td colspan="3" id="TotalWeightId"><span>TOTAL WEIGHT</span></td>
            <td class="SuperBold" contenteditable="true"><apex:outputText value="{!Bill_of_Lading__c.Total_Weight__c}"/></td>
            <td class="SuperBold" contenteditable="true">L</td>   
            </tfoot>
            </apex:column>  

            </apex:dataTable>        
            </div>         

 

  public void newSkid()
    {
       if (updateSkids())
       {
          Skid__c skid=new Skid__c(Name=newSkidName, Dimension__c=newSkidDimension, Number_of_Pieces__c=newSkidNumberofPieces, UOM__c=newskiduom, Weight__c=newskidweight, Bill_of_Lading__c=getBillofLading().id);
          insert skid;
         
          newSkidName=null;
          newSkidDimension=null;
          newSkidNumberofPieces=null;
          newskidbilloflading=null; 
          newskiduom=null;
          newskidweight=null;
          skids=null;
       }
    }

 The table is supposed to look like this

 

http://screencast.com/t/6Aw1TMb9ng

 

Help on this would be appreciated!

 

Regards,

 

Pfang

  • July 08, 2013
  • Like
  • 0

Hi,

 

Would like to get insights on working around this error, "Error: You cannot reassign a recurring task occurrence.". Thanks!

 

Regards,

 

Pfang

  • June 21, 2013
  • Like
  • 0

Hi guys,

 

Great day!

 

As requested, I would just like to share my experience so that this might help our fellow forumers in the future. 

 

My main problem was my first forums account was associated to a Salesforce org that suddenly got expired so I wasn't able to log back with it. This was as an issue and might cause subsequent issues for those maintaining certain things for their accounts, post count, etc. Since logging in with the first account was a problem, I had to create another developer board account. I tried reaching out to people, SF support and with the aid of guys like bob_buzzard, I was pointed to the right direction. After numerous exchanges, I was referred to thisisnotapril (http://boards.developerforce.com/t5/user/viewprofilepage/user-id/89257), an admin for our boards. I didn't know that someone had such privileges at the time but there she was. She was very accommodating when I forwarded my issue and thanks to her, I have my boards account back. 

 

So for forums account problems, don't contact SF support as it's beyond their scope, messaging a forums admin should be more of an immediate remedy. 

 

Regards,

 

Pfang

  • June 19, 2013
  • Like
  • 0

Hi Guys,

I'm hoping that this reaches our board admin team. My current developer.force.com account is tied up with phildennison.fang@training11.com. Unfortunately, that org has expired and I can't login to our developer board using other devices as I'm just lucky enough to have this session cached by a browser in another computer, which is why I'm able to post this. I need to have my developer force account transferred to maximumedge@gmail.com. How is this done and any help on this would be appreciated!

Note: I apologize if I'm on the wrong board.

  • April 15, 2013
  • Like
  • 0

Hi Guys,

 

I'm hoping that this reaches our board admin team. My current developer.force.com account is tied up with phildennison.fang@training11.com. Unfortunately, that org has expired and I can't login to our developer board using other devices as I'm just lucky enough to have this session cached by a browser in another computer, which is why I'm able to post this. I need to have my developer force account transferred to maximumedge@gmail.com. How is this done and any help on this would be appreciated!

  • April 15, 2013
  • Like
  • 0