• Dev2India
  • NEWBIE
  • 35 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 12
    Questions
  • 22
    Replies
Article feedback does not render on the standard article layout. To achieve this, we custom built and added code in “pkb_controller” and modified “pkb_articleview” component to render feedback along with article details on portal. 

Also using below attribute for “pkb_article” and “pkb_related” respectively since we are using customer portal –
<apex:variable var="nonSiteArticleURL" value="{!$Page.pkb_Home}?id={!aid}&" />
<apex:variable var="articleURL" value="/apex/pkb_home?id={!a.Id}&"/>
 
This works fine. However, the issue occurs in following situation – 

Inside articles, if any smart links/deep links are used, they are routing to standard SF layout.
For example –
Clicking on smart link route to below standard (which does not render feedback section)
https://sso--cvent.cs4.my.salesforce.com/articles/Instructions/Importing-Discount-Codes-Blue?q=related&fs=Search&pn=1&l=en_US
In this case we have to modify the smart links used in all the articles like –https://sso--cvent--c.cs4.visual.force.com/apex/pkb_home?id=kA1P00000008WnH
So that it could render feedback with articles.
 
Now two Qs:
How to manage the “articleURL” so that it could display pkb_articleview with feedback component.
If not how to mass update the smart links instead of going to update manually.

Please assit me in this which would be highly appreciated. 
Article feedback does not render on the standard article layout. To achieve this, we custom built and added code in “pkb_controller” and modified “pkb_articleview” component to render feedback along with article details on portal. 

Also using below attribute for “pkb_article” and “pkb_related” respectively since we are using customer portal –
<apex:variable var="nonSiteArticleURL" value="{!$Page.pkb_Home}?id={!aid}&" />
<apex:variable var="articleURL" value="/apex/pkb_home?id={!a.Id}&"/>
 
This works fine. However, the issue occurs in following situation – 

Inside articles, if any smart links/deep links are used, they are routing to standard SF layout.
For example –
Clicking on smart link route to below standard (which does not render feedback section)
https://sso--cvent.cs4.my.salesforce.com/articles/Instructions/Importing-Discount-Codes-Blue?q=related&fs=Search&pn=1&l=en_US
In this case we have to modify the smart links used in all the articles like –https://sso--cvent--c.cs4.visual.force.com/apex/pkb_home?id=kA1P00000008WnH
So that it could render feedback with articles.
 
Now two Qs:
How to manage the “articleURL” so that it could display pkb_articleview with feedback component.
If not how to mass update the smart links instead of going to update manually.

Please assit me in this which would be highly appreciated. 
Article feedback does not render on the standard article layout. To achieve this, we custom built and added code in “pkb_controller” and modified “pkb_articleview” component to render feedback along with article details on portal. 

Also using below attribute for “pkb_article” and “pkb_related” respectively since we are using customer portal –
<apex:variable var="nonSiteArticleURL" value="{!$Page.pkb_Home}?id={!aid}&" />
<apex:variable var="articleURL" value="/apex/pkb_home?id={!a.Id}&"/>
 
This works fine. However, the issue occurs in following situation – 

Inside articles, if any smart links/deep links are used, they are routing to standard SF layout.
For example –
Clicking on smart link route to below standard (which does not render feedback section)
https://sso--cvent.cs4.my.salesforce.com/articles/Instructions/Importing-Discount-Codes-Blue?q=related&fs=Search&pn=1&l=en_US
In this case we have to modify the smart links used in all the articles like –https://sso--cvent--c.cs4.visual.force.com/apex/pkb_home?id=kA1P00000008WnH
So that it could render feedback with articles.
 
Now two Qs:
How to manage the “articleURL” so that it could display pkb_articleview with feedback component.
If not how to mass update the smart links instead of going to update manually.

Please assit me in this which would be highly appreciated. 
Want to display output value and colour page only if field value exists. How to do this on VF ??

<apex:page standardController="Account" showheader="False" id="test" >
    <style>
        .apexp, body .secondaryPalette.bPageBlock, body .individualPalette .secondaryPalette.bPageBlock
        {
            background-color:#F76566;
            color:#000;
        }
        body .bPageBlock .pbBody .labelCol {
            color: #000;
            width:17%;
            font-size:13px;
        }
        .body
        {
            font-size:14px;
            font-weight:bolder;
        }

     </style>
     <apex:form styleClass="form" >
         <apex:pageBlock rendered="true">
             <apex:pageBlockSection columns="1" id="myId" >       
                 <apex:outputText styleclass="body" value="{!account.Imp_msg__c}"  id="myId" />
             </apex:pageBlockSection>
         </apex:pageBlock>
     </apex:form>
</apex:page>

Thanks for the suggestions
I am using the below code to create child record, based on certain conditions. Howeever, in the below code , do not want to check the values in trigger.old. I want to query for the child records if those exists are not, then to create the child record. If child record exist ,then do not create the child record and if not then create the child record.
trigger createSplitCommissionOnOpportunityX on Opportunity (after insert, after update) {
   
    List<Split_Commissions__c> SCToInsert = new List<Split_Commissions__c>  ();
  
    for (Opportunity o : Trigger.new) {
       
      
    if ( ((Trigger.isInsert) ||
          (Trigger.isUpdate) && (Trigger.oldMap.get(o.id).StageName !=  'Closed Won')) &&
         (o.StageName == 'Closed Won') )
    {
        Split_Commissions__c SC = new Split_Commissions__c ();        
       
        sc.Opportunity_Name__c = o.id;
       
        SCToInsert.add(sc);
       
       
        }//end if
       
    }//end for o
   
    //once loop is done, you need to insert new records in SF
    // dml operations might cause an error, so you need to catch it with try/catch block.
    try {
        insert SCToInsert;
    } catch (system.Dmlexception e) {
        system.debug (e);
    }
}

Please suggest the code how to query to check in the code if child exists or not.
Much appreciated.




I am using Public Knowledge base where in trying to display the feedback section for the articles so that clients can select Yes /No button. However , this is not rendering on the bottom of the articles.
I can see there are componets like "pkb_article" and "pkb_articleview" through this is being displayed.

When I am not using the below line of code , I can see the feedback section on the articles. But contents are not being displayed

< apex:variable var="nonSiteArticleURL" value="{!$Site.currentSiteUrl}/articles{!pkbCon.selectedLanguageURL}{!typeName}/{!urlName}/?" />

When I am using the above line of code in the pkb_article component, I am able to see the article contents but not the feedback section. Someone could please help me to understand the logic or the way to incorporate the feedback section in the articles.
I will appreciate the help.

Thanks,
trigger createSplitCommissionOnOpportunityX on Opportunity (after insert, after update) {
   
    List<Split_Commissions__c> SCToInsert = new List<Split_Commissions__c>  ();
  
    for (Opportunity o : Trigger.new) {
       
      
    if ( ((Trigger.isInsert) ||
          (Trigger.isUpdate) && (Trigger.oldMap.get(o.id).StageName !=  'Closed Won')) &&
         (o.StageName == 'Closed Won') )
    {
        Split_Commissions__c SC = new Split_Commissions__c ();        
       
        sc.Opportunity_Name__c = o.id;
       
        SCToInsert.add(sc);
       
       
        }//end if
       
    }//end for o
   
    //once loop is done, you need to insert new records in SF
    // dml operations might cause an error, so you need to catch it with try/catch block.
    try {
        insert SCToInsert;
    } catch (system.Dmlexception e) {
        system.debug (e);
    }
}

PLease help us to create the test class for the above code.


Thanks,

We have implemented the live Agent functionality in Production. We have also our portal users for whome this chat functionality provided. Through portal home page , clients can initiate chat (chat button provided on portal). Also we have implemented the Prechat form in order to receive the data like Name, email, Account..

 

This is working fine but clients needs to fill out these details in Prechat form, which is not feasible since they are Portla users. So I am prepopulating these details like name, email in Pre chat form. Used prety simple code at VF (mentioned below) , this is working fine in Salesforce preview. However, when used on Portal , prechat form is not reflecting the correct Name , email in Pre chat form. In the name field this is reflecting Sitename and in email email this is using the by default site user email id.

 

We want when, every client logged in Portal and initiating the chat , in prechat form , Client name and email should be in user context....

 

Please let me know any workaround / solution how to resolve this.

 

I will really appreciate this ....

 

<apex:page showHeader="false" standardController="User" >

    <script>
        function clickBtn()
        {
            var btnSubmit = document.getElementById('prechat_submit');
            btnSubmit.click();
        }
    </script>

    <!-- This script takes the endpoint URL parameter passed from the deployment page and makes it the action for the form -->
    <script type="text/javascript">
        (function()
        {
            function handlePageLoad()
            {
                var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
                document.getElementById('prechatForm').setAttribute('action', decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
            }
            if (window.addEventListener)
            {
                window.addEventListener('load', handlePageLoad, false);
            }
            else
            {
                window.attachEvent('onload', handlePageLoad, false);
            }
        })();
    </script>
   
    <h1>Pre-chat Form</h1>
    <form method='post' id='prechatForm'>
   
        <style type="text/css">
            body {
                margin: 0 auto;
                padding: 0;
                font-family: 'Trebuchet MS', Helvetica, sans-serif;
                font-size: 12px;
                color: #737373;
                line-height: 16px;
            }                   

            p {
                font-weight: bolder
            }
           
            td {
                font-family: 'Trebuchet MS', Helvetica, sans-serif;
            }
           
            h1 {
                font-family: 'Trebuchet MS', Helvetica, sans-serif;
            }

            .btnClass {
                font-family: 'Trebuchet MS', Helvetica, sans-serif;
            }

        </style>

        <!-- Creates an auto-query for a matching Contact record’s Email field based on the value of the liveagent.prechat:Email field -->   
        <table border="0" width="400px">
            <tr>
                <td>
                    <b>Name: </b>
                </td>
                <td>
                    <input type='text' size="40" name='liveagent.prechat:Name' id='prechat_field' value='{!$User.FirstName} {!$User.LastName}' />          
                </td>
            </tr>
            <tr>
                <td>
                    <b>Email Address: </b>
                </td>
                <td>
                    <input type='text' size="40" name='liveagent.prechat:Email' width="500" value='{!$User.Email}' />
                </td>
            </tr>
            <tr>
                <td>
                    <b>Property Name: </b>
                </td>
                <td>
                    <input type='text' size="40" name='liveagent.prechat:Account' value='{!getAccountName}' />
                </td>
            </tr>
            <tr>
                <td>
                   
                </td>
                <td align="center">
                    <input type='submit' value='Request Chat' id='prechat_submit' class="btnClass" />
                </td>
            </tr>
        </table>

        <input type="hidden" name="liveagent.prechat.query:Email" value="Contact,Contact.Email" />        

    </form>


</apex:page>

 

Thanks alot !!!!

 

Hi Experts ,

 

I would like to know som way to customizations in chat functionality in below manners :

 

1) How I can give an option to clients to email the chat transcript to them. rather than saving the file. Please share the way / code I can accomodate by putting a button on chat window for clients.

 

2) How can we customize the messages like " agent is typing" to something else

 

Help will be much appreciated

 

// @

 

 

Thanks alot

Raj

Hello Experts,

 

Below is the pretty much good code i am using in orde to update the first activity date field. As per the new salesforce limit I am getting the Apex cpu time limit during mass upload. Some time it works fine and get the error at 1000 upload where in 900 sucess and limit exceed for rest. Sometime it occurs at 100 task uploads only.

 

Please let me know how to overcome this and test the consumption of limits in this code ?? Code was well behaved with preveous releses.

 

===========================================================

trigger SetFirstactivityDate on Task(after update,after insert) {
   
  
  
    Set<Id> RecordIds=new Set<Id>();
    for (Task evntObj: Trigger.new){
       
        RecordIds.add(evntObj.WhoId);
   
    }
    List<Contact> conList=new List<Contact>();
    for(Contact con:[Select id,(SELECT ActivityDate FROM ActivityHistories Where ActivityDate < = Today  Order
    By ActivityDate ASC Limit 1) from Contact where id in:RecordIds])
    {
         if(con.ActivityHistories.size()>0)
         {
         con.First_ACTIVITY_Date__c=con.ActivityHistories[0].ActivityDate;
         conList.add(con);
         con.Apex_context__c=True; \\ in this line bypassing all the validation rule
         }
         else
         {
         con.First_ACTIVITY_Date__c=null;
         conList.add(con);
         con.Apex_context__c=True; \\ in this line bypassing all the validation rule
         }
        
    }
   
    if(conList.size()>0)
    {
    update conList;
    }
    }

===========================================================

 

Appreciate your suggestions ...........

 

Thanks.......

Hi All,

 

Everything is working fine in Sandbox. I am getting erro in Production while validating. Below is the error :

 

================================================================

TestoppTrigger.testpreventoppdelete() Class 35 1 
 Message: "System.AssertException: Assertion Failed: Expected: false, Actual: true",
 Failure Stack Trace: "Class.TestoppTrigger.testpreventoppdelete: line 35, column 1"

================================================================

 

This is the simple trigger and test class:

 

trigger PreventOppDeletion on Opportunity (before delete) {
   
        String UserId = UserInfo.getuserId();
        user userRec =  [Select id from user where id = '005000000079xyz' limit 1];  
       
              for(opportunity  opp : trigger.old)
              {
              if (UserId != userRec.Id && opp.StageName == 'Closed Won' && opp.New_Type__c.startswith('Renewal')) {Opp.addError('You are not authorised to delete this Opportunity.');
              }
             
             }
   
    }

 

================================

@isTest(SeeAllData=true)
   
     private class TestPreventOppTrigger
    {
    static testMethod void testPreventOppDeletion(){
          
           Profile p = [select id from profile where name='Standard User'];
           User u = new User(alias = 'standt', email='standarduser@testorg.com',
                             emailencodingkey='UTF-8', lastname='Testing',
                             languagelocalekey='en_US',localesidkey='en_US',
                             profileid = p.Id,timezonesidkey='America/Los_Angeles',
                             username='teststandarduser@testorg.com');
  
  
           System.runAs(u){
          
                Opportunity o = new Opportunity();
                o.name='Opp1';
                o.stageName='Open';
                o.CloseDate=Date.today();
                o.Type='New Customer';
                o.amount=100.00;
                o.ContractReceived__c=Date.today();
                 insert o;
                 try{
                     delete o;
                 }catch(Exception ex){
                        Boolean Message = false;         
                        if(ex.getMessage().contains('You are not authorised to delete this Opportunity')){
                             Message = true;     
                        }else{
                             Message = false;     
                        }
                        system.debug('########Message : '+Message);
                       
                        System.AssertEquals(Message, true);
                 }
        }
  }


}

================================ 

 

Please suggest. I would appreciate your feedback.

 

Thanks,

 

HI Experts,

 

Please let me know a solution if we can prevent opportunity deletion through validation also. I beleive we can do through the code. Suppose I have to prevent opportunity deletion based on 2 condtions as in validation below

 

OR(Isblank(Username__c), Isblank(Date__c) ))

 

So can we prevent deletion for one profile users , based on above conditions through Validation ???????

 

I appreciate your help....

 

Thanks

I am using Public Knowledge base where in trying to display the feedback section for the articles so that clients can select Yes /No button. However , this is not rendering on the bottom of the articles.
I can see there are componets like "pkb_article" and "pkb_articleview" through this is being displayed.

When I am not using the below line of code , I can see the feedback section on the articles. But contents are not being displayed

< apex:variable var="nonSiteArticleURL" value="{!$Site.currentSiteUrl}/articles{!pkbCon.selectedLanguageURL}{!typeName}/{!urlName}/?" />

When I am using the above line of code in the pkb_article component, I am able to see the article contents but not the feedback section. Someone could please help me to understand the logic or the way to incorporate the feedback section in the articles.
I will appreciate the help.

Thanks,
I'm working on a project with a Force.com site that also uses the PKB (from the AppExchange).  I'm finding that PKB is using some undocumented Sites mechanism with the /articles/ folder to render articles when they are viewed.  This seems to fall flat on it's face with a 404 Page Note Found if the Site hosting the PKB is configured to use a URL Rewriter.  This happens even if the URL Rewriter has no rules/code that would touch or overlap the /articles/ folder.

Anyone hit this?  Trying to keep the customer's Site on a single Site config to preserve the login session for authenticated users.

The PKB documentation doesn't specifically say you can't use a URL rewriter, but rather, seems to have a copy/paste snippet from the Sites documentation.  https://appexchange.salesforce.com/servlet/servlet.FileDownload?file=00P3000000HCTKdEAP 
I am using the below code to create child record, based on certain conditions. Howeever, in the below code , do not want to check the values in trigger.old. I want to query for the child records if those exists are not, then to create the child record. If child record exist ,then do not create the child record and if not then create the child record.
trigger createSplitCommissionOnOpportunityX on Opportunity (after insert, after update) {
   
    List<Split_Commissions__c> SCToInsert = new List<Split_Commissions__c>  ();
  
    for (Opportunity o : Trigger.new) {
       
      
    if ( ((Trigger.isInsert) ||
          (Trigger.isUpdate) && (Trigger.oldMap.get(o.id).StageName !=  'Closed Won')) &&
         (o.StageName == 'Closed Won') )
    {
        Split_Commissions__c SC = new Split_Commissions__c ();        
       
        sc.Opportunity_Name__c = o.id;
       
        SCToInsert.add(sc);
       
       
        }//end if
       
    }//end for o
   
    //once loop is done, you need to insert new records in SF
    // dml operations might cause an error, so you need to catch it with try/catch block.
    try {
        insert SCToInsert;
    } catch (system.Dmlexception e) {
        system.debug (e);
    }
}

Please suggest the code how to query to check in the code if child exists or not.
Much appreciated.




I am using Public Knowledge base where in trying to display the feedback section for the articles so that clients can select Yes /No button. However , this is not rendering on the bottom of the articles.
I can see there are componets like "pkb_article" and "pkb_articleview" through this is being displayed.

When I am not using the below line of code , I can see the feedback section on the articles. But contents are not being displayed

< apex:variable var="nonSiteArticleURL" value="{!$Site.currentSiteUrl}/articles{!pkbCon.selectedLanguageURL}{!typeName}/{!urlName}/?" />

When I am using the above line of code in the pkb_article component, I am able to see the article contents but not the feedback section. Someone could please help me to understand the logic or the way to incorporate the feedback section in the articles.
I will appreciate the help.

Thanks,
trigger createSplitCommissionOnOpportunityX on Opportunity (after insert, after update) {
   
    List<Split_Commissions__c> SCToInsert = new List<Split_Commissions__c>  ();
  
    for (Opportunity o : Trigger.new) {
       
      
    if ( ((Trigger.isInsert) ||
          (Trigger.isUpdate) && (Trigger.oldMap.get(o.id).StageName !=  'Closed Won')) &&
         (o.StageName == 'Closed Won') )
    {
        Split_Commissions__c SC = new Split_Commissions__c ();        
       
        sc.Opportunity_Name__c = o.id;
       
        SCToInsert.add(sc);
       
       
        }//end if
       
    }//end for o
   
    //once loop is done, you need to insert new records in SF
    // dml operations might cause an error, so you need to catch it with try/catch block.
    try {
        insert SCToInsert;
    } catch (system.Dmlexception e) {
        system.debug (e);
    }
}

PLease help us to create the test class for the above code.


Thanks,

Hi Experts ,

 

I would like to know som way to customizations in chat functionality in below manners :

 

1) How I can give an option to clients to email the chat transcript to them. rather than saving the file. Please share the way / code I can accomodate by putting a button on chat window for clients.

 

2) How can we customize the messages like " agent is typing" to something else

 

Help will be much appreciated

 

// @

 

 

Thanks alot

Raj

Hello Experts,

 

Below is the pretty much good code i am using in orde to update the first activity date field. As per the new salesforce limit I am getting the Apex cpu time limit during mass upload. Some time it works fine and get the error at 1000 upload where in 900 sucess and limit exceed for rest. Sometime it occurs at 100 task uploads only.

 

Please let me know how to overcome this and test the consumption of limits in this code ?? Code was well behaved with preveous releses.

 

===========================================================

trigger SetFirstactivityDate on Task(after update,after insert) {
   
  
  
    Set<Id> RecordIds=new Set<Id>();
    for (Task evntObj: Trigger.new){
       
        RecordIds.add(evntObj.WhoId);
   
    }
    List<Contact> conList=new List<Contact>();
    for(Contact con:[Select id,(SELECT ActivityDate FROM ActivityHistories Where ActivityDate < = Today  Order
    By ActivityDate ASC Limit 1) from Contact where id in:RecordIds])
    {
         if(con.ActivityHistories.size()>0)
         {
         con.First_ACTIVITY_Date__c=con.ActivityHistories[0].ActivityDate;
         conList.add(con);
         con.Apex_context__c=True; \\ in this line bypassing all the validation rule
         }
         else
         {
         con.First_ACTIVITY_Date__c=null;
         conList.add(con);
         con.Apex_context__c=True; \\ in this line bypassing all the validation rule
         }
        
    }
   
    if(conList.size()>0)
    {
    update conList;
    }
    }

===========================================================

 

Appreciate your suggestions ...........

 

Thanks.......

System.DmlException: Update failed. First exception on row 0 with id 006e00000049qyNAAQ; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, GlobalOpportunitySoldOrMissed: execution of AfterUpdate

caused by: System.LimitException: Apex CPU time limit exceeded

 

What does this error message mean?  

 

Thank you!

  • September 09, 2013
  • Like
  • 0

Hi All,

 

Everything is working fine in Sandbox. I am getting erro in Production while validating. Below is the error :

 

================================================================

TestoppTrigger.testpreventoppdelete() Class 35 1 
 Message: "System.AssertException: Assertion Failed: Expected: false, Actual: true",
 Failure Stack Trace: "Class.TestoppTrigger.testpreventoppdelete: line 35, column 1"

================================================================

 

This is the simple trigger and test class:

 

trigger PreventOppDeletion on Opportunity (before delete) {
   
        String UserId = UserInfo.getuserId();
        user userRec =  [Select id from user where id = '005000000079xyz' limit 1];  
       
              for(opportunity  opp : trigger.old)
              {
              if (UserId != userRec.Id && opp.StageName == 'Closed Won' && opp.New_Type__c.startswith('Renewal')) {Opp.addError('You are not authorised to delete this Opportunity.');
              }
             
             }
   
    }

 

================================

@isTest(SeeAllData=true)
   
     private class TestPreventOppTrigger
    {
    static testMethod void testPreventOppDeletion(){
          
           Profile p = [select id from profile where name='Standard User'];
           User u = new User(alias = 'standt', email='standarduser@testorg.com',
                             emailencodingkey='UTF-8', lastname='Testing',
                             languagelocalekey='en_US',localesidkey='en_US',
                             profileid = p.Id,timezonesidkey='America/Los_Angeles',
                             username='teststandarduser@testorg.com');
  
  
           System.runAs(u){
          
                Opportunity o = new Opportunity();
                o.name='Opp1';
                o.stageName='Open';
                o.CloseDate=Date.today();
                o.Type='New Customer';
                o.amount=100.00;
                o.ContractReceived__c=Date.today();
                 insert o;
                 try{
                     delete o;
                 }catch(Exception ex){
                        Boolean Message = false;         
                        if(ex.getMessage().contains('You are not authorised to delete this Opportunity')){
                             Message = true;     
                        }else{
                             Message = false;     
                        }
                        system.debug('########Message : '+Message);
                       
                        System.AssertEquals(Message, true);
                 }
        }
  }


}

================================ 

 

Please suggest. I would appreciate your feedback.

 

Thanks,

 

We have a Live Agent chat button in our Customer Portal because only customers paying for our support can use Live Agent chat. We can get the customer portal user's Name, Email & Account and pre-populate a Pre-chat window but this hits the user with an unnecessary screen pop where they click a button to chat again. How can I set up the pre-chat window to just auto-submit? I have tried to programmatically click the submit button using javascript in window and body onloads and it does not work. I thought that I could maybe do this all in apex if I could use httprequest setmethod(‘POST’) but I couldn’t figure out how to do this or if it is even possible.

 

Does anyone know of a way that I can do this?

 

 

Pre-chat vf code:

<apex:page showHeader="false" standardController="User" extensions="NICP_Functions">

    <script>
        function clickBtn()
        {
            var btnSubmit = document.getElementById('prechat_submit');
            btnSubmit.click();
        }
    </script>

    <!-- This script takes the endpoint URL parameter passed from the deployment page and makes it the action for the form -->
    <script type="text/javascript">
        (function() 
        { 
            function handlePageLoad() 
            {
                var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
                document.getElementById('prechatForm').setAttribute('action', decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
            } 
            if (window.addEventListener) 
            {
                window.addEventListener('load', handlePageLoad, false);
            } 
            else 
            { 
                window.attachEvent('onload', handlePageLoad, false);
            }
        })();
    </script>
    
    <h1>Pre-chat Form</h1>
    <form method='post' id='prechatForm'>
    
        <style type="text/css">
            body {
                margin: 0 auto;
                padding: 0;
                font-family: 'Trebuchet MS', Helvetica, sans-serif;
                font-size: 12px;
                color: #737373;
                line-height: 16px;
            }                    

            p {
                font-weight: bolder
            }
            
            td {
                font-family: 'Trebuchet MS', Helvetica, sans-serif;
            }
            
            h1 {
                font-family: 'Trebuchet MS', Helvetica, sans-serif; 
            }

            .btnClass {
                font-family: 'Trebuchet MS', Helvetica, sans-serif; 
            }

        </style>

        <!-- Creates an auto-query for a matching Contact record’s Email field based on the value of the liveagent.prechat:Email field -->    
        <table border="0" width="400px">
            <tr>
                <td>
                    <b>Name: </b>
                </td>
                <td>
                    <input type='text' size="40" name='liveagent.prechat:Name' id='prechat_field' value='{!$User.FirstName} {!$User.LastName}' />          
                </td>
            </tr>
            <tr>
                <td>
                    <b>Email Address: </b>
                </td>
                <td>
                    <input type='text' size="40" name='liveagent.prechat:Email' width="500" value='{!$User.Email}' />
                </td>
            </tr>
            <tr>
                <td>
                    <b>Property Name: </b>
                </td>
                <td>
                    <input type='text' size="40" name='liveagent.prechat:Account' value='{!getAccountName}' />
                </td>
            </tr>
            <tr>
                <td>
                    
                </td>
                <td align="center">
                    <input type='submit' value='Request Chat' id='prechat_submit' class="btnClass" />
                </td>
            </tr>
        </table>

        <input type="hidden" name="liveagent.prechat.query:Email" value="Contact,Contact.Email" />         

    </form>


</apex:page>

 Pre-chat extension code

public with sharing class NICP_Functions 
{

    public String getAccountName{get; set;} 
    public User u;
    
    public NICP_Functions(ApexPages.StandardController controller) 
    {

        try 
        {
            User u = [SELECT Id, AccountId FROM User WHERE Id =: UserInfo.getUserId()];
            Account a = [SELECT Id, Name FROM Account WHERE Id =: u.AccountId];
            getAccountName = a.Name;
        }
        catch (Exception e){getAccountName = 'Please Specify';}   
        
    }
    

 

Hi,

 

I have written a visualforce page with the list of articles and deployed on sites.  The user should give the article rating as soon as he found the article. I used <knowledge:articleRendererToolBar> to give ratings but on public sites it is showing blank where as in internal app it is allowing the user to enter the rating.

 

It is very urgent. Please help me out. 

 

 

So I figured out how to tell Live Agent to use a custom page... (I think)

 

But when I switch to using a custom page, and the user initiates a chat from a Chat Button, the user is blocked by an "Authorization Required - You must first log in or register before accessing this page." message. I attempted to adjust the "Security" setting of the page, just adding all the roles to the page, and that didn't work.

 

So... how exactly do I expose that custom page so that any of our customers/users (i.e. The Public) can communicate via the custom chat page without requiring a login?

 

Thanks!

 

Summary: When an Opportunity goes to the Stage Closed Won, I am trying to create a record in a child object. This child object is new, so I have latitude to make changes to it however I need to but I started with it having a Master-Detail relationship as I want to be able to report on information downstream off of both the Opportunity and this object and I need it to be a one to many relationship that we can manually create additional child records on.

 

This is my first attempt at creating a trigger so any help is much appreciated. I got a start by another posting on this board!

 

 

Error: Compile Error: unexpected token: 'List' at line 3 column 4
trigger createSplitCommissionOnOpportunityX on Opportunity (after insert) {
    
    List Split_Commissions__c SCToInsert = new List Split_Commissions__c  (); 
   
    for (Opportunity o : Trigger.new) {
        
       
        if (o.StageName == 'Closed Won') {
        
        Split_Commissions__c SC = new Split_Commissions__c (); 
        
        sc.Opportunity_Name__c = o.Name; 
        
        SCToInsert.add(sc);
        
        
        }//end if
        
    }//end for o
    
    //once loop is done, you need to insert new records in SF
    // dml operations might cause an error, so you need to catch it with try/catch block.
    try {
        insert SCToInsert; 
    } catch (system.Dmlexception e) {
        system.debug (e);
    }

trigger createSplitCommissionOnOpportunityX on Opportunity (after insert) {        List Split_Commissions__c SCToInsert = new List Split_Commissions__c  ();        for (Opportunity o : Trigger.new) {                       if (o.StageName == 'Closed Won') {                Split_Commissions__c SC = new Split_Commissions__c ();                 sc.Opportunity_Name__c = o.Name;                 SCToInsert.add(sc);                        }//end if            }//end for o        //once loop is done, you need to insert new records in SF    // dml operations might cause an error, so you need to catch it with try/catch block.    try {        insert SCToInsert;     } catch (system.Dmlexception e) {        system.debug (e);    }

 

Hi,

 

I have written a visualforce page with the list of articles and deployed on sites.  The user should give the article rating as soon as he found the article. I used <knowledge:articleRendererToolBar> to give ratings but on public sites it is showing blank where as in internal app it is allowing the user to enter the rating.

 

It is very urgent. Please help me out.