• hgarg
  • NEWBIE
  • 105 Points
  • Member since 2011

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

During the sites self-registration process, I have only come across the ability to create a portal user that creates both a contact and a user synchronously.  I would like to be able to create a portal user using an existing contact.  I tried setting the contact id on the user object before I called createPortalUser, but it still created a new contact.  We are trying to eliminate the possibility of duplicate contacts.

  • April 07, 2011
  • Like
  • 0

Hi All,

 

I am having an issue with apex repeat displaying a list of records. My query is retrieving 23 rows but only 20 are being displayed. 

 

Here is the actual Apex query

 

 

 public ApexPages.StandardSetController setCon2 {

        get {

            if(setCon2 == null && ModuleId != null) {

             setCon2 = new ApexPages.StandardSetController([Select Id, IMAX_URL__c, IMAX_APIKey__c, IMAX_Version__c, PCMX_Version__c from Module__c where Id =: ModuleId LIMIT 1]);

            }

            return setCon2;

        }

        set;

    }  

 

    public list<IMAX_Device__c> getDevices() {

         if(ModuleId != null && setCon != null){

          return (List<IMAX_Device__c>) setCon.getRecords();

         }else{

          return null;

         }

    }

 

 

Here is the Visualforce repeat

 

 

<apex:repeat var="d" value="{!devices}"> 
<div class="middle"> 
  <div class="innermiddle"><span id="{!d.Id}" class="{!d.Active__c}"><apex:inputcheckbox value="{!d.Active__c}" id="checkbox" onclick="setCheckboxDisplay(this,'{!d.Id}'),saveDevices(),setTimeout('rerendermessages()',5000)" styleClass="styledCheckbox"/></span><span style="margin-left:1px;"><apex:inputtext styleclass="rounded3" value="{!d.Device_Name__c}" size="9"/></span> 
    <span style="margin-left:0px;"><apex:inputtext styleclass="rounded2" value="{!d.Name}" size="17"/></span> 
    <span style="margin-left:0px;;"><apex:commandlink styleclass="history" value="History" action="{!nullaction}" rerender="loginhistory"><apex:param name="deviceid" value="{!d.id}" /></apex:commandlink></span> 
    <span style="margin-left:1px;"><apex:commandlink styleclass="delete" action="{!delRow}" value="Delete" oncomplete="reloadwindow()"><apex:param name="delid" value="{!d.Id}"/> 
    </apex:commandlink> </span> </div>
</div>
</apex:repeat> 
The debug log shows 23 rows retrieved yet only 20 device lines are displayed on the screen below. Anyone have any ideas?
13:15:53.180|SOQL_EXECUTE_BEGIN|[22]|Aggregations:0|select Id, Active__c, Device_Name__c, Name from IMAX_Device__c where Module__c =: ModuleId and isDeleted = false order by CreatedDate asc
13:15:53.186|SOQL_EXECUTE_END|[22]|Rows:23

 

Account acc = new Account(Name='Test1',Type='Prospect',Country_Listing__c='India',RecordTypeId='XXXXXXXXX');


insert(acc);

 

Account acc1=[select Name,id from Account where id=:acc.Id limit 1];

 

opportunity opp1=new opportunity(Account=acc1.Name,Name='test5',CloseDate=system.Today());

 

This is the Query written in test class.when i try to insert like this it throws an error

 

Error: Compile Error: Invalid initial expression type for field Account, expecting: SOBJECT:Account (or single row query result of that type) at line 14 column 25

 

Thanks

  • March 10, 2011
  • Like
  • 0

I've create a visualforce page which contains all the counts of data associated to a particular user (i.e. num prospects, num opportunities, num tasks, etc), when a user clicked on any of the numbers they would be redirected to a detail page containing a list of all those particular objects. Once in production we ran into "Maximum view state size limit (128K) exceeded" issue. To fix this I added the transient keyword to each of these variable lists which contain the count. However, when the user clicked on any link containing the object count, the page would no longer be redirected to the appropriate page but rather just refresh the current one. Upon clicking the count links I query for the objects again so its not an issue with the variables not in the view state, it just seems to be an issue with having the transient keyword and not allowing me to redirect. Any ideas as to why this is happening?

 

I can provide code if needed. Thanks in advance.

I created a visualforce page with option renderas="pdf" and contentType="application/pdf" . This page is displays a rich text content in pdf format. While the richText content does not have any images it works good but if it has images then the images does not render properly, they are blurring.

 

Code is like following :

<apex:page contentType="application/pdf" renderas="pdf" >

<apex:outText value="{!obj__c.richText__c}" />

</apex:page>

 

is there any trick to render images properly in pdf? thanks in advance for any help.

 

  • April 01, 2011
  • Like
  • 0

I have a trigger that I had deactivated while changing some other nonrelated apex classes and now when I went back to activate the trigger I am getting an error saying that there is 0% test coverage on the trigger and therefore I cannot deploy.  However in the Sandbox it shows that I have 91% test coverage on the trigger.  I've tried deploying the test classes first and was able to do that but am still unable to deploy the activated trigger.  It insists that there is no coverage for the trigger in production while having 91% coverage in the Sandbox.  Has anyone else run into this issue before?  Can anyone tell me why it would be doing this? 

Thanks,

Amanda

During the sites self-registration process, I have only come across the ability to create a portal user that creates both a contact and a user synchronously.  I would like to be able to create a portal user using an existing contact.  I tried setting the contact id on the user object before I called createPortalUser, but it still created a new contact.  We are trying to eliminate the possibility of duplicate contacts.

  • April 07, 2011
  • Like
  • 0

Hi All,

 

I am having an issue with apex repeat displaying a list of records. My query is retrieving 23 rows but only 20 are being displayed. 

 

Here is the actual Apex query

 

 

 public ApexPages.StandardSetController setCon2 {

        get {

            if(setCon2 == null && ModuleId != null) {

             setCon2 = new ApexPages.StandardSetController([Select Id, IMAX_URL__c, IMAX_APIKey__c, IMAX_Version__c, PCMX_Version__c from Module__c where Id =: ModuleId LIMIT 1]);

            }

            return setCon2;

        }

        set;

    }  

 

    public list<IMAX_Device__c> getDevices() {

         if(ModuleId != null && setCon != null){

          return (List<IMAX_Device__c>) setCon.getRecords();

         }else{

          return null;

         }

    }

 

 

Here is the Visualforce repeat

 

 

<apex:repeat var="d" value="{!devices}"> 
<div class="middle"> 
  <div class="innermiddle"><span id="{!d.Id}" class="{!d.Active__c}"><apex:inputcheckbox value="{!d.Active__c}" id="checkbox" onclick="setCheckboxDisplay(this,'{!d.Id}'),saveDevices(),setTimeout('rerendermessages()',5000)" styleClass="styledCheckbox"/></span><span style="margin-left:1px;"><apex:inputtext styleclass="rounded3" value="{!d.Device_Name__c}" size="9"/></span> 
    <span style="margin-left:0px;"><apex:inputtext styleclass="rounded2" value="{!d.Name}" size="17"/></span> 
    <span style="margin-left:0px;;"><apex:commandlink styleclass="history" value="History" action="{!nullaction}" rerender="loginhistory"><apex:param name="deviceid" value="{!d.id}" /></apex:commandlink></span> 
    <span style="margin-left:1px;"><apex:commandlink styleclass="delete" action="{!delRow}" value="Delete" oncomplete="reloadwindow()"><apex:param name="delid" value="{!d.Id}"/> 
    </apex:commandlink> </span> </div>
</div>
</apex:repeat> 
The debug log shows 23 rows retrieved yet only 20 device lines are displayed on the screen below. Anyone have any ideas?
13:15:53.180|SOQL_EXECUTE_BEGIN|[22]|Aggregations:0|select Id, Active__c, Device_Name__c, Name from IMAX_Device__c where Module__c =: ModuleId and isDeleted = false order by CreatedDate asc
13:15:53.186|SOQL_EXECUTE_END|[22]|Rows:23

 

Hey Everyone -

 

I have a custom object that I want to display within the opportunity page layout as it's own section.  The VF page will render certain fields/sections based on how other fields are filled in.  I have the object/ fields and VF page built but I cannot get the controller to work so I can place it in the Opportunity layout.

 

I attempted to build a list type of controller

public class Questionnaire {
    public Questionnaire(ApexPages.StandardController controller){}
        List<Questionnaire>Questions;
        publicList<Questionnaire>getQuestions(){
            Questions=[select *FIELDS* from Questionnaire__c];
            return Questions;
    }  
}

 

 

But kept receiving a compile errore for invalid public list.  I just need to be able to display the fields so I'm unsure if list is even the way to go.

 

Obviously I'm really new to all this.  Any help would be appreciated.

 

Thanks,

Hello ,

             I have one requirement to make custom product functionality so i am making filter for that but how to check it with created date in query? createdDate only allows date time format and their standard product allows following formats i.e.

 

                   Valid date format 3/10/2011 or 3/10/2011 1:17 PM

 

so how can i do as they did? reply me fast if anyone knows ?

 

Thank you,

Minkesh Patel

Account acc = new Account(Name='Test1',Type='Prospect',Country_Listing__c='India',RecordTypeId='XXXXXXXXX');


insert(acc);

 

Account acc1=[select Name,id from Account where id=:acc.Id limit 1];

 

opportunity opp1=new opportunity(Account=acc1.Name,Name='test5',CloseDate=system.Today());

 

This is the Query written in test class.when i try to insert like this it throws an error

 

Error: Compile Error: Invalid initial expression type for field Account, expecting: SOBJECT:Account (or single row query result of that type) at line 14 column 25

 

Thanks

  • March 10, 2011
  • Like
  • 0

 

Hi,
    {!addMore} is a coomand button action (VF) and blow code is a part of exdtension. I am getting current record  in variable named budget1 of type Budget__C. 
    I would like to calculate total budget value at project level on field test1__c on Project__C object.
    Question is creation of budget record working fine but budger related project field (test1__c) is not populated.
//Budget Record Save
     public PageReference addMore()
     {
                       
          
          database.Insert(budget1);
         if(budget1.value__c!=Null && budget1.PMO_Project__r.test1__c!=null )
           { 
               budget1.PMO_Project__r.test1__c = 'test';
              
              projects__c project = [select 
              
                                     name from projects__c where projects__c.id=:budget1.PMO_Project__r.Id] ;
                
               
               
              update(project) 
                          
           }       
          
          ApexPages.StandardController budgetController = new ApexPages.StandardController(budget1);
          return budgetController.save();
          //return page.budgetDetail;
     }

 

 

Appreciate Your Help,

 

Dhairya

The challenge is that the email is going twice.

 

following is the code for sending email (part of class)

 

    Messaging.SingleEmailMessage mail = new Messag​ing.SingleEmailMessage();
    String[] toAddresses = new String[] {c.Client_​Email_Address__c};
    if(c.Client_Email_Address_Optional__c != null)​{
    String[] toAddresses2 = new String[] {c.Client​_Email_Address_Optional__c};
    mail.setCcAddresses(toAddresses2);}
    mail.setToAddresses(toAddresses);
     EmailTemplate et = [SELECT id FROM EmailTempl​ate WHERE developerName = 'Dispute_Notification'];
    mail.setTemplateId(et.id);
    mail.setTargetObjectId(c.ContactId);
    mail.setwhatId(c.Id);
    mail.saveAsActivity = true;
    mail.setOrgWideEmailAddressId('0D2S0056674CiI'​);
    Messaging.sendEmail(new Messaging.SingleEmailM​essage[] { mail });

I could crack logging a trigger email as an activty but it sends the email twice and it also sends the email to contact email id too??

I just wanna send an email to CLient_Email_Address__c

 

Any idea?

 

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    String[] toAddresses = new String[] {c.CLient_Email_Address__c};
    mail.setToAddresses(toAddresses);
    mail.setTargetObjectId(c.ContactId);
    mail.setwhatId(c.Id);
    EmailTemplate et = [SELECT id FROM EmailTemplate WHERE developerName = 'Completion_Notification'];
    mail.setTemplateId(et.id);
    mail.saveAsActivity = true;
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

I've create a visualforce page which contains all the counts of data associated to a particular user (i.e. num prospects, num opportunities, num tasks, etc), when a user clicked on any of the numbers they would be redirected to a detail page containing a list of all those particular objects. Once in production we ran into "Maximum view state size limit (128K) exceeded" issue. To fix this I added the transient keyword to each of these variable lists which contain the count. However, when the user clicked on any link containing the object count, the page would no longer be redirected to the appropriate page but rather just refresh the current one. Upon clicking the count links I query for the objects again so its not an issue with the variables not in the view state, it just seems to be an issue with having the transient keyword and not allowing me to redirect. Any ideas as to why this is happening?

 

I can provide code if needed. Thanks in advance.

I have written a controller. It's main task is to fetch current user's email info, then query using that email to extract some data from a custom object. 

 

for example : 

 

if current user's email is abc@xyz.com. it will extract some info from custom object A  where some field = "abc@xyz.com"

 

then it returns the value to VF page . Thats what i am trying to show when a User is logging in(from SiteLogin page).

 

The visualforce page is working fine and showing exact Current user related values when i am viewing it on developer mode[........./apex / myVFpage ]. But when i am trying to access the page by logging in from siteLogin page some how its not showing the values. Though its showing all other fields which i am directly accessing from the VF page. But its not showing the values that i am returning from controller. I tried debug log, but somehow its not executing the controller code when i am accessing it as portalUser logging in from SiteLogin Page.

 

Thanx in advance

  • January 27, 2011
  • Like
  • 0

Whats the best Force.com Site that you've ever seen?

  • January 06, 2011
  • Like
  • 0

Getting the ever helpful "Authorization Required" page.  Admin Preview mode is enabled, no error message.  Log file is written, but no errors whatsoever.  Can anyone tell me what exactly would next steps be in troubleshooting this?

 

 

19.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO
23:04:49.160|EXECUTION_STARTED
23:04:49.160|CODE_UNIT_STARTED|[EXTERNAL]|066300000004viE|VF: /apex/Unauthorized
23:04:49.160|CODE_UNIT_STARTED|[EXTERNAL]|01p30000000CRPs|PortalMainController <init>
23:04:49.163|METHOD_ENTRY|[62]|MAP.get(ANY)
23:04:49.163|METHOD_ENTRY|[62]|System.PageReference.getParameters()
23:04:49.163|METHOD_ENTRY|[62]|ApexPages.currentPage()
23:04:49.164|METHOD_EXIT|[62]|ApexPages.currentPage()
23:04:49.164|METHOD_EXIT|[62]|System.PageReference.getParameters()
23:04:49.164|METHOD_EXIT|[62]|MAP.get(ANY)
23:04:49.164|METHOD_ENTRY|[80]|01p30000000CRPs|PortalMainController.getUrlParam(String)
23:04:49.164|METHOD_ENTRY|[120]|MAP.get(ANY)
23:04:49.164|METHOD_ENTRY|[120]|System.PageReference.getParameters()
23:04:49.164|METHOD_ENTRY|[120]|ApexPages.currentPage()
23:04:49.164|METHOD_EXIT|[120]|ApexPages.currentPage()
23:04:49.164|METHOD_EXIT|[120]|System.PageReference.getParameters()
23:04:49.164|METHOD_EXIT|[120]|MAP.get(ANY)
23:04:49.164|METHOD_EXIT|[80]|PortalMainController.getUrlParam(String)
23:04:49.167|METHOD_ENTRY|[5]|01p30000000CRPs|PortalMainController.retrieveAlertsToShow()
23:04:49.167|METHOD_ENTRY|[20]|Database.query(String)
23:04:49.170|SOQL_EXECUTE_BEGIN|[20]|Aggregations:0|select ID, knowledgearticleid, Localized_Title__c from Alert__kav where PublishStatus = 'online' and IsVisibleInPkb = true limit 10
23:04:49.178|SOQL_EXECUTE_END|[20]|Rows:2
23:04:49.178|METHOD_EXIT|[20]|Database.query(String)
23:04:49.178|METHOD_ENTRY|[21]|LIST.size()
23:04:49.178|METHOD_EXIT|[21]|LIST.size()
23:04:49.178|METHOD_EXIT|[5]|PortalMainController.retrieveAlertsToShow()
23:04:49.178|METHOD_ENTRY|[6]|LIST.size()
23:04:49.178|METHOD_EXIT|[6]|LIST.size()
23:04:49.178|CODE_UNIT_FINISHED|PortalMainController <init>
23:04:49.179|CODE_UNIT_STARTED|[EXTERNAL]|01p30000000CRPs|PortalMainController get(SiteUrlString)
23:04:49.179|CODE_UNIT_STARTED|[EXTERNAL]|01p30000000CRPs|PortalMainController invoke(getSiteUrlString)
23:04:49.180|METHOD_ENTRY|[31]|system.Site.getCustomWebAddress()
23:04:49.180|METHOD_EXIT|[31]|system.Site.getCustomWebAddress()
23:04:49.180|METHOD_ENTRY|[33]|system.Site.getCustomWebAddress()
23:04:49.180|METHOD_EXIT|[33]|system.Site.getCustomWebAddress()
23:04:49.180|CODE_UNIT_FINISHED|PortalMainController invoke(getSiteUrlString)
23:04:49.180|CODE_UNIT_FINISHED|PortalMainController get(SiteUrlString)
23:04:49.181|CODE_UNIT_STARTED|[EXTERNAL]|01p30000000CRPs|PortalMainController get(SelfServiceHomePage)
23:04:49.181|CODE_UNIT_STARTED|[EXTERNAL]|01p30000000CRPs|PortalMainController invoke(getSelfServiceHomePage)
23:04:49.181|CODE_UNIT_FINISHED|PortalMainController invoke(getSelfServiceHomePage)
23:04:49.181|CODE_UNIT_FINISHED|PortalMainController get(SelfServiceHomePage)
23:04:49.212|CUMULATIVE_LIMIT_USAGE
23:04:49.212|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 1 out of 100
  Number of query rows: 2 out of 10000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 100
  Number of DML rows: 0 out of 10000
  Number of script statements: 66 out of 200000
  Maximum heap size: 0 out of 3000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10
  Number of find similar calls: 0 out of 10
  Number of System.runAs() invocations: 0 out of 20

23:04:49.212|CUMULATIVE_LIMIT_USAGE_END

23:04:49.212|CODE_UNIT_FINISHED|VF: /apex/Unauthorized
23:04:49.212|EXECUTION_FINISHED

 

 

As you can see, at the very end, it does some kind of auto-redirect to /apex/unauthorized.  the URL itself will render as the portal "frontdoor" URL, like

 

 

https://logmein.lmisupport.cs3.force.com/portal/secur/frontdoor.jsp?cshc=0000000SmHV00000000elr&portalId=06030000000KLOj&refURL=https%253A%252F%252Flogmein.lmisupport.cs3.force.com%252Fportal%252Fsecur%252Ffrontdoor.jsp&retURL=%252Fportal%252Fapex%252Fportalcasedetail&sid=00DQ00000000elr%2521ARsAQPMRBgvnE_sjnWsrc8aZgq857bO3C84ObcZOp4dOrmnM2CHLBcyfp5ufh64L4XCjMfffMFKQDVo07Ua7JbtgmA1WumAlSDU&untethered=

 

All VF pages required are granted for Site pages, in Public Access Settings, and for the Profile of the Portal User.  Same goes for all objects and fields referenced in the pages, for all 3 "layers".

 

 Getting extremely frustrated with the lack of ability to troubleshoot issues with Sites...:(

 

Hi,

 

I've setup a page that allows a user to download a link that is an attachment to an account. The problem is that file is accesable to the guest user but when the portal user logs in and tries to download the file they receive an authorization required message.

 

The portal user has a High Volume Portal license and I've made sure that the profile has read access to the account object as well as the document object. How do I enable file access for High Volume Portal users. It seems ridiculous that the guest users can have higher levels of access then authenticated users.

 

Thanks!

Scott

  • September 01, 2010
  • Like
  • 0

Hi. I am able to display all the attachments related to a customer portal user. But the problem is that, when user clicks on that attachment link to download, it says INSUFFICIENT PREVILIGES. Here is what I am using .

 

<a href="{!URLFOR($Action.Attachment.Download, att.id)}" >{!att.name}</a>

 

<a href="{!URLFOR($Action.Attachment.Download, att.id)}" >{!att.name}</a>

 

But the same works in a normal vf page that is for a normal contact withoutr any authentication.

 

Thanks for any help.