• FinnArild
  • NEWBIE
  • 125 Points
  • Member since 2009

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 22
    Replies

Hi, I have created customer portal and added visual force tab also. there is default Home Tab which we can't remove from customer portal.

but can we change the home page content?

 

if we create multiple customer portal then what would be happen with Home Tab?

Can we use different Home tab for different customer portal?

 

any hint would be very helpful.

Hi all,

 

I want to create a custom object with information from an incoming email that has a certain structure. For this purpose, I'd need to go through the body text of the email and parse it line by line. What is the best way of doing this? 

 

Cheers, 

 

Martin

I have two select lists (Product, Version) and an output listing (files) which should work together so the user can select different products, versions and get the file downloads. Some code:

 

 

  <apex:pageBlock title="Select product and version for download" id="sel">
    <apex:form >
      <apex:outputLabel value="Product: " for="productsel"/>
      <apex:selectList size="1" value="{!selProd}" id="productsel">
        <apex:selectOptions value="{!products}"/>
        <apex:actionSupport event="onchange" rerender="availableversions"/>
      </apex:selectList>
      <apex:outputLabel value="Version: " for="availableversions"/> 
      <apex:selectList value="{!selVersion}" size="1" id="availableversions">
        <apex:actionSupport event="onchange" rerender="listing"/>
        <apex:selectOptions value="{!curVersions}"/>    
      </apex:selectList>
    </apex:form>
  </apex:pageBlock>
  <apex:pageBlock title="Files" id="listing">
    <!-- LISTING CODE --> 
  </apex:pageBlock>

Problem with this code, is that when I select product, the version listing is updated but the files listing is not - but I thought I knew how to fix that - I changed the first actionsupport to: 

 

        <apex:actionSupport event="onchange" rerender="availableversions,listing"/>

 You should think that would work, wouldn't you? But no - the listing is obviously rendered before the version change can write the correct version so I can get the correct listing.

 

 

I have tried several things - including setting up getter/setter methods that tries to counter this behavior - but even if I pick the correct version in the product setter method, it seems that this is being overridden by the wrong version again somehow.

 

Does anyone have any suggestion to what I might try - or maybe even a working example?

When a customer adds a new case and that matches (in some arcane way) with a solution, the SolutionSuggestionPage appears (/ui/solution/SolutionSuggestionPage). I can't find any where to customize this page (it's pretty useless as it is) - is it at all possible, or will I have to override the submit button and refactor the whole process my self?

 

Thanks :) ...

I think the topic says it all. I can't really figure out how to do this. There's certainly no place to stick a help message in when I edit the field. Anyone know how to do this?
Message Edited by FinnArild on 03-26-2010 03:52 AM

I have visualforce snippet:

 

 

<apex:repeat value="{!prosets}" var="project"> <td> <apex:image width="180" height="110" url="{!URLFOR($Action.Attachment.Download, attId)}"/> <h3><a href="{!SourceSite}/project?id={!project.Id}" target="_parent">{!project.Name}</a></h3> <p>By: {!project.Account__r.Name} ImgNum: {!ImgNum}</p> </td> </apex:repeat>

 

 and controller snippet:

 

public static Integer ImgNum = 0; public Integer getImgNum() { return ImgNum; } public Id getAttId() { if (pageImages.size() > ImgNum) { Id ret = pageImages[ImgNum].Id; ImgNum = ImgNum + 1; return ret; } else { return '00PR0000000GVWg'; } }

 

 Now - obviously, I want to return an incremented index in the pageImages list - but when I run this baby, ImgNum does not get incremented (confirmed by the getImgNum getter)

 

Why? Are static variables not compitable with Visualforce controllers?

 

 

Hi - we have a Customer Portal/Site setup where we want students to give anonymous surveys of the different seminars. We want to send them a mail with a link to a form that automatically selects the seminar - where they can fill out the data. So - I want to pass the reference to a seminar in an url string - which should be really, really easy - but I just can't seem to figure it out. Below is my current code - what the hickory am I doing wrong?

 

 

<apex:page showHeader="false" standardController="Survey__c"> <script type="text/javascript"> document.getElementById('Seminar__c').value ='{!$CurrentPage.parameters.Seminar}'; alert("What the heck !"); </script> <apex:stylesheet value="/dCSS/dStandard.css"/> <apex:composition template="{!$Site.Template}"> <apex:define name="body"> <apex:form > {!Survey__c.Seminar__c} <apex:pageBlock title="Please fill in this survey"> <div class="field"> <label class="formQuestion" for="">Seminar</label> <apex:inputHidden value="{!Survey__c.Seminar__c}" id="Seminar__c"/> <!-- <apex:inputField value="{!Survey__c.Seminar__c}"/> --> <!-- <input type="hidden" name="j_id0:SiteTemplate:j_id7:j_id8:j_id10" value="{!$CurrentPage.parameters.Seminar}"/> --> </div> {!$CurrentPage.parameters.Seminar__c} <apex:commandButton action="{!save}" value="Save Survey"/> </apex:pageBlock> </apex:form> </apex:define> </apex:composition> </apex:page>

 

 

 

 

 

... or I can at least not make it work :) ...

 

I have a custom object "Courses" and the following query:

 

 

SELECT Name, Description__c FROM Course__c

 

 And looking at the documentation made the following errorneous mapping:

 

 

ft:"Qt Course Calendar", et:Name, ec: "Description " Name "<br/>" Description__c, ea:"Created by Winnie Pooh"

 

 It fails with:

  • Mapping: Unexpected token IDENTIFIER(Name) at character 53 of input

 

Now - if I remove the fields from the ec: I can save it - but that doesn't neither give me what I need or correspond with the documentation.

 

All permissions should be ok - what am I doing wrong?

 

 

 

Hi - for vacation handling I want to re-run default case assignment as described in the new DMLOptions. However, setting this in the after update seems to have no effect:

 

 

Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule = true; for (Case c:trigger.new) { c.setOptions(dmo); }

 

 Does anyone have a working example on using this any other place than on insert triggers - if indeed it is at all possible?

 

So - I'm running into one of those cases where my logic and class works fine, but the test gives me grief - I'm sure I'm not the only one experiencing that from time to time.

 

Anyway - the code and test is in here:

 

http://pastebin.com/m3ac3e655

 

This messes up my test thusly:

 

System.DmlException: Update failed. First exception on row 0 with id 005R0000000RjIfIAK; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): User, original object: Case

 

I saw some posts mentioning this as a SFDC bug, but I found no workarounds anywhere. Can anyone help? Thanks.

I have a trigger trying to access the name on the foreign key Contact:

 

 

trigger SAC_updateName on Support_Agreement_Contacts__c (before insert, before update) { for (Support_Agreement_Contacts__c sac:Trigger.new){ Contact[] c = [Select Name from Contact where Id =: sac.Contact_Id__c]; if (c.size() > 0) { sac.Name = c[0].Name; } else { sac.Name = 'John Doe'; } } }

 

Which obviously will generate a "Too many sql queries" on bulk updates, but it is like this because this doesn't work:

 

trigger SAC_updateName on Support_Agreement_Contacts__c (before insert, before update) { for (Support_Agreement_Contacts__c sac:Trigger.new){ if (sac.Contact_Id__c != null) { sac.Name = sac.Contact_Id__c.Name; } else { sac.Name = 'John Doe'; } } }

 

 

 

 

So - obviously, I don't get how this should work at all. I also tried the different __r and whatnots - but I could never get any real reference to the Contact object. Can anyone help a newbie out with this? 

We are setting up our support department to use Salesforce and most of the setup has gone fine - but we want to set a date field when a case is answered/replied to by email the first time. This turned out to be very difficult since:

 

- There's no way of triggering anything on an email

- There's no way to customise the "Send an email" button - or even remove it (related pane to case).

 

I would be very happy if someone has got any ideas for this.

Hi - I searched the forum for this but could not find a good answer - so I try here.


Is there a way to configure the reply-to quoting settings so the posting style supports inline replying like it is described here:

http://en.wikipedia.org/wiki/Posting_style#Inline_replying

 

(Basically original lines prefixed with one or several "> ").

 

Would be grateful for some hints here.

I have a controller (ex. myController) with a method (ex. mailMyContact), that when called, sends an e-mail (Messaging.SingleEmailMessage) with a PDF attachment (saved from a VF page). This is working fine in the Sandbox - the method is called from a User button click from a visualforce page. However, I can't figure out how to test it. I'm trying the below - when I comment out the third line it the coverage covers the other method, but when I include it, it's not getting any coverage. Is there a trick to testing Single Email Messages and/or PDF attachments?

 

 

myController c = new myController();
c.updateContact();
c.mailMyContact();

 

 

  • May 03, 2011
  • Like
  • 0

When a customer adds a new case and that matches (in some arcane way) with a solution, the SolutionSuggestionPage appears (/ui/solution/SolutionSuggestionPage). I can't find any where to customize this page (it's pretty useless as it is) - is it at all possible, or will I have to override the submit button and refactor the whole process my self?

 

Thanks :) ...

There are two checkbox properties on the User record detail/edit page:

 

 

  • Receive Salesforce CRM Content Email Alerts
  • Receive Salesforce CRM Content Alerts as Daily Digest
As best I can determine, these two settings are not available in the Salesforce API on the User object (or on any related object I've checked).
I need access to these settings on the User object at least with Apex code so that I can expose them to Customer Portal users in a custom "My Profile" page. Is there any way to retrieve and set these properties?

 

I think the topic says it all. I can't really figure out how to do this. There's certainly no place to stick a help message in when I edit the field. Anyone know how to do this?
Message Edited by FinnArild on 03-26-2010 03:52 AM

I have visualforce snippet:

 

 

<apex:repeat value="{!prosets}" var="project"> <td> <apex:image width="180" height="110" url="{!URLFOR($Action.Attachment.Download, attId)}"/> <h3><a href="{!SourceSite}/project?id={!project.Id}" target="_parent">{!project.Name}</a></h3> <p>By: {!project.Account__r.Name} ImgNum: {!ImgNum}</p> </td> </apex:repeat>

 

 and controller snippet:

 

public static Integer ImgNum = 0; public Integer getImgNum() { return ImgNum; } public Id getAttId() { if (pageImages.size() > ImgNum) { Id ret = pageImages[ImgNum].Id; ImgNum = ImgNum + 1; return ret; } else { return '00PR0000000GVWg'; } }

 

 Now - obviously, I want to return an incremented index in the pageImages list - but when I run this baby, ImgNum does not get incremented (confirmed by the getImgNum getter)

 

Why? Are static variables not compitable with Visualforce controllers?

 

 

Hi, I have created customer portal and added visual force tab also. there is default Home Tab which we can't remove from customer portal.

but can we change the home page content?

 

if we create multiple customer portal then what would be happen with Home Tab?

Can we use different Home tab for different customer portal?

 

any hint would be very helpful.

I am trying to set up a shipping fulfillment page that lists opportunities and the products that need to be shipped underneath.  The problem is the list will grow very long if the pageBlockSections (one for each opportunity) cannot be collapsed.  When I use a repeat tag to list the opportunity as pageBlockSections with the products for the opportunity listed inside the pageBlockSection the collapse function throws a javascript error.  Everything looks fine, but the pageBlockSection cannot be collapsed.  Here is the VF code:

 

<apex:page standardController="Promotion_Registration_Premium__c" extensions="premiumFulfillmentControllerExt"> <div style="color:red;font-weight:bold;"><apex:messages /></div> <apex:pageBlock title="Premium Fulfillment"> <apex:repeat value="{!premiums}" var="premium" id="theRepeat"> <apex:pageBlockSection id="section" title="{!premium.opportunityName}" columns="1"> <apex:form > <apex:pageBlockSectionItem > <table width="100%" cellpadding="5"> <tr> <td width="15%" style="vertical-align:middle"> <div align="right"><strong>Ship To Name:</strong> </div> </td> <td width="35%" style="vertical-align:middle"> {!premium.shipToName} </td> <td width="15%" style="vertical-align:middle"> <div align="right"><strong>Ship To Address: </strong></div> </td> <td width="35%" style="vertical-align:middle"> {!premium.shipToAddress}<br/>{!premium.shipToCity}, &nbsp; {!premium.shipToState} &nbsp; {!premium.shipToPostalCode} <br/> {!premium.shipToCountry} </td> </tr> </table> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:dataTable value="{!premium.premiums}" var="prp" width="100%" id="premiumTable"> <apex:column width="25%" headerValue="Product" ><apex:outputField value="{!prp.Product__c}"/></apex:column> <apex:column width="15%"> <apex:facet name="header"><div align="right">Quantity Ordered</div></apex:facet> <div align="right"><apex:outputField value="{!prp.Quantity__c}"/></div> </apex:column> <apex:column width="15%"> <apex:facet name="header"><div align="center">Shipped Via</div></apex:facet> <div align="center"><apex:inputField value="{!prp.Shipped_Via__c}"/></div> </apex:column> <apex:column width="15%"> <apex:facet name="header"><div align="center">Tracking Number</div></apex:facet> <div align="center"><apex:inputField value="{!prp.Tracking_Number__c}"/></div> </apex:column> <apex:column width="15%"> <apex:facet name="header"><div align="right">Quantity Shipped</div></apex:facet> <div align="right"><apex:inputField value="{!prp.Quantity_Shipped__c}"/></div> </apex:column> <apex:column width="15%"> <div align="center"> <apex:commandLink value="Mark as Shipped" action="{!markItemAsShipped}"> <apex:param name="premId" value="{!prp.Id}"/> </apex:commandLink> </div> </apex:column> </apex:dataTable> </apex:pageBlockSectionItem> </apex:form> </apex:pageBlockSection> </apex:repeat> </apex:pageBlock> </apex:page>

 

Thanks in advance for any help.

  • September 16, 2009
  • Like
  • 0

Hi - we have a Customer Portal/Site setup where we want students to give anonymous surveys of the different seminars. We want to send them a mail with a link to a form that automatically selects the seminar - where they can fill out the data. So - I want to pass the reference to a seminar in an url string - which should be really, really easy - but I just can't seem to figure it out. Below is my current code - what the hickory am I doing wrong?

 

 

<apex:page showHeader="false" standardController="Survey__c"> <script type="text/javascript"> document.getElementById('Seminar__c').value ='{!$CurrentPage.parameters.Seminar}'; alert("What the heck !"); </script> <apex:stylesheet value="/dCSS/dStandard.css"/> <apex:composition template="{!$Site.Template}"> <apex:define name="body"> <apex:form > {!Survey__c.Seminar__c} <apex:pageBlock title="Please fill in this survey"> <div class="field"> <label class="formQuestion" for="">Seminar</label> <apex:inputHidden value="{!Survey__c.Seminar__c}" id="Seminar__c"/> <!-- <apex:inputField value="{!Survey__c.Seminar__c}"/> --> <!-- <input type="hidden" name="j_id0:SiteTemplate:j_id7:j_id8:j_id10" value="{!$CurrentPage.parameters.Seminar}"/> --> </div> {!$CurrentPage.parameters.Seminar__c} <apex:commandButton action="{!save}" value="Save Survey"/> </apex:pageBlock> </apex:form> </apex:define> </apex:composition> </apex:page>

 

 

 

 

 

To auto populate the standard employee number field on user object I have created auto no field and using a trigger on object user on after insert I am updating also . Also as per my requirement I have to also create a contact record on the after insert of user . But is not allowing me to do both the dml operation together.

 

the code is as follows:

trigger employeenoautopopulate on User (after insert)
{
 
     List<Contact> Con = new List<Contact>();
 
     for(User usr: Trigger.new)
     {
             System.debug('****** condition true');
             Contact con_temp = new Contact();
             con_temp.FirstName = usr.FirstName;
             con_temp.LastName = usr.LastName;
             con_temp.Date_Of_Joining__c = usr.Date_of_Joining__c;
             con_temp.User__c = usr.Id;
             con_temp.OwnerId = usr.Id;
             con_temp.Employee_Number__c = usr.Employee_Number__c;
             Con.add(con_temp);
      }  
      if(Con.size()>0)
      {
       insert Con;
        System.debug('****** insert done');
      }
   
     Set<Id> userid = new Set<Id>();
     for(User usr: Trigger.new)
     {
  
         userid.add(usr.Id);   
     }
  
     User[] usr = [select Id, EmployeeNumber,Employee_Number__c from user where Id in :userid];
     for(Integer i=0;i<usr.size();i++)
     {
        usr[i].EmployeeNumber = usr[i].Employee_Number__c ;
        System.debug('****'+usr[i].Employee_Number__c);
     }
      
      update usr;
      System.debug('****** update done');
}

 

I am getting following exception:

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger employeenoautopopulate caused an unexpected exception, contact your administrator: employeenoautopopulate: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User: []: Trigger.employeenoautopopulate: line 20, column 8
 

 

  • June 18, 2009
  • Like
  • 0

Hi all,

 

I want to create a custom object with information from an incoming email that has a certain structure. For this purpose, I'd need to go through the body text of the email and parse it line by line. What is the best way of doing this? 

 

Cheers, 

 

Martin

Hi Friends,

 

I have one requirement like this.

I have once salesforce account, i am writing one apex class and generating the WSDL.

I need to use this WSDL to create a apex class in diff salesforce account.

After creating apex class from the WSDL what i need to do in order to access the method which is there in WSDL.

 

Kindly help me out in this.

 

Regards,

Elavarasan N.

Hi - for vacation handling I want to re-run default case assignment as described in the new DMLOptions. However, setting this in the after update seems to have no effect:

 

 

Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule = true; for (Case c:trigger.new) { c.setOptions(dmo); }

 

 Does anyone have a working example on using this any other place than on insert triggers - if indeed it is at all possible?

 

So - I'm running into one of those cases where my logic and class works fine, but the test gives me grief - I'm sure I'm not the only one experiencing that from time to time.

 

Anyway - the code and test is in here:

 

http://pastebin.com/m3ac3e655

 

This messes up my test thusly:

 

System.DmlException: Update failed. First exception on row 0 with id 005R0000000RjIfIAK; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): User, original object: Case

 

I saw some posts mentioning this as a SFDC bug, but I found no workarounds anywhere. Can anyone help? Thanks.

I have a trigger trying to access the name on the foreign key Contact:

 

 

trigger SAC_updateName on Support_Agreement_Contacts__c (before insert, before update) { for (Support_Agreement_Contacts__c sac:Trigger.new){ Contact[] c = [Select Name from Contact where Id =: sac.Contact_Id__c]; if (c.size() > 0) { sac.Name = c[0].Name; } else { sac.Name = 'John Doe'; } } }

 

Which obviously will generate a "Too many sql queries" on bulk updates, but it is like this because this doesn't work:

 

trigger SAC_updateName on Support_Agreement_Contacts__c (before insert, before update) { for (Support_Agreement_Contacts__c sac:Trigger.new){ if (sac.Contact_Id__c != null) { sac.Name = sac.Contact_Id__c.Name; } else { sac.Name = 'John Doe'; } } }

 

 

 

 

So - obviously, I don't get how this should work at all. I also tried the different __r and whatnots - but I could never get any real reference to the Contact object. Can anyone help a newbie out with this? 

Hi - I searched the forum for this but could not find a good answer - so I try here.


Is there a way to configure the reply-to quoting settings so the posting style supports inline replying like it is described here:

http://en.wikipedia.org/wiki/Posting_style#Inline_replying

 

(Basically original lines prefixed with one or several "> ").

 

Would be grateful for some hints here.

I am having some difficulty figuring out what I am seeing after I deploy to a new environment using the Eclipse tool.

 

For my test, I deployed a new object to an existing environment.  The deployment went through with no errors.  When I used the deploy tool a second time to deploy the same code to the same environment I was suprised to see that the deployment package indicated that I needed to overwrite the object that I had just finished deploying. 

 

I compared the objects in the two environments and they are identical right down to the same file length.  Does anyone have any idea why the tool thinks I need to overwrite the object?

 

This single object was an experiment because I am trying to understand this behavior when I deploy objects from one environmetn to another.  My thought is that I can generate a second deployment package after I do the original deployment and quickly understand which Salesforce entities may have had deletions made.

 

Thanks,

  • March 03, 2009
  • Like
  • 0
Hi,

What is best way to write unit tests for an Apex class ? The known options are listed below.
1. Write the test in seperate Apex class.
2. Write test in an inner class in the same apex class.
3. Write test same apex class at the bottom.

I used option 1, but had a problem with writing tests for private methods. Finally I had to make all of them public, which I don't think as not good practise.

Can I use @IsTest annotation for inner class or test methods ?

Thanks
Viraj



  • December 13, 2008
  • Like
  • 0