• sathishsfdc
  • NEWBIE
  • 80 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 46
    Questions
  • 17
    Replies
I need to get the button clicked time of the cookie inside an apex class.How can i achieve this??
<div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="mod" onclick="WriteCookie()">Close</button>                                                
        </div>

      <script type="text/javascript">
         <!--
            function WriteCookie()
            {
               var now = system.now();
               cookievalue = escape(document.myform.customer.value) + ";"
               
               document.cookie="name=" + cookievalue;
               document.cookie = "expires=" + now.toUTCString() + ";"
               document.write ("Setting Cookies : " + "name=" + cookievalue );
            }
         
      </script>

How can i get the values inside an apex class including the time on which the button was clicked..
Thanks
is there any possible way to keep the command button highlighted even after panel refresh
<apex:page controller="HideAndShow">
<script type="text/javascript">
    var buttonClicked = null;
    function highlight(id) {
    if(buttonClicked != null )
    {
        buttonClicked.style.background = "#cccccc";
        buttonClicked.style.color =  "black";
    }

    buttonClicked  = document.getElementById(id);
    buttonClicked.style.background =  ""#87ceeb";
    buttonClicked.style.color =  "white";
    
    } </script>

<apex:form id="fm1"  >
                   <apex:commandButton id="btn1" action="{!firstButton}" value="{click1)"   onclick="highlight(this.id)"   /> 
            <apex:commandButton id="btn2" action="{!secondButton}" value="{click2)" onclick="highlight(this.id)"   /> 


               <apex:outputPanel id="one" rendered="{!firstPanel}" >
               panel1
               </apex:outputpanel>
               
                          <apex:outputPanel id="on1e" rendered="{!secondPanel}" >

panel2                                         </apex:outputpanel>

    </apex:form>
  </apex:page>


global with sharing class HideAndShow{
   
   public boolean firstPanel{get;set;}
   public boolean secondPanel{get;set;}

   
    public HideAndShow() {
     
     firstPanel = false;
     secondPanel = false;

    }

    public void firstButton()
    {
      firstPanel=false;
      secondPanel= false;

    
    }
   public void secondButton()
    {
      firstPanel=false;
      secondPanel= true;

    
    }

The onclick keeps the button highlighted for a second and then returns to the original colour.I want to keep the colour highlighted
even afer panel refresh
Is it possible to capture records that were not inserted inside the visualforce page.

If for ex: in Lead object 
User-added image

I have a custom controller that inserts lead record,now sometimes the lead does not get inserted and exception is thrown
now can i fetch the Company name or some field value that i entered into the  vfpage but was not inserted as a record

Thanks
sathish
Hi,

Is it possible to capture cases/records that were not created via web2case/email2case ????
is it possible to debug??

Thanks
sathish
 
Hi,
Is there a way to retain the apex:command button colour even after the form is re-rendered
<apex:page standardController="Account">
    <apex:form id="f" >
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" onclick="this.style.background='blue';" reRender="f"  value="Save"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    <apex:outputText>test button colour</apex:outputText>
    </apex:form>
</apex:page>

 and some action like create/update is performed.
When i hit the save buton colour changes and reverts back to the original colour.any possible workaround will be helpful.
 
i have 3 command buttons with 3 different panels getting cases based on status.
If there are records in all Case Status then it is working fine but sometimes when there are no records in particular status
i need to hit the command button twice to get the details.
Any workaround for this??
<apex:commandButton value="1"   action="{!firstButton}"  />
<apex:commandButton value="2    action="{!secondButton}" />
 <apex:commandButton value="3"   action="{!thirdButton}" ;"/>


     <apex:outputPanel id="one" title="one" rendered="{!firstPanel}">

     ---retreivedata----
   
  </apex:output panel>
         <apex:outputPanel id="two" title="two" rendered="{!secondtPanel}">
        ---retreivedata----

     </apex:output panel>

         <apex:outputPanel id="three" title="three" rendered="{!fthirdPanel}">
     ---retreivedata----
     </apex:output panel>

     public void firstButton()
    {
      firstPanel=true;
      secondPanel= false;
       thirdPanel = false;
            customethod1();       
        }

    public void secondButton()
    {
      firstPanel=false;
      secondPanel=true;
       thirdPanel = false;
    customethod2();      
    }

   public void thirdButton()
    {
      firstPanel=false;
      secondPanel=false;
      thirdPanel = true;
      customethod3();
      
      }

 
Hi , I have 3 command buttons with different logics to be processed on each.
Now i want the command button to be higlighted on click and when 2nd buttton is clicked then only 2nd button must be highlighted.
Is it possible???
<apex:page controller="HideAndShow">
<apex:form >
<apex:commandButton value="firstButton" action="{!firstButton}"/>
<apex:commandButton value="SecondButton" action="{!secondButton}"/>
<apex:commandButton value="thirddButton" action="{!thirdButton}"/>
<apex:outputPanel id="one" title="one" rendered="{!firstPanel}">
<apex:pageblock >
<apex:pageblockSection >


<p>1111111111111111</p> </apex:pageblockSection></apex:pageblock>
</apex:outputPanel>

<apex:outputPanel id="two" title="two" rendered="{!secondPanel}">
<p>222222222222</p>
</apex:outputPanel>
<apex:outputPanel id="three" title="three" rendered="{!thirdPanel}">
<p>3333333333333</p>
</apex:outputPanel>

  </apex:form>

</apex:page>

 
Is there any alternative for using apextab with jquey.I created a simple page with jquery and apextab and the tab was not working,
I tried to use jQuery.noConflict();  and that also did not work.Please find the code below
<!-- For this example to render properly, you must associate the Visualforce page 
with a valid account record in the URL. 
For example, if 001D000000IRt53 is the account ID, the resulting URL should be: 
https://Salesforce_instance/apex/myPage?id=001D000000IRt53
See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->
                    
<!-- This example shows how to use the tabClass and inactiveTabClass attributes to
change the default styling of the tab bar. Note that in the style definitions,
'background-image:none' is required to override the default image with the
specified color. You can also provide your own image with .css styles. -->
            
<apex:page standardController="Account" showHeader="true">
      <apex:form >
        <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #236FBD; color:white; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
            
   <!--     <script type="text/javascript" language="javascript">
    if(jQuery) {
        jQuery.noConflict();
        alert('hi');
    }
</script> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<!--<script>
$(document).ready(function(){
    $("p").click(function(){
        alert("The paragraph was clicked.");
    });
});
</script>

        <p>Click on this paragraph.</p>
-->

            
    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client"  id="AccountTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="One" name="name1" id="tabOne">content for tab one
        
<apex:page standardController="Account">

        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.site}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
   
</apex:page>
        
        
        </apex:tab>
        <apex:tab label="Two" name="name2" id="tabTwo">
   
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.type}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>

        content for tab two</apex:tab>
    </apex:tabPanel>
        </apex:form>
</apex:page>

 
Hi,

I have a requirement to displaydifferent  pageblocks based on the tab which i click.Any sample examples would be helpful
String s = '\'';
system.debug('s contains single quote='+s.contains('\''));
String s2 = '"';
system.debug('s2 contains double quote='+s2.contains('"'));
String s3 = '\\';
system.debug('s3 contains backslash='+s3.contains('\\'));


String s4 = '''';
system.debug('s2 contains double quote='+s2.contains(''''));

The attachement would give more details....thanks
User-added image
<html>
<body>

<p>A function is triggered when the user is pressing a key in the input field.</p>

<input type="text" onkeypress="myFunction()" placeholder="test" >

<script>
function myFunction() {
    alert("You pressed a key inside the input field");
}
</script>

</body>
</html>

When the panel is getting refreshed the placeholder value is not being displayed.on a portal login

THis issue is only in IE9 but works fine in IE11,Chrome,Mozilla.

Basically the placeholder is not working properly.
Any thoughts on this would be helpful

Thanks
sathish

T
How can i replace cloud logo when we open a vfpage /new tab with our custom logo.

Replace cloud symbol in Leads:Home-Salesforce tab with custom logo
User-added image
Hi,
I need to update the test class to serialize/deserialize json based data.
Can someone pls let me know how to go abt with??
@RestResource(urlMapping='/ApexCallout/*')
global class ApexCallout {
    
    
    @HttpPost
    global static String doPost(String value1, String value2) {
          String passVal = 'TEST';
        try {
            if(value1 == 'Account') {
                Account a = (Account) JSON.deserialize(value2, Account.class);
                if(a.Id == null)
                    insert a;
              }
          
        return passVal;
    }
    
    public static String dmlCallout(String value1, String value2) {
        
        Http rh = new Http();
        HttpRequest req = new HttpRequest();
        req.setMethod('POST');
        req.setHeader('content-type', 'application/json');
        req.setHeader('Host', 'ap1.salesforce.com');
        req.setEndpoint(Endpoint);

        Map<String, String> body = new Map<String, String>();
        body.put('value1', value1);
        body.put('value2', value2);
        String sbody = JSON.serialize(body);

        req.setHeader('Content-Length', String.valueOf(sbody.length()));
        req.setBody(sbody);

        HTTPResponse res = rh.send(req);
        
        if(res.getStatusCode() == 500) {
            String jsonString = res.getBody();
            jsonString = jsonString.substring(1, jsonString.length() - 1);
            Map<String, String> error = (Map<String, String>)JSON.deserialize(jsonString, Map<String, String>.class);
            String errorMsg = error.get('message');
            errorMsg = (errorMsg == null ? '' : errorMsg);
            throw new Exception('' + eMsg + '');
        }
        
        String passVal = res.getBody();
      
        return passVal;
    }
    
    public static String update(Account a) {
        return dmlCallout('Account', JSON.serialize(a));
    }
    
  
}

 
I am writing a test class for a main class that will insert a value into a transaction table based on updates to specific fields in the account object.
I have written the class but i am not able to increase the test coverage.
any help will be appreciated.
public class TX_RecordUpdate {
    
    static Set<String> accfields; // Account fields to be monitored
    
    static {
        
        List<TX__c> customsettingfields = [select Name from TX__c  where Contact__c  = true];////field value getting from custom setting
                accfields = new Set<String>();
        for(TX__c customsettingfield : customsettingfields) {
            accfields.add(customsettingfield.name); // adding the listof fields
            system.debug('accfields will give' + Email, FirstName, LastName, MailingCity);
            
        }
        
        
    }
    
    public static void checkAccount(List<Account> accountList, Map<Id, Account> oldAccounts) {

        List<TX__c> insertevents = new List <TX__c> ();
        for(Account acc : accountList){
            
            Account oldacc = oldAccounts.get(acc.Id);
            for(String acckey : accfields) {  ///// test code coverage not going into this for loop
                if(acc.get(acckey) != oldacc.get(acckey)) {
                    insertevents.add(new TX__c (Action__c  = 'Success');
                    
                }//////
            }
        }
        if(!insertevents.isEmpty()) {
            try {
                insert insertevents;
            } catch (Exception Ex){
            }
        }
        
    }

    }


Test class:



	@isTest(seeAllData=true)

private class Test{

    private static testMethod void myTest() {
       
	   Account testAccount = new Account(Name='test');     
           insert testAccount;                                   
        
       Contact testContact = new Contact();
            testContact.LastName='testName';
            testContact.email = 'testname@gmail.com';
            testContact.AccountId = testAccount.id; 
              insert testContact; 
        
          
			TX__c cs = new TX__c (Name='Billing',Field__c= True);///inserting custom setting data
            insert cs ;    
            
			Account testAccount2 = new Account(Id=testAccount.Id);
           update testAccount2;
                
         
            Map<Id, Account> oldMap = new Map<Id, Account>{testAccount.Id => testAccount};
 
        
              Test.starttest();
              TX_RecordUpdate.checkAccount(new List<Account>{ testAccount2 }, oldMap);
              Test.stoptest();
          }

}
I have a custom setting:
Country__c  with  checkbox fields called  city__c   and 1 normal field.
now my crietra is to fetch the values inside the custom setting only when  city__c checkbox is checked to true. 
now normally:
 
List<Country__c> country = [Select Name from Country__c where City__c = true ];
List<String> fields = new List<String>();
for(Country__c field : country) {
   fields.add(country.name);
}
System.debug(fields);
This works in workbench but i cannot reproduce the same in apex class. i am not able to do  an soql query with filter condition on the apex class.is there any other alternative???
 
Hi,
I am trying to insert data into obj2 based on some condition in obj1 through handler /apex class but it is not working.
Please find the code
trigger orderAccountTransactionUpdate on Account (before update) {

 Order__c  orderAccount = new Order__c();

 system.debug('inside trigger');

orderAccount.lstNewAccounts = Trigger.new;
orderAccount.lstOldAccounts = Trigger.old;

// Trigger Logic – Before Update

    if((Trigger.isAfter && Trigger.isUpdate) ) {
 
  orderAccount.check(Trigger.new, Trigger.oldMap);

    }
    
  }
  
  
  public class OrderAccountTransaction {

    public List<Account> lstNewAccounts = new List<Account>();
    public List<Account> lstOldAccounts = new List<Account>();
    
    public void check(List<Account> Accounts, Map<Id, Account> oldAccount) {
  
    Map<Id, Account> mapVerifyOldAccounts = new Map<Id, Account>();
    List<Order__c> createOrder = new List <Order__c> ();
    
       for(Account acc : Accounts){
			system.debug('Accounts' + Accounts);
			system.debug('oldAccount' + oldAccount);
          Account beforeUpdate = oldAccount.get(acc.Id);
		   
          if(acc.Email!=beforeUpdate.Email) {
		  
		  NOT GOING INSIDE THIS
          
          system.debug('inside if');
              createOrder.add(new Order__c (Action__c  = 'insert',Status__c  = 'success'));
            }                             
    }
    try {
        insert createOrder;
    }
    catch (Exception Ex){
        system.debug(Ex);
    }


}

}



 
Hi all,
i have created a trigger on account object and i need to insert a record into another custom object<
sales__c> based on whether the account field email has changed to a new value from old value.
This is my code. which is not working.can someone let me know where i m going wrong??
trigger CreateSalesAccount on Account  (after update) {


    List<Sales__c> createSales = new List <Sales__c> ();
    for (Account acc : trigger.new) {
       Account  oldAccount = Trigger.oldMap.get(acc.Id);
       String oldEmail = oldAccount.emailaddress__c ;
       String newEmail = acc.emailaddress__c;
    
		if (oldEmail != newEmail) {
               createSales.add(
                    new Sales__c (  Type = 'presales',Error_Message__c  = 'error',Status__c  = 'success'));
            }                             
    }
    try {
        insert createSales;
    }
    catch (Exception Ex){
        system.debug(Ex);
    }
}

 
I have to enable the chat button queue in  live agent so that chats are routed to the queues.
I have gone to Chat Buttons and Automated Invitations--->Enable Queue and tried few other various things but i am not getting this:
User-added image

 i am currenbtly getting only this:
User-added image
Thanks

 
I am creating a custom vf page for live agent so that force.com site users can login and work with live agent
But i am getting a blank page when i create a vfpage with live agent components.
Can someone please advise??
<apex:page showHeader="false">
<style>
body { overflow: hidden; width: 100%; height: 100%; padding: 0; margin: 0 }
#waitingMessage { height: 100%; width: 100%; vertical-align: middle; text-align: center; display: none; }
#liveAgentClientChat.liveAgentStateWaiting #waitingMessage { display: table; }
#liveAgentSaveButton, #liveAgentEndButton { z-index: 2; }
.liveAgentChatInput {
    height: 25px;
    border-width: 1px;
    border-style: solid;
    border-color: #000;
    padding: 2px 0 2px 4px;
    background: #fff;
    display: block;
    width: 99%;
}
.liveAgentSendButton {
    display: block;
    width: 60px;
    height: 31px;
    padding: 0 0 3px;
    position: absolute;
    top: 0;
    right: -67px;
}
#liveAgentChatLog {
    width: auto;
    height: auto;
    top: 0px;
    position: absolute;
    overflow-y: auto;
    left: 0;
    right: 0;
    bottom: 0;
}
</style>
<div style="top: 0; left: 0; right: 0; bottom: 0; position: absolute;">
<liveAgent:clientchat >
    <liveAgent:clientChatSaveButton label="Save Chat" />
    <liveAgent:clientChatEndButton label="End Chat" />
    <div style="top: 25px; left: 5px; right: 5px; bottom: 5px; position: absolute; z-index: 0;">
    <liveAgent:clientChatAlertMessage />
    <liveAgent:clientChatStatusMessage />
    <table id="waitingMessage" cellpadding="0" cellspacing="0">
    <tr>
    <td>Please wait while you are connected to an available agent.</td>
    </tr>
    </table>
    <div style="top: 0; right: 0; bottom: 41px; left: 0; padding: 0; position: absolute; word-wrap: break-word; z-index: 0;">
    <liveAgent:clientChatLog />
    </div>
    <div style="position: absolute; height: auto; right: 0; bottom: 0; left: 0; margin-right: 67px;">
        <liveagent:clientChatInput /><liveAgent:clientChatSendButton label="Send"/>
    </div>
    <div style="position: absolute; height: auto; right: 0; bottom: 0; left: 0; margin-right: 67px;">
        <liveAgent:clientChatFileTransfer id="fileTransfer" fileTransferSendFileLabel="Your file has been successfully uploaded to the agent" rendered="true"/>
        
    </div>    
        
    </div>
</liveAgent:clientchat>
</div>
</apex:page>
I am creating a custom vf page for live agent so that force.com site users can login and work with live agent
But i am getting a blank page when i create a vfpage with live agent components.
Can someone please advise??
<apex:page showHeader="false">
<style>
body { overflow: hidden; width: 100%; height: 100%; padding: 0; margin: 0 }
#waitingMessage { height: 100%; width: 100%; vertical-align: middle; text-align: center; display: none; }
#liveAgentClientChat.liveAgentStateWaiting #waitingMessage { display: table; }
#liveAgentSaveButton, #liveAgentEndButton { z-index: 2; }
.liveAgentChatInput {
    height: 25px;
    border-width: 1px;
    border-style: solid;
    border-color: #000;
    padding: 2px 0 2px 4px;
    background: #fff;
    display: block;
    width: 99%;
}
.liveAgentSendButton {
    display: block;
    width: 60px;
    height: 31px;
    padding: 0 0 3px;
    position: absolute;
    top: 0;
    right: -67px;
}
#liveAgentChatLog {
    width: auto;
    height: auto;
    top: 0px;
    position: absolute;
    overflow-y: auto;
    left: 0;
    right: 0;
    bottom: 0;
}
</style>
<div style="top: 0; left: 0; right: 0; bottom: 0; position: absolute;">
<liveAgent:clientchat >
    <liveAgent:clientChatSaveButton label="Save Chat" />
    <liveAgent:clientChatEndButton label="End Chat" />
    <div style="top: 25px; left: 5px; right: 5px; bottom: 5px; position: absolute; z-index: 0;">
    <liveAgent:clientChatAlertMessage />
    <liveAgent:clientChatStatusMessage />
    <table id="waitingMessage" cellpadding="0" cellspacing="0">
    <tr>
    <td>Please wait while you are connected to an available agent.</td>
    </tr>
    </table>
    <div style="top: 0; right: 0; bottom: 41px; left: 0; padding: 0; position: absolute; word-wrap: break-word; z-index: 0;">
    <liveAgent:clientChatLog />
    </div>
    <div style="position: absolute; height: auto; right: 0; bottom: 0; left: 0; margin-right: 67px;">
        <liveagent:clientChatInput /><liveAgent:clientChatSendButton label="Send"/>
    </div>
    <div style="position: absolute; height: auto; right: 0; bottom: 0; left: 0; margin-right: 67px;">
        <liveAgent:clientChatFileTransfer id="fileTransfer" fileTransferSendFileLabel="Your file has been successfully uploaded to the agent" rendered="true"/>
        
    </div>    
        
    </div>
</liveAgent:clientchat>
</div>
</apex:page>

 
Hi,
Is there a way to retain the apex:command button colour even after the form is re-rendered
<apex:page standardController="Account">
    <apex:form id="f" >
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" onclick="this.style.background='blue';" reRender="f"  value="Save"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    <apex:outputText>test button colour</apex:outputText>
    </apex:form>
</apex:page>

 and some action like create/update is performed.
When i hit the save buton colour changes and reverts back to the original colour.any possible workaround will be helpful.
 
Hi , I have 3 command buttons with different logics to be processed on each.
Now i want the command button to be higlighted on click and when 2nd buttton is clicked then only 2nd button must be highlighted.
Is it possible???
<apex:page controller="HideAndShow">
<apex:form >
<apex:commandButton value="firstButton" action="{!firstButton}"/>
<apex:commandButton value="SecondButton" action="{!secondButton}"/>
<apex:commandButton value="thirddButton" action="{!thirdButton}"/>
<apex:outputPanel id="one" title="one" rendered="{!firstPanel}">
<apex:pageblock >
<apex:pageblockSection >


<p>1111111111111111</p> </apex:pageblockSection></apex:pageblock>
</apex:outputPanel>

<apex:outputPanel id="two" title="two" rendered="{!secondPanel}">
<p>222222222222</p>
</apex:outputPanel>
<apex:outputPanel id="three" title="three" rendered="{!thirdPanel}">
<p>3333333333333</p>
</apex:outputPanel>

  </apex:form>

</apex:page>

 
<html>
<body>

<p>A function is triggered when the user is pressing a key in the input field.</p>

<input type="text" onkeypress="myFunction()" placeholder="test" >

<script>
function myFunction() {
    alert("You pressed a key inside the input field");
}
</script>

</body>
</html>

When the panel is getting refreshed the placeholder value is not being displayed.on a portal login

THis issue is only in IE9 but works fine in IE11,Chrome,Mozilla.

Basically the placeholder is not working properly.
Any thoughts on this would be helpful

Thanks
sathish

T
I have to enable the chat button queue in  live agent so that chats are routed to the queues.
I have gone to Chat Buttons and Automated Invitations--->Enable Queue and tried few other various things but i am not getting this:
User-added image

 i am currenbtly getting only this:
User-added image
Thanks

 
I am creating a custom vf page for live agent so that force.com site users can login and work with live agent
But i am getting a blank page when i create a vfpage with live agent components.
Can someone please advise??
<apex:page showHeader="false">
<style>
body { overflow: hidden; width: 100%; height: 100%; padding: 0; margin: 0 }
#waitingMessage { height: 100%; width: 100%; vertical-align: middle; text-align: center; display: none; }
#liveAgentClientChat.liveAgentStateWaiting #waitingMessage { display: table; }
#liveAgentSaveButton, #liveAgentEndButton { z-index: 2; }
.liveAgentChatInput {
    height: 25px;
    border-width: 1px;
    border-style: solid;
    border-color: #000;
    padding: 2px 0 2px 4px;
    background: #fff;
    display: block;
    width: 99%;
}
.liveAgentSendButton {
    display: block;
    width: 60px;
    height: 31px;
    padding: 0 0 3px;
    position: absolute;
    top: 0;
    right: -67px;
}
#liveAgentChatLog {
    width: auto;
    height: auto;
    top: 0px;
    position: absolute;
    overflow-y: auto;
    left: 0;
    right: 0;
    bottom: 0;
}
</style>
<div style="top: 0; left: 0; right: 0; bottom: 0; position: absolute;">
<liveAgent:clientchat >
    <liveAgent:clientChatSaveButton label="Save Chat" />
    <liveAgent:clientChatEndButton label="End Chat" />
    <div style="top: 25px; left: 5px; right: 5px; bottom: 5px; position: absolute; z-index: 0;">
    <liveAgent:clientChatAlertMessage />
    <liveAgent:clientChatStatusMessage />
    <table id="waitingMessage" cellpadding="0" cellspacing="0">
    <tr>
    <td>Please wait while you are connected to an available agent.</td>
    </tr>
    </table>
    <div style="top: 0; right: 0; bottom: 41px; left: 0; padding: 0; position: absolute; word-wrap: break-word; z-index: 0;">
    <liveAgent:clientChatLog />
    </div>
    <div style="position: absolute; height: auto; right: 0; bottom: 0; left: 0; margin-right: 67px;">
        <liveagent:clientChatInput /><liveAgent:clientChatSendButton label="Send"/>
    </div>
    <div style="position: absolute; height: auto; right: 0; bottom: 0; left: 0; margin-right: 67px;">
        <liveAgent:clientChatFileTransfer id="fileTransfer" fileTransferSendFileLabel="Your file has been successfully uploaded to the agent" rendered="true"/>
        
    </div>    
        
    </div>
</liveAgent:clientchat>
</div>
</apex:page>
Hi 
i am getting the below error while working with the apexpage and visualforce page
 
VFPage name:UserOOO

<apex:page standardController="User" extensions="AbcExtension" action="{!processLinkClick}">
<!-- extensions="newvsold" action="{!pageredir}"> !-->
<apex:form >
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandLink action="{!save}" value="Save">
              </apex:commandLink>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section" columns="2" >
                <apex:inputField value="{!user.Out_Of_Office__c}" />
                <apex:inputField value="{!User.LastName}" />
                 <apex:inputField value="{!User.LastName}" />
                  <apex:inputField value="{!User.Alias}" />
                    <apex:inputField value="{!User.Email}" /> 
                    <apex:inputField value="{!User.CommunityNickname}" /> 
                    <apex:inputField value="{!User.TimeZoneSidKey}" /> 
                    <apex:inputField value="{!User.LocaleSidKey}" /> 
                    <apex:inputField value="{!User.EmailEncodingKey}" /> 
                    <apex:outputField value="{!User.ProfileID}" /> 
                    <apex:inputField value="{!User.LanguageLocaleKey}" /> 
                    
                     
 
            </apex:pageBlockSection>
          </apex:pageBlock>
    </apex:form>
</apex:page>



class:


public with sharing class AbcExtension{

    private ApexPages.StandardController controller {get; set;}
     public User contact {get;set;}
    public String u {get; set;}

	
	
	

	
    // initialize the controller
    public AbcExtension(ApexPages.StandardController controller) {

      
    }

    // handle the action of the commandlink
    public PageReference processLinkClick() {
    
       u = Userinfo.getUserId();

         system.debug('insiddeee idd ' + u);
      PageReference nextpage = new PageReference('/apex/UserOOO?id='+u);
                return nextpage;
    
  }

}

Basically i am appending the logged in userid to the vfpage so that userid can be passed as parameter and the 
page is edited.


URL error::Cyclical server-side forwards detected: /apex/UserOOO1?id=00590000000iUwAAAU&inline=1 

Thanks
sathish

 
I have written trigger on emailmessage object which will update a field in the USer object.
trigger EmailMessageAfterUpdate on EmailMessage (before insert) {
    
        Set<Id> ownerIds = new Set<Id>();
        
       for(EmailMessage eMsg : Trigger.new) { 
           
              Map<Id, User> mapUsers = new Map<Id, User>([SELECT Id,Out_of_Office_Email_Address__c ,Name FROM User WHERE out_of_office__c = true]);
              
             List<Case> caseList = [SELECT id,ownerId,Owner.Name,assignee__c ,Description, caseNumber FROM Case WHERE Id = :eMsg.ParentId ];
               system.debug('caseList' + caseList);
                    for(Case cse :caseList )
                      {
                      
                              User u = new User();
                        system.debug('inside for loop');
                        
                         if(mapUsers.containsKey(cse.ownerId)) {
                                              
                           system.debug('inside mapusers');
                            system.debug('from' + emsg.FromAddress); 
                          
                             eMsg.Fromaddress = cse.Assignee__c ;
                             eMsg.FromAddress = u.Out_of_Office_Email_Address__c;----not able to update this lie
                             system.debug('email' + u.Out_of_Office_Email_Address__c );
                              system.debug('from1' + emsg.FromAddress); 
                                    
                        }
                   }
                    update caseList;  
                   
                     
            
                 
              }                    
         }
But i am not able to update.Any suggestions wll be helpful.
Hi,
I am having 2 objects case and UserObject<No relationship between them>
In User object i have Checkbox field which will be checked to true/false by the corresponding user.

I m trying to check whether the CaseOwner Id of the particular case has User chexkbox field checked <in the User Object> and if so an email message will be sent.
trigger EmailMessageAfterUpdate on EmailMessage (after insert) {
    
      for(EmailMessage eMsg : Trigger.new) {
      
      User u = new User();
      
        List<Case> c = [SELECT id,ownerId, Description, caseNumber FROM Case WHERE Id = :eMsg.ParentId ];
        

}

Can someone let me know how to proceed?
Thanks

 
I m getting error for this.Basically i am populating an value in the Texbox and querying the searchstring value in the apex class.Can someoneone help me.I am getting invalid conversion error.How to pass the searchstring value into the soql query??
vfpage::

<apex:page controller ="documentSearch">  
  <apex:form >  
 <apex:inputText value="{!searchstring}" label="Input"/>   
  <apex:commandButton value="Search records" action="{!search}"/>  
   <apex:pageBlock title="Search Result">  
    <apex:pageblockTable value="{!acc}" var="a">  
     <apex:column >  
       </apex:column>  
     </apex:pageBlockTable>     
   </apex:pageBlock>   
  </apex:form>  
 </apex:page>  


class::


public with sharing class documentSearch { 

 
   public list <Document__c> acc {get;set;}  
   public string searchstring {get;set;}  
    
     public documentSearch () { }
    
     public void search(){  
       string query = 'select id,name,description  from attachment where parentID =:searchstring';
        system.debug('query ' + query ); 
       
       acc= Database.query(query);  
       
       
   }

THanks

 
why is list ordered and map/set are unordered??
can someone explain in detail.i know that list is ordered and set is unordered
Hi,
i have created a trigger on task so that task records cannot be deleted for a particular profile/record type:

trigger taskDelete on Task (before delete)
{
      system.debug('inside taskdelete');
      Id taskId;
      ID shipperRecordType = [SELECT Id FROM RecordType WHERE Name = 'Interaction'].Id;
       for(task a:Trigger.old)
        {
          if(shipperRecordType == a.recordTypeId)
          {
            system.debug('a.recordTypeId' + a.recordTypeId);
            system.debug('shipperRecordType'+ shipperRecordType);
            a.addErro.('you cannot delete this task');
          }
         
       }

the trigger is working properly but the error message is coming like this on the next page:

Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "you cannot delete this task".
      
Is there any workaround for this???
Thanks

Hi team!

 

I have a requirement to prevent some users from deletion on tasks that are assigned to them.

SFDc support advised us to make a trigger to have that behavior.

When the trigger is fired, everyone has this error when they click on delete and I would like that Admins and 2 other Profiles could delete the tasks if needed.

 

Validation Errors

 

While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger NoDeleteonIsAssignedTask caused an unexpected exception, contact your administrator: NoDeleteonIsAssignedTask: execution of BeforeDelete caused by: System.FinalException: Record is read-only: Trigger.NoDeleteonIsAssignedTask: line 6, column 1". Click here to return to the previous page.

 

 

My trigger :

trigger NoDeleteonIsAssignedTask on Task (before delete) 
 {
String ProfileId = UserInfo.getProfileId();  
for (Task a : Trigger.old)      
            
IF(a.Is_Assignment__c=True &&(ProfileId!='00e20000000qb49' ||ProfileId !='00eP0000000M0nd'||ProfileId !='00e20000000ju28'))
{
     a.addError('You can\'t delete this record!');
     
            }
        }

 I would very much appreciate if someone could help me in writing this trigger on task before delete to prevent the users to deltee their tasks except for the 3 admin profiles .

 

Thanks in advance for your help.

 

Kind Regards,

Ludivine

How to check whether the string contains singlequote, double quote, and blacklash (\)

 

i am not able to use the sring contains function  for these 3 things.

  • December 13, 2012
  • Like
  • 0