• Feng
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 8
    Replies
we just enabled person account on the contact object, but there are lots of existing contacts do not have any 1 to 1 person account on account object,
 
Is there any way to create person accounts for these existing contact without deleting these contacts, as these contacts were referenced by different objects;
 
here is my code trying to do: the record type in account is updated successful, but is IsPersonAccount is field in Account is still set to false
 
Code:
//get the business account record type
RecordType NotPersonAccountRecordType = [select Id, Name, SobjectType,
         IsPersonType from RecordType where SobjectType='Account'
         and IsPersonType=False];

// get 1 existing account
Contact c = [select id, AccountId, FirstName, LastName, Cris_Id__c from Contact where IsPersonAccount = false Limit 1];


// create a new account and set the record type to business account
Account newAccount = new Account();
newAccount.Name='' + c.LastName;
newAccount.RecordTypeId = NotPersonAccountRecordType.Id;
insert newAccount;


//get the person account record type
recordType personaccountrecordtype = [select Id, Name, SobjectType,
         IsPersonType from RecordType where SobjectType='Account'
         and IsPersonType=True];

// update the existing contact's account to new account
c.AccountId = newAccount.Id;
update c;


// now get it again and update the firstname and lastname, change the record type to person account
newAccount = [select id,lastName, Firstname, RecordTypeId from Account where Id =: newAccount.Id];
newAccount.RecordTypeId = personaccountrecordtype.Id;
newAccount.LastName=c.LastName;
newAccount.FirstName=c.FirstName;   
update newAccount;

These code runs successfully, but the IsPersonAccount in Account object is false for some reason

Any one have idea how to get around the problem or other direction to do these?


thanks in advance


 


Message Edited by Feng on 12-10-2008 05:57 PM

Message Edited by Feng on 12-10-2008 05:59 PM
  • December 11, 2008
  • Like
  • 0
Is a patch released today , our salesforce pages experience problems, which used to working fine, here is the code to test
Code:
<apex:page controller="TestPage_Controller" showheader="true" sidebar="false" action="{!Init}" >
<apex:form >
    <apex:outputpanel rendered="{! Not RenderIt}" >    
  abc
    </apex:outputpanel>
</apex:form>
</apex:page>

 Controller :

Code:
public class TestPage_Controller {
    
    public String TheId = null;    
    public TestPage_Controller() {
                       
    }
    public void Init()
    {
     TheId = 'abc';
     System.Debug('----------' + Theid);
    }
    public boolean getRenderIt()
    {
     if(TheId == null)
     {
      throw new MyCustomizedException('The Id is null');
     }
     return true;
    }  
}

 
it looks this line of code not execute correctly

<apex:outputpanel rendered="{! RenderIt}" id="abc">

the variables in the getRenderIt method change to null for somehow

Cheers


Message Edited by Feng on 11-06-2008 09:27 PM
  • November 07, 2008
  • Like
  • 0
Hi, All, I tried to get the comments that user entered in the approval process page, i created a trigger on my object, here is part of the code:
 
Code:
if (objNew.Status__c  == 'Declined') 
      && 
      trigger.IsAfter)
     {
      
      ProcessInstance[] instances = [Select p.CreatedDate, p.Id, 
      (Select Comments, StepStatus From Steps where StepStatus = 'Rejected') 
      from ProcessInstance p where TargetObjectId = : objNew.Id];
      
      string comment = '';
      for(ProcessInstance step :instances )
      {
       
       if(step.Steps.Size() > 0) // make sure it has step and the step status is 'Rejected'
     {
      comment = step.Steps[0].Comments;
     }
    }

 // start create new task...
 Task t = new Task();
 t.Description = coment;
 ....
 insert t;

}

 
the newObj.Status__c is updated thru the field update in the approval action
 
the issue here is the comment is always blank as step.Steps.Size()  is always 0, looks like the processInstanceStep is not inserted until this trigger is finished
 
so how can i get the comments that user entered in the approval page
  • October 22, 2008
  • Like
  • 0
Hi, All
is there any way to stop sending email to approvers?
 
Thanks in advance
 
 
  • August 19, 2008
  • Like
  • 0
I had an approval process which contains two steps,
each step has been assigned to same queue
 
how can i set up the criteria not allow user do the approval in the second step, if he/she already approved in first step
 
For example
Person A, B, C in this approval Queue
Person A approved in Step 1,
Person A is not allow to approve this again in step 2, as he/she already approved in step 1
 
How can i set up this sinario: different user in the same queue to approval for the same approval request in different step?
 
much appricated thanks in advance

Regards
  • August 14, 2008
  • Like
  • 0
hi, Everyone, where i can set up multiple approvers for my approval process on my custom object?
 
Is it some setting i need to change in salesforce to enable this function or in the approval process creating wizard?
 
thanks in advance
  • August 12, 2008
  • Like
  • 0

Hi All, not sure your guys find these issue,

1.  I had two ListViews on the Page.
E.g.:

Code:
<apex:page showHeader="true" tabstyle="Case">
<apex:ListViews type="Case" />
<apex:ListViews type="MyCustomObject__c" />
</apex:page>

both select all check boxes Action on the list (next to the Action Label on the header ) are not working,
it is working if only one listview in the page
I am using IE6
the error msg from IE is: elements.length is null or not an object

2. Component default value,
i add following attribute into the component: SomeComponent

Code:
<apex:attribute name="AttName" description="description" type="boolean" required="false" default="false"/>


 I use this in another component ,

Code:
<c:AttName .... required="{MyObject.FieldReturnBoolean__c}" />

 it returns following error

MyAnotherComponent: 0: Literal Value is required for attribute AttName in <c: SomeComponent> at Line X column Y

no error returns  once i removed the default="false" from the code,

Any Idea about these two issues? Bug?



Message Edited by Feng on 07-16-2008 08:45 PM

Message Edited by Feng on 07-16-2008 08:47 PM

Message Edited by Feng on 07-17-2008 01:30 PM
  • July 17, 2008
  • Like
  • 0
when i try to create an attachment record in my testmethod
 
Code:
Attachment newatt = new Attachment();
  newatt.Name = 'test attachment';
  newatt.Body = 0;
  newatt.ParentId = obj.Id;
  insert newatt;

the code  newatt.Body = 0; failed
how to assign value to the body field as this field is base64 data type
 
thanks in advance
 
Feng
  • May 30, 2008
  • Like
  • 0
Hi there,
 
I Save my email attachment(a smal pdf file) into the attachment object, now i want to display the attachment body in my VisualForce Page,
 
<apex: outputfield value="{!Attachment.Body}" /> Not works coz it is base64 field...
 
 
 
any way to display the pdf file in my page? any code example of that, like 's-control' or something
 
 
Thanks in advance
 


Message Edited by Feng on 05-25-2008 05:09 PM
  • May 25, 2008
  • Like
  • 0
Hi There
 
I had a tab, created from a custom object, the url is like:
 
 
 
the a07 is the tab ID, how can i return this value(a07) from code?
 
 
Thanks in advance
 
 
  • May 19, 2008
  • Like
  • 0
Hi there,
 
 
on the lead change owner page, there is a picklist with two options : user and queue, then followed by a user/queue lookup
 
is there any way to implement the same way as lead change owner page? so if select queue the look up only shows/filters queues, if select user in the picklist only filter on the user
 
thanks in advance
 
Regards
 
 
 
  • May 19, 2008
  • Like
  • 0

Hi All, not sure your guys find these issue,

1.  I had two ListViews on the Page.
E.g.:

Code:
<apex:page showHeader="true" tabstyle="Case">
<apex:ListViews type="Case" />
<apex:ListViews type="MyCustomObject__c" />
</apex:page>

both select all check boxes Action on the list (next to the Action Label on the header ) are not working,
it is working if only one listview in the page
I am using IE6
the error msg from IE is: elements.length is null or not an object

2. Component default value,
i add following attribute into the component: SomeComponent

Code:
<apex:attribute name="AttName" description="description" type="boolean" required="false" default="false"/>


 I use this in another component ,

Code:
<c:AttName .... required="{MyObject.FieldReturnBoolean__c}" />

 it returns following error

MyAnotherComponent: 0: Literal Value is required for attribute AttName in <c: SomeComponent> at Line X column Y

no error returns  once i removed the default="false" from the code,

Any Idea about these two issues? Bug?



Message Edited by Feng on 07-16-2008 08:45 PM

Message Edited by Feng on 07-16-2008 08:47 PM

Message Edited by Feng on 07-17-2008 01:30 PM
  • July 17, 2008
  • Like
  • 0
Hi,

I have a Text Box, where I enter Date and as soon as I click on Add it gets added to the list and displays below. Now when I am trying to remove the date from the list I am unable to do it. I have used a wrapper class to set the value of the checkbox.

Here is the code - Term_Dates__c is my custom Object having a lookup relationship with Contract_Term__c and I have created a wrapper for Term_Dates__c custom object. As soon as I click on Add, I create a new Term_Dates__c and it gets added to the list but when I am tring to remove it, it is not happening. It is working in my develoiper org but not in sandbox.

I have only pasted a part of the code that is applicable -
Code:
Code:

 <apex:pageBlock title="Section 4" rendered="{!showFourthSection}">
             <p>Select Payment Frequency: <span style="padding:2px;"/> <apex:inputText id="payFreq"/></p>
             <p>Total # of Payments: <span style="padding:2px;"/><apex:inputText ></apex:inputText> </p>
             <p>Payment Dates: <span style="padding:2px;"/> <apex:inputField id="term" value="{!termDates.Date__c}"/>
                <span style="padding:10px;"/><apex:CommandButton action="{!addTermDates}" value="Add"></apex:CommandButton></p>
                <apex:pageBlockTable value="{!allTermDates}" var="a" id="rows" title="Details of Effective Date" >
                    <apex:column ><apex:inputCheckbox value="{!a.sendToExternalService}"></apex:inputCheckbox></apex:column>
                    <apex:column ><apex:inputField value="{!a.TermDates.Date__c}"/></apex:column>
                </apex:pageBlockTable>
                 <apex:commandLink action="{!removeTermDates}" value="Remove" rendered="{!listSize}"></apex:commandLink>
                <p><span style="padding:20px;"/>Are the Hi ROC rate thresholds and/or reduction/increases adjustable— </p>
                <p><span style="padding:30px;"/><apex:commandButton action="{!showSection5}" value="Yes, Continue" styleClass="btn"></apex:commandButton>
                 <span style="padding:2px;"/><apex:commandButton action="{!nextPage}" value="No, Continue" styleClass="btn"></apex:commandButton></p>
        </apex:pageBlock>

public class Wizard_Step6_Controller 
{
     CONTRACT_TERMS__c contract_terms;
     Term_Dates__c termDate = null;
     List<TermDatesWrapper> listOfTermDatesWrapper;
     List<TermDatesWrapper> selectedTermDatesWrapper = new List<TermDatesWrapper>();
     public Term_Dates__c getTermDates()
     {
         
         termDate = new Term_Dates__c();
         
         return termDate;
     
     }
     
     public PageReference addTermDates()
     {
         termDate.TERM_ID__c = getContractTerms().Id;
         termDate.Date_Type__c = 'Payment';
         insert termDate;
         System.currentPageReference().getParameters().put('term', '');
         return null;
     
     }
     public Boolean getListSize()
     {
         Boolean termSize= false;
         if(getAllTermDates().size()>0)
         {
             termSize = true;
         }
         return termSize;
     }
     
        public List<TermDatesWrapper> getAllTermDates()
        {
            listOfTermDatesWrapper = new List<TermDatesWrapper>();
            Term_Dates__c[] allTermDates = [select id, Date__c from Term_Dates__c where TERM_ID__c =:contract_terms.Id];
            for(Term_Dates__c l : allTermDates)
            {
                TermDatesWrapper wrapper= new TermDatesWrapper(l);
                listOfTermDatesWrapper.add(wrapper);
            }
            return listOfTermDatesWrapper;
        }
        
        public List<TermDatesWrapper> getAllSelectedTermDatesWrappers()
        
        {
            return selectedTermDatesWrapper;
        }
        
        public PageReference removeTermDates()
        {
            for(TermDatesWrapper lw : listOfTermDatesWrapper)
            {
               
                if(lw.getSendToExternalService())
                {
                    selectedTermDatesWrapper.add(lw);
                    delete lw.getTermDates();
                }
                
            }
        
            return null;
        }
}



public class TermDatesWrapper {
      private final Term_Dates__c delegate;
      private boolean sendToExternalService = false;

      public TermDatesWrapper (Term_Dates__c delegate) {
        this.delegate = delegate;
      }
   
      public Term_Dates__c getTermDates() {
        return delegate;
      }
   
      public void setSendToExternalService(boolean sendToExternalService) {
        this.sendToExternalService = sendToExternalService;
      }
   
      public boolean getSendToExternalService() {
        return sendToExternalService;
      }
   
   
    }
Please help...
Hi there,
 
I Save my email attachment(a smal pdf file) into the attachment object, now i want to display the attachment body in my VisualForce Page,
 
<apex: outputfield value="{!Attachment.Body}" /> Not works coz it is base64 field...
 
 
 
any way to display the pdf file in my page? any code example of that, like 's-control' or something
 
 
Thanks in advance
 


Message Edited by Feng on 05-25-2008 05:09 PM
  • May 25, 2008
  • Like
  • 0
Hi,

I have to create a back button which will do a browser back operation but somehow the onclick="javascript&colonhistory.back();" is not working for the button. Here is the piece of code below.

Code:
<apex:facet name="footer">
       <apex:commandButton  onclick="javascript&colonhistory.back();" value="Back"/>
</apex:facet>

 Can you anyone please suggest me how to do this?

Regards,
Jina

Hi There
 
I had a tab, created from a custom object, the url is like:
 
 
 
the a07 is the tab ID, how can i return this value(a07) from code?
 
 
Thanks in advance
 
 
  • May 19, 2008
  • Like
  • 0
Hi there,
 
 
on the lead change owner page, there is a picklist with two options : user and queue, then followed by a user/queue lookup
 
is there any way to implement the same way as lead change owner page? so if select queue the look up only shows/filters queues, if select user in the picklist only filter on the user
 
thanks in advance
 
Regards
 
 
 
  • May 19, 2008
  • Like
  • 0