• newbie2010
  • NEWBIE
  • 50 Points
  • Member since 2010

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 22
    Replies

I have created a vf page that creates a Service Call Task and posts the call details as Chatter feed on the related Account.  So the comments in the Service Call Task is what shows up in the Chatter feed which looks like this...

 

Jan Holder Need to update contract number.

 

I am wondering if we have enough access to control a feed item to make it look like this...

 

Service CallJan Holder Need to update contract number.

 

Where we can show where the feed came from.  Similar to the way it shows up in the users feed.

 

Can we manually put an icon/image/graphic in a chatter post?

I wasn't sure where to post this given the amount of info involved.  I have created a custom "log a call" page using a vf page attached to a button in the account layout.  I have this setup and running correctly in my sandbox environment when I am logged in (system admin).  When I login as anothe user it works correctly as well, but when I have a user login directly to the sandbox to test it generated the following exception...

 

Force.com Sandbox

Apex script unhandled exception by user/organization: 00540000000oRuq/00DQ0000000Db4h Source organization: 00D40000000Iqhe (null) Visualforce Page: /apex/Log_A_Call_in_Chatter

 

 

caused by: System.QueryException: List has no rows for assignment to SObject

Class.LogACallControllerExtension.getAccount: line 8, column 17 External entry point

 

Since this acutally posts items in Chatter, I don't want to move it over to production yet since I don't want any bogus information in our production org from testing to make sure it is working.  The vf page, controller and button URL are as follows...

 

<apex:page standardController="Task" extensions="LogACallControllerExtension" showHeader="false" sidebar="false">
<script>
  function refresh(){
   window.close();
   }
</script>
    <apex:sectionHeader title="Log A Call for..."/>
    <apex:form id="pageForm">
        <apex:pageBlock title="{!account.name}" mode="edit">
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}" onclick="refresh()" />
                <!--<apex:actionSupport event="onclick" action="{!CreatePost}" /> -->
                <apex:commandButton value="Cancel" action="{!cancel}" onclick="refresh()"/>
            </apex:pageBlockButtons>
            <br />
            <apex:pageBlockSection title="Call Information">
                <apex:inputField value="{!Task.Description}" style="width:400px;height:100px;" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

public with sharing class LogACallControllerExtension {

    public Task task {get; set;}
    public String CallInfo {get; set;}
    ApexPages.StandardController controller;
    
    public Account getAccount() {
         return [SELECT Id, name from Account
             WHERE Id=:ApexPages.currentPage().getParameters().get('what_id')];
    }

    public LogACallControllerExtension(ApexPages.StandardController controller) {
            task = (Task)controller.getRecord();
            task.whatId = ApexPages.currentPage().getParameters().get('what_id');    
            task.subject = 'Service Call';
            task.type = 'Call';
            task.status = 'Completed';
            task.activitydate = Date.today();
//            task.description = CallInfo;
    }
    public PageReference Save()
    {
        FeedItem cpost = new FeedItem();
        cpost.ParentId = ApexPages.currentPage().getParameters().get('what_id');
        cpost.Body = task.description;
        try{
          insert(task);
          insert cpost;
          }
        catch(System.DMLException e){
          ApexPages.addMessages(e);
          return null;
          }
          return(new ApexPages.StandardController(task)).view();
    }
}

 

/apex/Log_A_Call_in_Chatter?title=Call&what_id={!Account.Id}&followup=1&tsk5=Service Call&retURL=%2F{!Account.Id}&tsk3={!Account.Name}&tsk10=Call

 I am guessing there are some rights involved, but I wasn't aware that the system sees us differently when logged in as someone compared to that person logged in themselves.  Any suggestions on improvement to the code is welcomed as well.

I have created a custom VF Page generated by a custom button on the account page that creates a "log a call" activity as a completed task.  The comment field is the only thing that shows on this VF Page so all they have to do is enter the details of the call and the rest of the details are done internally, i.e. related to account where button was selected, inserts subject, date, type,etc.  The account info is pulled from the URL associated with the button.

 

Is it possible to create a chatter feed on the related account from what the user entered in the comment field?  Is there some documentation somewhere on how to accomplish this?

 

Thanks in advance for any help...

I have created the following VF Page and controller extension to create, what is basically, a pop up of the comments field for logging a call.  This is assigned to a button as a URL on the Account page.  The idea is that everything is assigned within the controller while displaying just the comment box to enter info from the call.  Right now as it is currently written I can fill in everything I need except the account that the "log a call" is related to.  I am passing the account id through the URL in the button.  Any suggestions on how to grad the account id from the URL and make that the account it is related to would be great.

 

VF Page

<apex:page standardController="Task" extensions="LogACallControllerExtension" showHeader="false" sidebar="false">
    <apex:sectionHeader title="Log A Call" />
    <apex:form id="pageForm">
        <apex:pageBlock title="Call Edit" mode="edit">
            <apex:pageBlockButtons location="both">
                <apex:commandButton value="Save" action="{!save}" />
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
            <br />
            <apex:pageBlockSection title="Call Information" columns="1" collapsible="false">
                <apex:inputField value="{!Task.Description}" style="width:400px;height:100px;" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 Controller Extension

public with sharing class LogACallControllerExtension {

    public Task task;
    ApexPages.Standardcontroller controller;
    
                public Account getAccount() {
                    return [SELECT Id, Name from Account where Id=:ApexPages.currentPage().getParameters().get('what_id')];
                }

    public LogACallControllerExtension(ApexPages.StandardController controller) {
            this.task = (Task)controller.getRecord();
            this.task.subject = 'Service Call';
            this.task.type = 'Call';
            this.task.status = 'Completed';
            this.task.activitydate = system.today();
            this.controller = controller;
    }
    public PageReference save() {
          return controller.save();
    }

}

 Button URL

/apex/Log_a_Call_in_Chatter?title=Call&what_id={!Account.Id}&followup=1&tsk5=Service Call&retURL=%2F{!Account.Id}&tsk3={!Account.Name}&tsk10=Call

 I have tried pulling the name from the URL that is assigned to 'tsk3', but it is giving me an error trying to assign a 'name' to a 'string'.

 

I am also wondering if it would be possible to take what is entered in the comment field and post that as a feed in the related account.

Is it possible to have a quick "Log a Call" on the sidebar, similar to the "Quick Create" for the contact, account, etc.?

 

Would it be possible to have a drop down box that listed the lookup you wanted to use(i.e. lead, contact, account) so you could select the record you want to attach the call to, or have all those lookups included and it would attach the "call" to all the records listed?

 

Call type and date would be the other two fields associated with the quick create.

 

Obviously this would be just to show that you made a phone call to certain contact, account, etc, the type of call and when it was made.  Similar to the quick create already in use it could display a link to the successfully created activity in case there is a need to include more details.

I have created a custom web form to enter information into a custom object. Everything works great except for the submit button. We recently had someone enter two identical records almost immediately so I went into our sandbox to test my theory and, unfortunately, I was correct...if you click the submit button multiple times before the page processes and redirects to the thank you page it will generate multiple identical records based on the number of times the button was clicked. Is there anything that can be done to ignore the multiple clicks and process only one record instead of duplicating it?

 

 

Thanks!!

I have a webform that enters data into a custom object in salesforce.  If I don't redirect to a thank you page all of the exceptions get handled automatically showing the visitor they entered data incorrectly or they are missing data and it shows this message under the field in question, but redirects them to a page that says they don't have the rights to view this page.  Once I add the class extension to redirect the page to a thank you page on submittal all that goes out the window.  If any error occurs with this in place, the form pops back up with no message at all leaving the visitor to guess what they have done wrong.  Is it possible to write exception handlers to mimic my first scenario so I can tell the visitor what is missing or incorrect at the corresponding field while also redirecting them to a thank you page?

 

Thanks!!

I have written my first class, class test and trigger.  I am currently working on the test code for the trigger, but in the meantime I was wondering if anyone out there would give me some pointers on what I have already created...

 

The class extension code is below, followed by the test code that I wrote...

 

public class myWeb2TransExtension { private final Transmittal_WebForm__c webtrans; public myWeb2TransExtension(ApexPages.StandardController stdController) { webtrans = (Transmittal_WebForm__c)stdController.getRecord(); } public PageReference saveTransmittal_WebForm() { try { insert(webtrans); } catch(System.DMLException e) { ApexPages.addMessages(e); return null; } PageReference p = Page.TransmittalThankYou; p.setRedirect(true); return p; } }

 

@isTest private class Web2TransTests { static testMethod void saveWebTransOK() { // Populate Transmittal WebForm Transmittal_WebForm__c t = new Transmittal_WebForm__c( MSS_CAA_Name__c='testmss', Lead_Source__c='Current', County_Office__c='testcounty', Contract_Number_SSN__c='000000000', Farm_Bureau_Member_Number__c='123456', First_Name__c='testfirst', Street_Address__c='testaddress', Middle_Initial__c='testmiddle', City__c='testcity', Last_Name__c='testlast', Zip_Postal_Code__c='55555', Email_Address__c='testemail', Phone_Number__c='3333334444', Type_of_Transaction__c='new', Product_Type__c='PHC', Product_Subtype__c='Premier'); test.startTest(); // Instantiate a Controller Extension myWeb2TransExtension ext = new myWeb2TransExtension(new ApexPages.StandardController(t)); // Call the saveTransmittal_WebForm method PageReference pr = ext.saveTransmittal_WebForm(); test.stopTest(); // Make sure that everything works correctly and redirects to Thank You Page system.assertEquals(Page.TransmittalThankYou.getUrl(),pr.getUrl()); } static testMethod void saveWebTransKO() { // Populate Transmittal WebForm Transmittal_WebForm__c t = new Transmittal_WebForm__c( Lead_Source__c='Current Customer', County_Office__c='testcounty2', Contract_Number_SSN__c='333224444', Farm_Bureau_Member_Number__c='234567', First_Name__c='testfirst2', Street_Address__c='testaddress2', Middle_Initial__c='testmiddle2', City__c='testcity2', Last_Name__c='testlast2', Zip_Postal_Code__c='77777', Email_Address__c='testemail@2.com', Phone_Number__c='2223334444', Type_of_Transaction__c='new', Product_Type__c='PHC', Product_Subtype__c='Coreshare'); test.startTest(); // Instantiate a Controller Extension myWeb2TransExtension ext = new myWeb2TransExtension(new ApexPages.StandardController(t)); // Call the saveTransmittal_WebForm method PageReference pr = ext.saveTransmittal_WebForm(); test.stopTest(); // Make sure that everything works correctly and redirects to Thank You Page system.assertEquals(null,pr); } }

 

It is a simple class extension and test code that I was, thankfully, about to figure out with the help of this discussion board.  Even though I have been able to get the required 75% code coverage with this test code, I was wondering if I could get some pointers/best practices on how to accomplish 100% code coverage and/or better ways to write the code itself.

 

Thanks!

I am not sure if that is the correct terminology, but here it goes...I created two custom objects in SF.  One is populated from a webform and the other is created from the one populated by the webform.  I am at a point where i am not sure what is the best process to accomplish this procedure.  I need to take into consideration the possibility that multiple webforms will be filled out at one time so the Trigger needs to be able to handle multiple items on an ongoing basis.  I am having a tough time deciding how to set this up...all the examples/suggestions/solutions are based instances of objects that are already created and are just updating fields within a certain instance based on a set of criteria.  I need to know how to create a new instance of one object based on the instance of another object once it is inserted from the webform.

 

Any help is greatly appreciated.

I have a custom object (we will call this one external) that is being populated through a webform.  I have another custom object (we will call this one internal) that is is being created with the data entered into the webform.  The reason for this is there are two master-detail relationships on the internal custom object that would not be accessible on an external site.  These two master-detail relationships are short/controlled lists of objects so I have entered them as picklists on the external object so there is no way to select somehting other than the select group of items we want.  Once the webform has been submitted and the external custom object has been created I need to pass that data to the internal custom object and make the master-detail connections based on the values in the picklists.  I need to create a Trigger to do this and have never created one so I don't even know where to begin.  I have looked through the documentation, but there aren't any examples of this nature so I am not sure how to begin coding this.

Is it possible to remove the search feature from the header on a site without removing the rest of the header?

 

Can you change the "Home" in the tab across the top?  I am only using two pages for this site, a form page and a thank you page. I would like the "Home" link to take me to the form page whether I am on the form page or the thank you page.

 

Can you add another link in the same area as the "Home" link to go to a self-service portal?

I wasn't sure exactly where to post this so hopefully somebody will see it here and be able to help.

 

Can you make a program that is open on your computer active and pass a value to it using a button on an account?

I am trying to implement a page in my Production Org that i developed in my Sandbox Org.  However, I ran into some issues getting anything to come up on the internet so I went back and created the same basic page for both orgs.  Any change that I make to the site in my Sandbox Org is immediately updated, but that is not the case in the Production Org.  The only difference being that I have CMSForce2 installed in my Sandbox Org with the catch that it is just a VF page that I am using in both scenarios.  I am not even using CMSForce2 to implement the page in my Sandbox Org, but that seems to be the only difference.  I guess I am curious as to if CMSForce2 implements changes in the Org to allow for easier iplementation of sites in general regardless of whether you actually use the tool or use a straight VF page.

I am trying to develop a webform for a custom object and have the following situation.  The custom object is linked to multiple standard objects and other custom objects.  We have a set group of people that will be using this form.  Each person is a contact in our salesforce system and this custom object has a master-detail relationship to that contact record type.  My dilemma at this point is that I need to have an Id value associated with this reference field(master-detail to contact) in the webform and I am at a loss as to what needs to go in there.  Ideally it would be based on the person entering the data, but not the same person would be entering the data as it is a general access form.  Each of these records will be "approved" by someone internally and can make the master-detail assignment at that point if necessary, but can't figure out a way around the field as it is a required field and it won't let me create the webform without it.  Is it possible to create a webform where these people can go put a number that is associated with only them in and it pulls certain pieces of information from SF?

 

I know this is a lot in one message, but I need help desperately.

I wasn't sure where to post this given the amount of info involved.  I have created a custom "log a call" page using a vf page attached to a button in the account layout.  I have this setup and running correctly in my sandbox environment when I am logged in (system admin).  When I login as anothe user it works correctly as well, but when I have a user login directly to the sandbox to test it generated the following exception...

 

Force.com Sandbox

Apex script unhandled exception by user/organization: 00540000000oRuq/00DQ0000000Db4h Source organization: 00D40000000Iqhe (null) Visualforce Page: /apex/Log_A_Call_in_Chatter

 

 

caused by: System.QueryException: List has no rows for assignment to SObject

Class.LogACallControllerExtension.getAccount: line 8, column 17 External entry point

 

Since this acutally posts items in Chatter, I don't want to move it over to production yet since I don't want any bogus information in our production org from testing to make sure it is working.  The vf page, controller and button URL are as follows...

 

<apex:page standardController="Task" extensions="LogACallControllerExtension" showHeader="false" sidebar="false">
<script>
  function refresh(){
   window.close();
   }
</script>
    <apex:sectionHeader title="Log A Call for..."/>
    <apex:form id="pageForm">
        <apex:pageBlock title="{!account.name}" mode="edit">
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}" onclick="refresh()" />
                <!--<apex:actionSupport event="onclick" action="{!CreatePost}" /> -->
                <apex:commandButton value="Cancel" action="{!cancel}" onclick="refresh()"/>
            </apex:pageBlockButtons>
            <br />
            <apex:pageBlockSection title="Call Information">
                <apex:inputField value="{!Task.Description}" style="width:400px;height:100px;" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

public with sharing class LogACallControllerExtension {

    public Task task {get; set;}
    public String CallInfo {get; set;}
    ApexPages.StandardController controller;
    
    public Account getAccount() {
         return [SELECT Id, name from Account
             WHERE Id=:ApexPages.currentPage().getParameters().get('what_id')];
    }

    public LogACallControllerExtension(ApexPages.StandardController controller) {
            task = (Task)controller.getRecord();
            task.whatId = ApexPages.currentPage().getParameters().get('what_id');    
            task.subject = 'Service Call';
            task.type = 'Call';
            task.status = 'Completed';
            task.activitydate = Date.today();
//            task.description = CallInfo;
    }
    public PageReference Save()
    {
        FeedItem cpost = new FeedItem();
        cpost.ParentId = ApexPages.currentPage().getParameters().get('what_id');
        cpost.Body = task.description;
        try{
          insert(task);
          insert cpost;
          }
        catch(System.DMLException e){
          ApexPages.addMessages(e);
          return null;
          }
          return(new ApexPages.StandardController(task)).view();
    }
}

 

/apex/Log_A_Call_in_Chatter?title=Call&what_id={!Account.Id}&followup=1&tsk5=Service Call&retURL=%2F{!Account.Id}&tsk3={!Account.Name}&tsk10=Call

 I am guessing there are some rights involved, but I wasn't aware that the system sees us differently when logged in as someone compared to that person logged in themselves.  Any suggestions on improvement to the code is welcomed as well.

I have created a custom VF Page generated by a custom button on the account page that creates a "log a call" activity as a completed task.  The comment field is the only thing that shows on this VF Page so all they have to do is enter the details of the call and the rest of the details are done internally, i.e. related to account where button was selected, inserts subject, date, type,etc.  The account info is pulled from the URL associated with the button.

 

Is it possible to create a chatter feed on the related account from what the user entered in the comment field?  Is there some documentation somewhere on how to accomplish this?

 

Thanks in advance for any help...

I have created the following VF Page and controller extension to create, what is basically, a pop up of the comments field for logging a call.  This is assigned to a button as a URL on the Account page.  The idea is that everything is assigned within the controller while displaying just the comment box to enter info from the call.  Right now as it is currently written I can fill in everything I need except the account that the "log a call" is related to.  I am passing the account id through the URL in the button.  Any suggestions on how to grad the account id from the URL and make that the account it is related to would be great.

 

VF Page

<apex:page standardController="Task" extensions="LogACallControllerExtension" showHeader="false" sidebar="false">
    <apex:sectionHeader title="Log A Call" />
    <apex:form id="pageForm">
        <apex:pageBlock title="Call Edit" mode="edit">
            <apex:pageBlockButtons location="both">
                <apex:commandButton value="Save" action="{!save}" />
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
            <br />
            <apex:pageBlockSection title="Call Information" columns="1" collapsible="false">
                <apex:inputField value="{!Task.Description}" style="width:400px;height:100px;" />
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 Controller Extension

public with sharing class LogACallControllerExtension {

    public Task task;
    ApexPages.Standardcontroller controller;
    
                public Account getAccount() {
                    return [SELECT Id, Name from Account where Id=:ApexPages.currentPage().getParameters().get('what_id')];
                }

    public LogACallControllerExtension(ApexPages.StandardController controller) {
            this.task = (Task)controller.getRecord();
            this.task.subject = 'Service Call';
            this.task.type = 'Call';
            this.task.status = 'Completed';
            this.task.activitydate = system.today();
            this.controller = controller;
    }
    public PageReference save() {
          return controller.save();
    }

}

 Button URL

/apex/Log_a_Call_in_Chatter?title=Call&what_id={!Account.Id}&followup=1&tsk5=Service Call&retURL=%2F{!Account.Id}&tsk3={!Account.Name}&tsk10=Call

 I have tried pulling the name from the URL that is assigned to 'tsk3', but it is giving me an error trying to assign a 'name' to a 'string'.

 

I am also wondering if it would be possible to take what is entered in the comment field and post that as a feed in the related account.

I have created a custom web form to enter information into a custom object. Everything works great except for the submit button. We recently had someone enter two identical records almost immediately so I went into our sandbox to test my theory and, unfortunately, I was correct...if you click the submit button multiple times before the page processes and redirects to the thank you page it will generate multiple identical records based on the number of times the button was clicked. Is there anything that can be done to ignore the multiple clicks and process only one record instead of duplicating it?

 

 

Thanks!!

I am not sure if that is the correct terminology, but here it goes...I created two custom objects in SF.  One is populated from a webform and the other is created from the one populated by the webform.  I am at a point where i am not sure what is the best process to accomplish this procedure.  I need to take into consideration the possibility that multiple webforms will be filled out at one time so the Trigger needs to be able to handle multiple items on an ongoing basis.  I am having a tough time deciding how to set this up...all the examples/suggestions/solutions are based instances of objects that are already created and are just updating fields within a certain instance based on a set of criteria.  I need to know how to create a new instance of one object based on the instance of another object once it is inserted from the webform.

 

Any help is greatly appreciated.

I have a custom object (we will call this one external) that is being populated through a webform.  I have another custom object (we will call this one internal) that is is being created with the data entered into the webform.  The reason for this is there are two master-detail relationships on the internal custom object that would not be accessible on an external site.  These two master-detail relationships are short/controlled lists of objects so I have entered them as picklists on the external object so there is no way to select somehting other than the select group of items we want.  Once the webform has been submitted and the external custom object has been created I need to pass that data to the internal custom object and make the master-detail connections based on the values in the picklists.  I need to create a Trigger to do this and have never created one so I don't even know where to begin.  I have looked through the documentation, but there aren't any examples of this nature so I am not sure how to begin coding this.

I wasn't sure exactly where to post this so hopefully somebody will see it here and be able to help.

 

Can you make a program that is open on your computer active and pass a value to it using a button on an account?

I am trying to implement a page in my Production Org that i developed in my Sandbox Org.  However, I ran into some issues getting anything to come up on the internet so I went back and created the same basic page for both orgs.  Any change that I make to the site in my Sandbox Org is immediately updated, but that is not the case in the Production Org.  The only difference being that I have CMSForce2 installed in my Sandbox Org with the catch that it is just a VF page that I am using in both scenarios.  I am not even using CMSForce2 to implement the page in my Sandbox Org, but that seems to be the only difference.  I guess I am curious as to if CMSForce2 implements changes in the Org to allow for easier iplementation of sites in general regardless of whether you actually use the tool or use a straight VF page.

I am trying to invoke the same functionality as the "Log a Call" button a custom Apex/Visualforce page that I am creating.  I need some guidance on how best to invoke this page pragmatically.