• InternalServerError
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 41
    Replies

 

Hi All, does anyone have a sample page to display a content tree? I have a requirement to display a content tree with links to vf pages based on a XML index. I haven't found any example. Would anyone who has worked with something like this be so kind to share a sample to help me get started?

 

Example:

 

http://wiki.efrontlearning.net/@api/deki/files/384/=content_tree_qg.png

 

Thanks in advance!

 

 

Hi All,

 

I am trying to update a field in a case with the number of KB Articles attached to the case after a KB article has been attached to the case.

 

The problem is that the object CaseArticle doesn't seem to be available for triggers. Also, when we add a KB article to a case this doesn't cause any DML operation on the case object so I creating a trigger on the case object wouldn't work. Any ideas?

 

Thanks

The code below rerenders the time on the "randompanel" but it doesn't shows the new value of the case status when clicking on the Reopen case button. The random panel and the NOW function were added just to test. The action {!ReOpenCase} sets the status of the case to "reopened" and this is happening but the rerender doesn't display that value. I opened a case with salesforce about this and is escalated to tier 3.....any ideas?

 

 

<apex:outputPanel id="randompanel" >
<apex:outputtext value="{!NOW()}"/>
<apex:outputtext value="{!case.status}"></apex:outputtext>

</apex:outputPanel>
<apex:form >

<apex:commandButton action="{!ReOpenCase}" value="Reopen Case" id="ReopenCaseButton" reRender="randompanel" rendered="{!IF(case.Status == 'Resolved' || case.Status == 'Closed',true,false)}"/>


</apex:form>

 

Thanks in advance for any help on this. I have spent a lot of time trying to make it work :(

Is there any tool similar to  generate classes from a json string in Apex?

 

I am looking something similar to this

 

http://jsonclassgenerator.codeplex.com/

 

 

Currently, with the code below, when a user clicks on the OK button, if there is a validation error the page refreshes, if not the record saves successfully and the user is redirected to another page. How can I avoid the page refresh without losing the validation message displaying on the page?.

 

Or, how can I force the user to select an option (this field is a picklist) to be able to click on the OK button, this would avoid having to deal with the validation.

 

VF:

 

<apex:message/>

<apex:inputField id="reasonres" required="true" value="{!case.Reason_Resolved__c}"  />
   
<apex:commandButton action="{!closecase}" value="OK"  />

 

controller:

 

public PageReference closecase() {
        
     caseobj.status='closed';
       
     if( caseobj.Reason_Resolved__c == null ) {
   
    caseobj.Reason_Resolved__c.addError('Please select a close reason');
    
     return null;
      }else{
      
       
     caseController.save();
     
      return Page.MySupport;}
       
     }

 

 

Thanks.

 

 

I am displaying the name of the asset on a page like this <apex:outputField id="CaseField3" value="{!Case.AssetId}"/>.

 

This displays the name of the asset as a link since this is a lookup relationship, therefore, the user can click on it and is taken to the asset page. I would like to prevent that from happening, is there a way to remove the hyperlink and just display the name? or at least don't do anything if the user clicks on the link ?

 

 

 

There is a standard field Asset (a lookup) in the case object. I am trying to display the name of the asset on the VF page using standard controller. This works for any other field but not for the asset name

 

{!case.AssetId} > returns ID

{!case.Asset.Name} > returns nothing 

 

What am I missing?

 

Thanks.

I want to rerender the currentstatus outputpanel when the reopened action has completed. The case is being reopened so the action succeeds but the outputpanel is not being refreshed. Any idea why?

 

Thanks in advance.

 

 

 

 

 <apex:outputPanel styleclass="caseStatus">
      <apex:outputPanel id="currentStatus" >     
         <p class="case details">{!case.Status}</p>     
      </apex:outputPanel>
      
     
    
      <apex:form >
         <apex:commandButton action="{!ReOpenCase}" value="Reopen Case" oncomplete="alert('case reopened')" id="ReopenCaseButton" rerender="currentStatus" rendered="{!IF((case.status == 'Resolved' || case.Status == 'Closed')&&case.closeddate+30>now(),true,false)}" />
         <apex:commandButton value="Close Case"  id="CloseCaseBTN" onclick="openCloseReason()" rendered="{!IF(case.Status != 'Resolved' && case.Status != 'Closed',true,false)}"/>
      </apex:form>


.....

 

   </apex:outputPanel>

Hi all,

 

Does anyone know a workaround to this?

 

error  

 

<apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.>

 

 

 

Any ideas in how to rerender that section?

 

<apex:commandButton value="TESTUPLOAD" action="{!saveAttach}" rerender="attachmentList"/>
                
              
             

            </span>    

        </apex:pageBlock>
    </apex:form>
    <apex:outputpanel id="attachmentList"  > 
    <apex:pageBlock title="{!$Label.Files}"  >
        <apex:pageBlockTable value="{!attachments}" var="attachment" >
            <apex:column headerValue="{!$Label.Action}">
               <apex:outputLink value="{!URLFOR($Action.Attachment.Download, attachment.Id)}" target="_blank">{!$Label.View}</apex:outputLink>
            </apex:column>
            <apex:column value="{!attachment.Name}"/>
            <apex:column value="{!attachment.Description}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
  </apex:outputpanel>  
  

</apex:component>


 

 

Thanks.

Hi All,

 

I remember reading somewhere that as a best practice one should avoid creating multiple triggers on the same object and instead should have a single trigger invoking a class or classes. What is the reason for this? We currently have about 5 triggers on some objects and this could probably increase, it seems to be more organized to have a different trigger (with a descriptive name) for specific operations. Can anyone advise on this ? 

 

Thanks

 

 

 

We have many classes on our org, some of them were developed many years ago and there is one that it looks like is a bit outdated and has 0 % code coverage, I have the feeling that is not in use and could be deleted, is there any way to check if this class is in invoked by a trigger or anywhere else?

 

Thanks.

I am getting this error when viewing a case my page is very simple using the case standard controller, no extensions.

 

Note: These related list have been added to all the page layouts.

 

 

 <apex:relatedList list="EmailMessages"/>

 

Any ideas?

Hi all,

 

I recently created a trigger that inserts/updates some values taken from one record into another record on another object and this is working fine. However, some of the fields in the "source" object are not required, therefore very often some of these fields are blank. This causes the fields on the target record to be inserted with a value saying "null" which doesn't look good.

 

What is the best way of avoiding the 'null' text to appear when the source field has no value?

 

I know I could create many IF statements to insert certain fields only when they are not null but if I have many field this would get very messy....

 

Thanks in advance

So we are working on the new live agent with sites and for this we created a vf page for the pre-chat form.

 

We want to automatically populate that name and email address from the details of the authenticated (customer portal user) so that the user doesn't have to enter the all  detail on the pre chat form I did something like this

 

<apex:page>
    Hello {!$User.FirstName}!
</apex:page>

 

The problem is that even if the user is logged in, the page is retrieving  the details of the Guest user and I don't understand why.

 

So even if I am logged in the customer portal as TestUser, the page returns "Hi guestuser". What is the logic behind this, how can I sure that the authenticated session is passed to any page?

 

 

Thanks in advance.

 

Hi All,

 

Some users are experiencing errors with the CTI adapter, the CTI keeps crashing. The browser connects logs say the following

 

CIEEventHandler::UpdateSoftphone: COM error while replacing inner html: Access is denied.

 

Does anyone know the meaning of this error or possible causes?

 

Thanks in advance.

Hey guys, I have created a test class, I am  new to apex code so I have been taking a bit from here and there. Basically the first part of the class works but the bulk validation is not working I want to use system.assertequals to verify that the value on the update field is equal to the expected value, how do I do this with a list of records

 

This is the test class, the part that is not working is commented at the end. The error I am getting when running the test is System.AssertException: Assertion Failed: Expected: 005d0000000jTxVAAU, Actual: null  I think I know the reason for the error I just dont know how to bulk validate the value returned as I did with the single validation.

 

Many thanks in advance.

 

@isTest(SeeAllData=true)

private class TestClassCaseLookupTrigger {

    /* Tests a user creating a case and then updating the owner to a queue,
    then updates the ownership from a queue to another user,
    this should cause the lookup field New_Owner__c be updated with the same id as the new owner*/

    //Tests single and mass updates
    
    static testMethod void singleandmassupdates() {
                  
              
       
        
        List<Queuesobject> queues=[SELECT Queue.Name, QueueId FROM QueueSobject 
                   WHERE SobjectType = 'Case'];
        
        Map<String,String> CaseQueues = new Map<String,String>{};
        for(QueueSobject q:queues)
            Casequeues.put(q.Queue.Name,q.QueueId);
            
            
        List<User> userlist=[SELECT Alias, Id FROM User 
                    WHERE UserType != 'CSNOnly' AND IsActive = TRUE];
        Map<String,String> usermap= new map<string,string>{};
        for(User us:userlist)
            usermap.put(us.Alias,us.Id);
            
        //Set up user 
            User testuser = [SELECT Id FROM User WHERE Alias='cbrow'];
            
        //Run as test user
        System.RunAs(testuser){

            
        System.debug('Inserting a case..');
        
        //creating and updating a single case
        
        Case testCase = new Case(status = 'New', Origin='Phone');
        insert testCase;
        System.debug('Changing ownership to queue..');
        testCase.ownerid=CaseQueues.get('L1 EMEA Queue');
        update testCase;
        System.debug('Changing ownership to another user..');
        testCase.ownerid=usermap.get('BChir');
        update testCase;
        
        Case result = [select New_Owner__c from Case where Id = :testCase.Id];
        System.assertEquals(usermap.get('BChir'),result.New_Owner__c);
        
        
       System.debug('Inserting and updating 200 cases...bulk validation');
             
       List<Case> testCases = new List<Case>();
        for(integer i=0; i<200; i++) {
            testCases.add( new Case(status ='New',Origin='Phone',Ownerid=usermap.get('BChir')) );
        }
        insert testCases;
        
        //change the ownership from a queue to a user on list of cases created before 
        
        for(integer i=0; i<200; i++) {

        testCases[i].OwnerId=CaseQueues.get('L1 EMEA Queue');
        }
        
        update testCases;
        
        
        for(integer i=0; i<200; i++){
        
        System.assertEquals(usermap.get('BChir'),TestCases[i].New_Owner__c);  //this is not working
        }
     }
    
   }
  
  }

I have a test deployment of live agent that works on a vf page.

 

As soon as I try to set a name for the visitor in the code the button stops working (no offline or online version) any ideas ?

 

The button works again as soon as I remove the liveagent.setName(‘John Doe’); line

<script type='text/javascript'>
liveagent.setName(‘John Doe’);
liveagent.init('https://d.la2.salesforceliveagent.com/chat', '572200000000006', '00D20000000CHA7');
</script>

Trying to modify the text formatting in the Screens by overriding a default setting of the CSS class. As an experiment, just trying to set text color to red. Found the class name using Chrome's Developer Tools. (Also modified the buttons, successfully based on an example given on the message board here.)

 

Text doesn't change to red - what am I missing?

 

Thanks!

Ed

 

<apex:page >

<style type="text/css">
.bPageBlock .pbBottomButtons .pbButtonb .btn { 
  color: #808080;
  display: inline;
  float: left;
  font: bold 16px arial, sans-serif;
  height: 24px;
}
</style>

<p style="color: #808080; font-size: 175%; font-weight: bolder; margin-top: 0.3em; margin-bottom: 0.2em">
  DH Interface Designer
</p>

<style type="text/css">
.theflow {
  color: #ff0000;
}
</style>
 
<div id="theflow">
  <flow:interview name="GP3_FLOW_9_1_12" buttonLocation="bottom" />
</div>
 
</apex:page><apex:page >

<style type="text/css">
.bPageBlock .pbBottomButtons .pbButtonb .btn { 
  color: #808080;
  display: inline;
  float: left;
  font: bold 16px arial, sans-serif;
  height: 24px;
}
</style>

<p style="color: #808080; font-size: 175%; font-weight: bolder; margin-top: 0.3em; margin-bottom: 0.2em">
  DH Interface Designer
</p>

<style type="text/css">
.theflow {
  color: #ff0000;
}
</style>
 
<div id="theflow">
  <flow:interview name="GP3_FLOW_9_1_12" buttonLocation="bottom" />
</div>
 
</apex:page>

 

Hello,   I have a requirement to delete entries to the Activity History after a period of time.  From looking at the following 

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_activityhistory.htm

 

I can select and view Activity history details using SOQL.  

 

SELECT (SELECT ActivityDate, Description FROM ActivityHistories)
FROM Account
WHERE Name Like 'XYZ%'

 

I cannot select from ActivityHistories itself though

 

E.g. "SELECT ActivityDate, Description FROM ActivityHistories"  does not seem to be allowed

 

If I want to retrieve from ActivityHistories (using SELECT ActivityDate, Description FROM ActivityHistories for example.   Then delete these entried based on logic relating to the date on when they were created or activitydate, does anyone know if this can be done?

 

The following article details how to delete activities http://na14.salesforce.com/help/doc/en/activity_del.htm   but I think this means having manual deletions

 

is there a way to delete activities via Apex code, or even a scheduled task or scheduled process of some type via configurations?  We would need to check on the date and delete all activities (of email for example) after a a period of time.

 

Thanks in advance.

Hi All,

 

I am trying to update a field in a case with the number of KB Articles attached to the case after a KB article has been attached to the case.

 

The problem is that the object CaseArticle doesn't seem to be available for triggers. Also, when we add a KB article to a case this doesn't cause any DML operation on the case object so I creating a trigger on the case object wouldn't work. Any ideas?

 

Thanks

I want to make a record read only based on the record type to all profiles except system admin.How to achieve this.

 

For eg. I have a record type "Candidate".For all the records which have candidate as record type should be read only to all profiles except system admin.

I am new to developing for Salesforce but I am almost positive this is a bug in their software.

 

I am trying to do a SOQL query through a parent-to-child relationship.  I have a cusom object called "Advisory Board History" with an API Name of "Advisory_Board_History__c" that is a child to a normal Contact.  Simple enough, here's my query:

 

"SELECT Name,
(
SELECT CreatedBy.Name
FROM Advisory_Board_History__r
)
FROM Contact"

 

But, it doesn't work!  It took me a while to arrive at this query too, I thought that using the "__r" instead of the normal "__c" to access the custom object through the API was smart, but alas...

 

I poked around but couldn't figure out how to fix it.  I wasn't sure if something with my syntax is wrong (again, I'm new to this), but then I went through my WSDL file (enterprise) and looked up the elements under Contact.  I found this as one of the elements:

 

<element name="Advisory_Board_Meetings__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>

 

Wait!  "Advisory_Board_Meetings__r" isn't equal to "Advisory_Board_History__r", that must be the problem!  If I substitute the "Advisory_Board_Meetings__r" API name, then the query works perfectly.  

 

BUT, I am 100% completely sure that the custom object I created is called "Advisory_Board_History__c".  It *used* to be called "Advisory_Board_Meetings__c", but then I changed it.  That change happened over 3 weeks ago, so I can't imagine that it hasn't propagated or something.

 

 

I tried changing the API name of the custom object and saving it.  The API name updates in SF and elsewhere in the WSDL (where it's called "Advisory_Board_History__c"), but NOT as a child elemet of the Contact complexType.  For example, if I change the API name to "Advisory_Board_Historyz", then it is correctly updated on SF.com and I get the following lines in my WSDL:

 

this: <complexType name="Advisory_Board_Historyz__c">...

BUT STILL: <element name="Advisory_Board_Meetings__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>

 

 

I also tried removing the "Advisory Board Historyz" custom object from my Contact page layout, saving, re-adding it, saving, and then regenerating my WSDL.  Same outcome.  

 

Unless this is some really bad feature in SF, I believe this is a bug.  Put concisely, when you update the API name of a custom object, the custom object API path name (__c) is changed normally, but the custom *relationship* API path name (__r) is NOT.

 

Fortunately, I can live with this.  But if this is a bug then I want to see it fixed!  Thanks, please let me know if you have any questions.

Steps to reproduce:

 

1) Create a Task workflow rule that runs every time a record is created or edited and have the criteria be an all encompassing one (I have 1=1)

2) Have the workflow rule send an outbound message.

3) Send an email from a contact or custom object that relates to contacts.

4) No outbound message is sent. However, if you edit the email in salesforce it will then send an outbound message.

 

 

  • August 21, 2012
  • Like
  • 0

Hi all,

 

Can http request handle https URL in the request body? Does it show any eror while sending request/receiving response.

 

 HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
        
        userId = userInfo.getUserId();
        orgId = userInfo.getOrganizationId();
        
        String URL = 'https://sample.com?&orgid='+orgid+'&userid='+Userid;
        System.debug('URL is:'+URL);
        req.setMethod('GET');
        req.setEndpoint(URL);
        req.setHeader('content-type','text/html');
        
        system.debug(req.getMethod());
        system.debug(req.getEndpoint());
        system.debug(req.getbody());
        
        try {res = http.send(req);}

Whether it produce any error in future. 

 

Thanks

  Marris

Hi,

 

I've a visualforce page that embedded with flow using <flow:interview> tag. My flow running correctly on salesforce.com environment. In this flow there is Record Create element. This flow can create Contact and Custom Object named Registration.

I've also set up Site so that visitor can running this flow. I've also set the public access setting for this site that allow user to read and create standard and custom object.

The problem is when visitor have reached step 6 / 7 and hit Next button there is error message about authentication. From what I've seen is that the error occurs when Custom Object is created from Record Create element in the flow. But what makes it bizzare is the flow running smoothly on salesforce.com Flow manager

Below is my site link so that you guys can help me troubleshoot this issue.

 

http://blueberry-services-developer-edition.na9.force.com/EventRegistration

 

Thanks & Regards

 

Currently, with the code below, when a user clicks on the OK button, if there is a validation error the page refreshes, if not the record saves successfully and the user is redirected to another page. How can I avoid the page refresh without losing the validation message displaying on the page?.

 

Or, how can I force the user to select an option (this field is a picklist) to be able to click on the OK button, this would avoid having to deal with the validation.

 

VF:

 

<apex:message/>

<apex:inputField id="reasonres" required="true" value="{!case.Reason_Resolved__c}"  />
   
<apex:commandButton action="{!closecase}" value="OK"  />

 

controller:

 

public PageReference closecase() {
        
     caseobj.status='closed';
       
     if( caseobj.Reason_Resolved__c == null ) {
   
    caseobj.Reason_Resolved__c.addError('Please select a close reason');
    
     return null;
      }else{
      
       
     caseController.save();
     
      return Page.MySupport;}
       
     }

 

 

Thanks.

 

 

I am displaying the name of the asset on a page like this <apex:outputField id="CaseField3" value="{!Case.AssetId}"/>.

 

This displays the name of the asset as a link since this is a lookup relationship, therefore, the user can click on it and is taken to the asset page. I would like to prevent that from happening, is there a way to remove the hyperlink and just display the name? or at least don't do anything if the user clicks on the link ?

 

 

 

There is a standard field Asset (a lookup) in the case object. I am trying to display the name of the asset on the VF page using standard controller. This works for any other field but not for the asset name

 

{!case.AssetId} > returns ID

{!case.Asset.Name} > returns nothing 

 

What am I missing?

 

Thanks.

I don't have much credit finding this weird thing but I wanted to know if it's a bug or if it's really intended, which I cannot imagine. 

copy paste from this blog: http://blog.tquila.com/2012/06/25/grokking-force-dot-com-apex/

 

"Unit Tests increment your Objects unique Id

This is not covered in the documentation, or atleast I haven’t found it in the Apex docs. When you run unit tests that insert/create records for a particular object(standard or otherwise), it increments the value of the Name field(of type Auto Number) outside of the test context.

Let’s say you have a custom object “Invoice Statement” (Invoice_Statement__c) that has a Name field called “Invoice Number”, and is of type “Auto Number”. The format of the field is: INV-{0000}, and let’s assume that the latest record number is INV-2058.

If you insert 10 records in the test class as follows:

 

1// Let's assume that this runs inside of a test method
2List<Invoice_Statement__c> invStatementList = new List<Invoice_Statement__c>();
3for(Integer i = 0; i < 10; i++) {
4  invStatementList.add(new Invoice_Statement__c(company='acme ltd');
5}
6insert invStatementList;

 

Now, when you insert a new Invoice Statement record outside of the test method via a trigger, or batch, or the User Interface, the next inserted record will have the id INV-2069. So don’t rely on the unique name field if you have strict rules around the auto-increment feature in your application. Instead add a custom field which is auto-incremented in a workflow or trigger to have more granular control over how the value is incremented."

 

I verified that by myself, and this indeed happen. I remember having used these numbers for customer who want to have exactly one unique number per record (especially for bills), so this could be a huge issue.

 

Anyone aware of that? I didn't find it in the Salesforce known bug ....

I figured out how to start it, but I am doing it from a button. How do i end it that way? It'd be nice if it didn't loop back around.

I am using inputfile component in VF page to upload file bt its working  and giving me error like :

 

 apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

 

 

I am using Rerender attribute in VF page ..If I removes that it works fine .

 

Please provide me some input ..