• csorrows
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 10
    Replies

I have been beating my head against the wall for hours trying to get this to work, and no luck.  I have some simple debug code in an Apex trigger that I'm trying to use to extract a series of six digits out of a serial number field.

 

But no matter how I code the pattern, it never matches.  Below is the sample code:

 

      String debugAssetSn = 'AA-104999';
      system.debug('debugAssetSn = ' + debugAssetSn);
      Pattern debugPatternAssetSnNumberOnly = Pattern.compile('([0-9]{6})');  // Why isn't this matching???
      Matcher debugMatcherAssetSnNumberOnly;
      debugMatcherAssetSnNumberOnly = debugPatternAssetSnNumberOnly.matcher(debugAssetSn);
      if (debugMatcherAssetSnNumberOnly.matches())
        {system.debug('Pattern DID match.');
         Integer debugAssetSnNumberOnly = integer.valueof(debugMatcherAssetSnNumberOnly.group(1));
         system.debug('debugAssetSnNumberOnly = ' + debugAssetSnNumberOnly);
        }
      else
        {system.debug('Pattern DID NOT match.');
        }

The Pattern.compile is very simple - Just a capture group of six digits.  But when I save the record and the trigger executes, it NEVER matches.

 

Even when I code the pattern compile as 'AA-104999' it never matches.  It always falls through to the debug 'Pattern DID NOT match' section.

 

Any thoughts would be GREATLY appreciated.  Thanks!

I have custom VF pages to display Case data for customer portal users, and I need to display the Articles (as in Salesforce Knowledge articles) attached to the case.  Articles can be displayed similar to a related list on standard page layouts, but I can't use those since all my pages are custom VF pages.

 

I thought I could use the "support:caseArticles" VF element, but it's displaying nothing for the customer portal user, no matter what options I use (and I am setting the caseId parameter).  I know the portal user has access to an attached article because he can see it in the "Articles" tab, and the article is enabled for access via the Customer Portal channel.

 

Is there something I'm missing?  Isn't this the purpose of the "support:caseArticles" element, to display attached articles to a case (and an optional search, but I don't care about the search part).  I did find the requirement to enable both Knowledge and Case Feed, which I did (the VF editor wouldn't even let me save the page until I'd enabled Case Feed).

 

Thanks

I'm having a heck of a time trying to get Customer Portal users to be able to edit their Accounts' Assets.

 

I've done all the following, but it hasn't helped:

 

  • Given my custom customer portal profile Edit access to the Asset object.
  • Profile is marked as portal super use, and has delegated privileges.
  • All portal users are in the "executive" role (not manager or user).

 

Here's my use case...I'm trying to allow customer portal users to edit some install addresses (custom fields) on the their Assets.  Naturally, I only want them to be able to modify their own Accounts' assets, and not any other assets.

 

Everything else regarding sharing rules seems to work okay.  They can only view their own accounts.  They can only view/create/edit contacts in their own accounts.  They can only view/create/edit cases in their own accounts.  And, when creating/editing cases, they can only pick contacts and assets from their own accounts.

 

BUT...even though I gave the Asset object Edit permission in the portal profile, when a portal user tries to Edit an asset, they get the dreaded "Insufficient Privileges" error.  And I'm not savvy enough with how sharing rules work to figure it out.

 

I might have to make my own customer controller without sharing, just to get around this, but I'd rather not do that if I can help it.

 

Is there something else with sharing I'm missing?  Thanks!

I posted another thread on the Sites forum dealing with an issue I'm having with our Customer Portal, but not getting much traction there, so am rephrasing the topic and posting here instead.

 

Basically, here's what I'm facing... we're using the Customer Portal so that our customers have access to Cases, Assets, etc. but there are some things Customer Portal users cannot do out-of-the-box, such as deleting Contacts or editing Asset data.  We want to give them as much self-service as we can in certain areas, and we DO want them to be able to delete unneeded Contacts, and edit some Asset information.  For example, one use case is we have asset install addresses on the Asset object they should be able to maintain.

 

Since you cannot assign the appropriate object permissions to a Customer Portal profile (even a custom one like we use), I'm trying to find out if I were to develop a custom controller and Visualforce page, could I circumvent the object permissions restrictions for customer portal users, and "do my own thing" with manipulating those objects?

 

For example, even though I cannot assign Asset object edit permission for a customer portal profile, could a custom controller and Visualforce page be used to let them edit Asset information, since the Apex code is running in some type of system context?  Or am I still going to run into problems because Visualforce might still be preventing them from doing something because of the object permissions?  It's my understanding Visualforce still enforces some of the object permissions even though the backend Apex is running in system context - is that correct?

 

Any ideas on how to do this would be greatly appreciated.  Thanks in advance!

I'm working on enhancing our customer portal, and one of the things we have exposed are the Contacts for a user's account.  Currently, customer portal users can view, create, and update Contacts, but I haven't found a way for them to delete Contacts.

 

I did a bunch of Google searches, but everything I found had to do with deleting actual customer portal user accounts, or enabling customer portal users to create other portal users, NEITHER of which is what I'm trying to do.  One thing I did notice is I'm unable to give Delete access to any objects for the customer portal profile we're using (which is a custom profile, not the standard one).

 

I'm just trying to find a way for customer portal users to be able to maintain their own contacts, and delete them if they're no longer needed, without having to open a case for us to delete them for them.

 

Assuming this is not possible out-of-the-box, can it be done with a custom Contact controller extension and Visualforce page?  Or would that not help, if I can't give Delete access to the Contact object, even a custom extension/VF page won't be able to delete them either?

 

Thanks in advance for any help with this!

I'm new to VF and Apex programming, but making good progress in building some custom pages and classes by Googling a lot.  But one thing I'm still trying to better understand is the transfer of values between the web browser, VF page, and the backend Apex class.

 

For example, if I have an input text field on a VF page, when a user inputs a value, or changes a value, in that field, at what point is that value actually "set" in the variable in the Apex class, and available for computations?

 

New/changed values seem to get transferred and set upon some sort of page refresh, or action, but I'm having a hard time finding documentation on exactly how the transfer of data occurs.  Please note, I'm not assuming there's any special event processing occurring on the field (such as onblur, onchange, etc), just interested in basic field input/output and when the values actually get transferred.

 

I hope this question is making sense...

 

Is anything like this covered in any Apex or VF documentation that maybe I missed?

 

Thanks!

I created a custom Visualforce page, and Apex controller, to provide a search page that anybody in our organization can use to search for data across three different custom objects.  Although I only want certain profiles to be able to create, edit, and delete these objects (which I've enforced in the profiles), anybody should be able to search, as the Apex class only does queries, it doesn't update anything.

 

I set all profiles to have security access to the Apex class and VF page.  I thought that by using "without sharing" in the Apex class, I wouldn't have to also explicitly set object/field access for the profiles, but the searches wouldn't return complete information until I did so.  The search works perfectly after I set that up.

 

I just wanted to confirm that even though I used "without sharing" I still have to set object/field access?  I'm new to developing Apex classes, so want to make sure I'm not missing something here.

 

Thanks!

I have been beating my head against the wall for hours trying to get this to work, and no luck.  I have some simple debug code in an Apex trigger that I'm trying to use to extract a series of six digits out of a serial number field.

 

But no matter how I code the pattern, it never matches.  Below is the sample code:

 

      String debugAssetSn = 'AA-104999';
      system.debug('debugAssetSn = ' + debugAssetSn);
      Pattern debugPatternAssetSnNumberOnly = Pattern.compile('([0-9]{6})');  // Why isn't this matching???
      Matcher debugMatcherAssetSnNumberOnly;
      debugMatcherAssetSnNumberOnly = debugPatternAssetSnNumberOnly.matcher(debugAssetSn);
      if (debugMatcherAssetSnNumberOnly.matches())
        {system.debug('Pattern DID match.');
         Integer debugAssetSnNumberOnly = integer.valueof(debugMatcherAssetSnNumberOnly.group(1));
         system.debug('debugAssetSnNumberOnly = ' + debugAssetSnNumberOnly);
        }
      else
        {system.debug('Pattern DID NOT match.');
        }

The Pattern.compile is very simple - Just a capture group of six digits.  But when I save the record and the trigger executes, it NEVER matches.

 

Even when I code the pattern compile as 'AA-104999' it never matches.  It always falls through to the debug 'Pattern DID NOT match' section.

 

Any thoughts would be GREATLY appreciated.  Thanks!

I have custom VF pages to display Case data for customer portal users, and I need to display the Articles (as in Salesforce Knowledge articles) attached to the case.  Articles can be displayed similar to a related list on standard page layouts, but I can't use those since all my pages are custom VF pages.

 

I thought I could use the "support:caseArticles" VF element, but it's displaying nothing for the customer portal user, no matter what options I use (and I am setting the caseId parameter).  I know the portal user has access to an attached article because he can see it in the "Articles" tab, and the article is enabled for access via the Customer Portal channel.

 

Is there something I'm missing?  Isn't this the purpose of the "support:caseArticles" element, to display attached articles to a case (and an optional search, but I don't care about the search part).  I did find the requirement to enable both Knowledge and Case Feed, which I did (the VF editor wouldn't even let me save the page until I'd enabled Case Feed).

 

Thanks

I'm having a heck of a time trying to get Customer Portal users to be able to edit their Accounts' Assets.

 

I've done all the following, but it hasn't helped:

 

  • Given my custom customer portal profile Edit access to the Asset object.
  • Profile is marked as portal super use, and has delegated privileges.
  • All portal users are in the "executive" role (not manager or user).

 

Here's my use case...I'm trying to allow customer portal users to edit some install addresses (custom fields) on the their Assets.  Naturally, I only want them to be able to modify their own Accounts' assets, and not any other assets.

 

Everything else regarding sharing rules seems to work okay.  They can only view their own accounts.  They can only view/create/edit contacts in their own accounts.  They can only view/create/edit cases in their own accounts.  And, when creating/editing cases, they can only pick contacts and assets from their own accounts.

 

BUT...even though I gave the Asset object Edit permission in the portal profile, when a portal user tries to Edit an asset, they get the dreaded "Insufficient Privileges" error.  And I'm not savvy enough with how sharing rules work to figure it out.

 

I might have to make my own customer controller without sharing, just to get around this, but I'd rather not do that if I can help it.

 

Is there something else with sharing I'm missing?  Thanks!

I posted another thread on the Sites forum dealing with an issue I'm having with our Customer Portal, but not getting much traction there, so am rephrasing the topic and posting here instead.

 

Basically, here's what I'm facing... we're using the Customer Portal so that our customers have access to Cases, Assets, etc. but there are some things Customer Portal users cannot do out-of-the-box, such as deleting Contacts or editing Asset data.  We want to give them as much self-service as we can in certain areas, and we DO want them to be able to delete unneeded Contacts, and edit some Asset information.  For example, one use case is we have asset install addresses on the Asset object they should be able to maintain.

 

Since you cannot assign the appropriate object permissions to a Customer Portal profile (even a custom one like we use), I'm trying to find out if I were to develop a custom controller and Visualforce page, could I circumvent the object permissions restrictions for customer portal users, and "do my own thing" with manipulating those objects?

 

For example, even though I cannot assign Asset object edit permission for a customer portal profile, could a custom controller and Visualforce page be used to let them edit Asset information, since the Apex code is running in some type of system context?  Or am I still going to run into problems because Visualforce might still be preventing them from doing something because of the object permissions?  It's my understanding Visualforce still enforces some of the object permissions even though the backend Apex is running in system context - is that correct?

 

Any ideas on how to do this would be greatly appreciated.  Thanks in advance!

I'm working on enhancing our customer portal, and one of the things we have exposed are the Contacts for a user's account.  Currently, customer portal users can view, create, and update Contacts, but I haven't found a way for them to delete Contacts.

 

I did a bunch of Google searches, but everything I found had to do with deleting actual customer portal user accounts, or enabling customer portal users to create other portal users, NEITHER of which is what I'm trying to do.  One thing I did notice is I'm unable to give Delete access to any objects for the customer portal profile we're using (which is a custom profile, not the standard one).

 

I'm just trying to find a way for customer portal users to be able to maintain their own contacts, and delete them if they're no longer needed, without having to open a case for us to delete them for them.

 

Assuming this is not possible out-of-the-box, can it be done with a custom Contact controller extension and Visualforce page?  Or would that not help, if I can't give Delete access to the Contact object, even a custom extension/VF page won't be able to delete them either?

 

Thanks in advance for any help with this!

I'm new to VF and Apex programming, but making good progress in building some custom pages and classes by Googling a lot.  But one thing I'm still trying to better understand is the transfer of values between the web browser, VF page, and the backend Apex class.

 

For example, if I have an input text field on a VF page, when a user inputs a value, or changes a value, in that field, at what point is that value actually "set" in the variable in the Apex class, and available for computations?

 

New/changed values seem to get transferred and set upon some sort of page refresh, or action, but I'm having a hard time finding documentation on exactly how the transfer of data occurs.  Please note, I'm not assuming there's any special event processing occurring on the field (such as onblur, onchange, etc), just interested in basic field input/output and when the values actually get transferred.

 

I hope this question is making sense...

 

Is anything like this covered in any Apex or VF documentation that maybe I missed?

 

Thanks!

I created a custom Visualforce page, and Apex controller, to provide a search page that anybody in our organization can use to search for data across three different custom objects.  Although I only want certain profiles to be able to create, edit, and delete these objects (which I've enforced in the profiles), anybody should be able to search, as the Apex class only does queries, it doesn't update anything.

 

I set all profiles to have security access to the Apex class and VF page.  I thought that by using "without sharing" in the Apex class, I wouldn't have to also explicitly set object/field access for the profiles, but the searches wouldn't return complete information until I did so.  The search works perfectly after I set that up.

 

I just wanted to confirm that even though I used "without sharing" I still have to set object/field access?  I'm new to developing Apex classes, so want to make sure I'm not missing something here.

 

Thanks!

I am building a custom search page. I need to pass the value entered in the input text to url parameter to exexcute the search. Right now if I manually enter search term in URL it will execute the search i.e. /apex/portalcasesearch?s=testsearchterm will return page with results for testsearchterm and the value of testsearchterm will show in inputextarea. So it seems I have it backwards at the moment. Is there a way to do this without using JavaScript or jQuery? Willing to start from scratch if anybody has an idea of how to accomplish this. I am a beginner so I may be missing a very fundamental aspect and just don't realize it. 

 

VF Page

<apex:page id="portalCaseSearch"
    standardController="User" 
    extensions="PortalCaseSearchUserContExt"
    title="Search ~ Customer Portal" 
    sidebar="false">

  <apex:stylesheet value="{!$Resource.Jquery_css}"/>

  <style type="text/css">
    .newCase{
        background-color: white;
        border-width: 2px;
        border-style: solid;
        z-index: 9999;
        left: 50%;
        padding:10px 10px 20px 10px;
        position: absolute; 
        //width: 800px;
        //height: 500px;
        margin-top: center;
        margin-left: -400px;
        top:100px;
    }
    .newCaseBackground{
        background-color:black;
        opacity: 0.20;
        filter: alpha(opacity = 20);
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 9998;
    }
  </style>
  
   <script type="text/javascript">
  function insertSearchParam(){
    var val = document.getElementById("{!$Component.searchinput}").value;
    document.location.search = "?s=" + val;
    searches();
}
document.getElementById("{!$Component.searchinput}").onkeypress = function(e){
    if (!e) e = window.event;  
    if (e.keyCode == '13'){
      insertSearchParam();
      return false;
    }
  }
</script>
  
  <body id="bodyPortalCaseSearch">
   <apex:form id="frmPortalCaseSearch">
    <apex:pageBlock id="pbPortalCaseSearch">

     <div class="table">
      <div class="tableRow">       
       <div id="searchDiv" class="tableCell">
         <apex:inputText id="searchinput" style="width:85%; height:25px;margin:0; padding: 0px 6px 0px;" title="Portal_Search_Phrase" value="{!portalSearchModel.searchTerm}"/>
         <apex:commandLink id="goSearch" title="Search"  style="text-decoration:none;" rerender="opResultsBlock">Search
             <apex:param name="searchTerm" value="{!portalSearchModel.searchTerm}"/>
         </apex:commandLink>

 

Controller:

 

public class PortalCaseSearchModel {
    
    public String searchTerm { get; set; }

    public transient QuestionSearch questionSearch { get; private set; }
    public transient QuestionFIMSSearch questionFIMSSearch { get; private set; }
    public transient QuestionAPSearch questionAPSearch { get; private set; }
    public transient ReplySearch replySearch { get; private set; } 
    public transient ReplyFIMSSearch replyFIMSSearch { get; private set; }
    public transient ReplyAPSearch replyAPSearch { get; private set; } 
    public transient SolutionSearch solutionSearch { get; private set; }
    public transient SolutionFIMSSearch solutionFIMSSearch { get; private set; }
    public transient SolutionAPSearch solutionAPSearch { get; private set; }
    public transient IdeaSearch ideaSearch { get; private set; }
    public transient IdeaFIMSSearch ideaFIMSSearch { get; private set; }
    public transient IdeaAPSearch ideaAPSearch { get; private set; }
    public transient CaseSearch caseSearch { get; private set; }
    public transient CaseFIMSSearch caseFIMSSearch { get; private set; }
    public transient CaseAPSearch caseAPSearch { get; private set; }
    public transient ContentSearch contentSearch { get; private set; }
    public transient ContentFIMSSearch contentFIMSSearch { get; private set; }
    public transient ContentAPSearch contentAPSearch { get; private set; }
    
    private final UserModel portalUserModel;
    
    public PortalCaseSearchModel(User portalUser) {
      final Map<String,String> urlParameters = ApexPages.currentPage().getParameters();   
        if(!urlParameters.containsKey('s')) {
          throw new PortalSearchException('No URL Parameters?!?');
        }
        
        if(urlParameters.size() != 1) {
          throw new PortalSearchException('More than two URL Parameters?!?');
        }
        
        this.searchTerm = urlParameters.get('s');       
        if(this.searchTerm.length() <= 1) {
          throw new PortalSearchException('Search Term has to be 2 characters or greater!');
        }
        this.portalUserModel = new UserModel(portalUser);        
        final DictionarySearch dictionarySearch = new DictionarySearch(this.searchTerm);

        
public void searches(){
    questionSearch.search();
    questionFIMSSearch.search();
    questionAPSearch.search();
    replySearch.search();
    replyFIMSSearch.search();
    replyAPSearch.search();
    solutionSearch.search();
    solutionFIMSSearch.search();
    solutionAPSearch.search();
    ideaSearch.search();
    ideaFIMSSearch.search();
    ideaAPSearch.search();
    caseSearch.search();
    caseFIMSSearch.search();
    caseAPSearch.search();
    contentSearch.search();  
    contentFIMSSearch.search();
    contentAPSearch.search(); 
}
    }