• Ramadhar Mishra
  • NEWBIE
  • 0 Points
  • Member since 2008
  • Cognizant Technology Solutions

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 11
    Replies
Hi All,

Is there any way to find and REPORT is Standard Or Custom ?

Thanks in Advance!
 

I've one custom object on this custom object I've one approval process.

 

in final approval action I've one field update : IsCommentscopy__c==true.

 

I've one before update trigger on same object where I've below code:

 

 
Name
Version
Namespace
Type
Salesforce.com API29.0 Salesforce.com API
Apttus Contract Management6.126Apttus Installed Package
Apttus Echosign Integration1.45Apttus_Echosign Installed Package
DiscoverOrg1.75DiscoverOrg Installed Package
EchoSign12.6echosign_dev1 Installed Package
Eloqua1.3ELOQUA Installed Package
GridBuddy3.24GBLite Installed Package
Indicee Analytics3.8indicee_apps Installed Package
Informatica Data Loader4.0INFA Installed Package
LOOP9.49Loop Installed Package
NetProspex Executive Directory2.5Netprx Installed Package
Nitro for Salesforce1.87nitro Installed Package
Object Console1.9obj_con Installed Package
OrgChartPlus1.23OrgChartPlus Installed Package
Salesforce clients connected apps1.5sf_com_apps Installed Package
Walker PowerInsights1.16Walker_Info Installed Package
Override Log Filters
CategoryLevel
DatabaseNONEERRORWARNINFODEBUGFINEFINERFINEST
WorkflowNONEERRORWARNINFODEBUGFINEFINERFINEST
ValidationNONEERRORWARNINFODEBUGFINEFINERFINEST
CalloutsNONEERRORWARNINFODEBUGFINEFINERFINEST
Apex CodeNONEERRORWARNINFODEBUGFINEFINERFINEST
Apex ProfilingNONEERRORWARNINFODEBUGFINEFINERFINEST
SystemNONEERRORWARNINFODEBUGFINEFINERFINEST
 
trigger SP_copyComments_Trigger on SP_Milestone__c (before update) {
System.debug('SP_copycomments_Trigger called ##');  
String commentsStr='';
  set<id> setmiles=new set<id>();
  for(SP_Milestone__c m : Trigger.New){
    if(m.IsCommentscopy__c){
       setmiles.add(m.id);
    }  
  }
   for (ProcessInstance pi : [SELECT TargetObjectId,
                              ( 
                                 SELECT Id, Comments
                                 FROM Steps                                                               
                              )
                               FROM ProcessInstance
                               WHERE TargetObjectId In :setmiles
                             ])
    {   
     if(pi.steps.size() >0){
       trigger.new[0].BDM_Approver_comments__c=pi.steps[0].Comments ;   
       }   
    }  
}
 
The comments value coming as null. Can any one help.
 
 
Thanks in advanced.
 
Ramadhar Mishra
 

Hi All,

 

i have following apex class. when calling through apex trigger getting following error.

 

System.HttpResponse[Status=Unsupported Media Type, StatusCode=415]

 

Can any one suggest what the mistake im doing in below code.

 

global class CaseRestService2{
@future (callout=true)
global static void sendChangeOwnerid(){

HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();

req.setEndpoint('http://dev1sfdc.caremark.com/BenefitBuilderWeb/Notification?wsdl');

req.setMethod('POST');
String name ='Rahul';
String City='Delhi';

req.setHeader('content-type', 'text/html');
//req.setHeader('Accept', 'application/xml');
req.setHeader('Content-Length','1024');
req.setHeader('Host','dev1sfdc.caremark.com');


req.setBody('name='+EncodingUtil.urlEncode(name, 'UTF-8')+'&city='+EncodingUtil.urlEncode(city, 'UTF-8'));
req.setCompressed(true); // otherwise we hit a limit of 32000

try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
System.debug(res.toString());
}
// System.debug(res.getBody());
}
}

Hi , I have following Vf page there I have tab panel with 5 different tabs While click on first 'Language' tab it i not displaying the Selected items in Selected Panel section in right hand side but while selecting Last tab 'Others' it is displaying the selected items. Can any one suggest what wrong I am doing. VF code as follows.....................

 

VF Page ####

<apex:page controller="ctlr_Checkbox_Class" Tabstyle="Account" sidebar="false" showHeader="true">

<style type="text/css">

.customPopup{
background-color: white;
border-style: solid;
border-width: 2px;
left: 50%;
padding:1px;
position: absolute;
z-index:9;
/* These are the 3 css properties you will need to tweak so the pop
up displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can also add
the height property for a fixed size pop up.*/
width: 800px;
margin-left: -400px;
top:100px;
}

.customNewPopup{
background-color: white;
border-style: solid;
border-width: 1px;
left: 50%;
padding:5px;
position: absolute;
z-index: 9;
/* These are the 3 css properties you will need to tweak so the pop
up displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can also add
the height property for a fixed size pop up.*/
width: 700px;
margin-left: -350px;
top:100px;
}

.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 50);
position:absolute;
width: 95%;
height: 95%;
top: 0;
left: 0;
z-index:8;

}
.buttonStyle{
text-align: right;
}

.customNewPopupRelative{
background-color: white;
border-style: solid;
border-width: 1px;
left: 50%;
padding:5px;
position: relative;
z-index: 9;
/* These are the 3 css properties you will need to tweak so the pop
up displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can also add
the height property for a fixed size pop up.*/
width: 700px;
margin-left: -350px;
top:10px;
}


</style>

<script language="javascript">
function DummyHold() {
// Dummy Empty Method
}
</script>

<apex:form >
<apex:pageBlock >
Test1: :::::{!Selected2}
Test2: :::::{!Selected}
<apex:pageBlockSection Title="List of Available Templates" collapsible="false">
<apex:tabPanel switchType="client" value="{!selectTab}" selectedTab="name1" id="theTabPanel" width="100%" tabClass="activeTab" inactiveTabClass="inactiveTab" title="List of Available Templates">
<!--
<apex:tab label="Language" name="name1" id="tabOne">
<apex:PageblockTable value="{!AccountsforLanguage}" var="a1" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!a1.selected}" id="checkedone1">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/>
</apex:inputCheckbox>
</apex:column>

<apex:column headervalue="Template Name" value="{!a1.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Template ID" value="{!a1.acc.Name}" width="250" />
<apex:column headervalue="Record Type" value="{!a1.acc.RecordType.Name}" width="200"/>

</apex:PageblockTable>
</apex:tab>

--->


<apex:tab label="Language" name="name1" id="tab1">
<apex:PageblockTable value="{!accountsforlanguage}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" reRender="Selected_PBS" id="first"/>
</apex:inputCheckbox>
</apex:facet>
<apex:inputCheckbox value="{!a.selected}" id="checkedone1">
<apex:actionSupport event="onclick" action="{!GetSelected2}" reRender="Selected_PBS" id="second"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!a.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!a.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!a.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>


<apex:tab label="Insurance" name="name2" id="tab2">
<apex:PageblockTable value="{!AccountsforInsurance}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!a.selected}" id="checkedone2">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS,form"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!a.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!a.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!a.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>

<apex:tab label="Diversity" name="name3" id="tab3">
<apex:PageblockTable value="{!AccountsforDiversity}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!a.selected}" id="checkedone3">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS,form"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!a.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!a.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!a.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>

<apex:tab label="Document" name="name4" id="tab4">
<apex:PageblockTable value="{!accounts}" var="d" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!d.selected}" id="checkedone4">
<apex:actionSupport event="onclick" action="{!GetSelected2}" rerender="Selected_PBS,form"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!d.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!d.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!d.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>


<apex:tab label="Others" name="name5" id="tab5">
<apex:PageblockTable value="{!accountsforOthers}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!a.selected}" id="checkedone5">
<apex:actionSupport event="onclick" action="{!GetSelected2}" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!a.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!a.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!a.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>


</apex:tabPanel>
<!-- </apex:pageBlockSection> -->


<apex:outputPanel id="Selected_PBS" title="Selected Templates" layout="block">

<!-- <table> <tr><td style="font-weight: bold"> Selected Templates </td></tr></table> --->
<!-- <apex:sectionHeader title="Selected Templates" /> --->
<apex:pageBlock title="Selected Templates">


<!-- <apex:pageBlockSection Title="Selected Templates" id="Selected_PBS"> --->
<apex:PageBlockTable value="{!SelectedAccounts}" var="s" columnswidth="350px,350px" cellpadding="4" border="1" >
<!--- <apex:outputLink value="{$!s.Name}" rendered="{$!s.Name}" >{$!s.Name}</apex:outputLink> --->

<apex:column headervalue="Template Name" value="{!s.Template_Library_Name__c}" />
<apex:column headervalue="Record Type" value="{!s.RecordType.Name}" />
<apex:column width="350px!important">
<apex:facet name="header" > Edit and Save </apex:facet>
<!--
<apex:outputPanel styleClass="customNewPopup" layout="block" rendered="{!displaypopup1}">
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" style="vertical-align:middle;width:80px;height:20px;"/>
<apex:commandButton value="Cancel" action="{!closepopup1}" style="vertical-align:middle;width:80px;height:20px;"/>
</apex:pageBlockButtons>

</apex:pageBlock>
</apex:outputPanel>
-->


<apex:outputLink rendered="true" onclick="window.open('/apex/NewTemplateRequirementTL?templId={!s.Id}&progId={!progId}','myWindow','width=800,height=410,toolbar=0,status=1,scrollbars=1,resizable=yes,getCall(this)'); return false;"> Edit </apex:outputLink>
<apex:outputLink rendered="false" onclick="window.open('/apex/NewTemplateRequirementTL?templId={!s.Id}&progId={!progId}','myWindow','width=800,height=410,toolbar=0,status=1,scrollbars=1,resizable=yes'); return false;"> Modify/Delete </apex:outputLink>
</apex:column>
</apex:pageblocktable>

</apex:pageBlock>
<br/>
<table align="right"> <tr><td style="font-weight: bold" > <apex:commandButton value="Submit"/> </td></tr></table>
</apex:outputPanel>
</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

<!-- </apex:pageBlock> --->


<script>
function checkAll(cb){
var inputElem = document.getElementsByTagName("input");
for(var i=0; i<inputElem.length; i++){
//if(inputElem[i].id.indexOf("checkedone")!=-1)
inputElem[i].checked = cb.checked;
}
var tabname=getSelectedTabName();
alert('This is the tab selected....'+tabname);
}

function getSelectedTabName() {
if (RichFaces) {
var tabs = RichFaces.panelTabs['p:f:tp'];
for (var i = 0; i < tabs.length; i++) {
var tab = tabs[i];
if (RichFaces.isTabActive(tab.id + '_lbl')) {

return tab.name;
}
}
}
return null;
}


</script>

</apex:page>

 

 

 

Apex Class ###

 

 

public class ctlr_Checkbox_Class
{
/*
* This source code was written by Kumar Narasimha.

*/

List<accountwrapper> accountListIns = new List<accountwrapper>();
List<accountwrapper> accountListDoc = new List<accountwrapper>();
List<accountwrapper> accountListDiv = new List<accountwrapper>();
List<accountwrapper> accountListLangOther = new List<accountwrapper>();
List<accountwrapper> accountList = new List<accountwrapper>();

List<Template_Library__c> selectedAccounts = new List<Template_Library__c>();

// Map will store the records those are finally ready for insert in database
Map <ID,Template_Library__c> mapModifiedAccounts=new Map <ID,Template_Library__c>();


public String progId {get; set;}

public boolean linktype{get;set;}

public string selectTab{get; set; }



public ctlr_Checkbox_Class() {
progId = ApexPages.currentPage().getParameters().get('progId');
}

public List<accountwrapper> getAccounts()
{
accountList = new List<accountwrapper>();

for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='Document' order by Name Desc])
accountList.add(new accountwrapper(a));
return accountList;
}



public List<accountwrapper> getAccountsforDiversity()
{
accountList = new List<accountwrapper>();

for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='Diversity' order by Name Desc])
accountList.add(new accountwrapper(a));
return accountList;
}



public List<accountwrapper> getAccountsforInsurance()
{
accountList = new List<accountwrapper>();
for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='Insurance' order by Name Desc])
accountList.add(new accountwrapper(a));
return accountList;
}


public List<accountwrapper> getAccountsforLanguage()
{
accountList = new List<accountwrapper>();

for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='Language' order by Name Desc])
accountList.add(new accountwrapper(a));
return accountList;
}


public List<accountwrapper> getAccountsforOthers()
{

accountList = new List<accountwrapper>();

for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='COI' OR RecordType.Name='Contractor Validation Worksheet' order by Name Desc])

accountList.add(new accountwrapper(a));
return accountList;
}

public PageReference getSelected()
{
selectedAccounts.clear();
for(accountwrapper accwrapper : accountList)
if(accwrapper.selected == true)
selectedAccounts.add(accwrapper.acc);

System.debug('These are the selected Records...................................................................');
for(Template_Library__c con : selectedAccounts) {
system.debug(con.Name);
}
return null;
}

public PageReference getSelected2()
{
selectedAccounts.clear();
for(accountwrapper accwrapper : accountList)
if(accwrapper.selected == true){
selectedAccounts.add(accwrapper.acc);
}
return null;
}

public Map<ID,Template_Library__c> getModifiedAccounts(){
if(selectedAccounts.size()>0){
for(Template_Library__c con : selectedAccounts){
system.debug(con.Name);
mapModifiedAccounts.put(con.ID,con);
}
return mapModifiedAccounts;
}
return null;
}

public List<Template_Library__c> GetSelectedAccounts()
{
if(selectedAccounts.size()>0)
return selectedAccounts;
else
return null;
}



public class accountwrapper
{
public Template_Library__c acc{get; set;}
public Boolean selected {get; set;}
public accountwrapper(Template_Library__c a)
{
acc = a;
selected = false;
}
}


// ---------------------------- POP UP Junk -------------------------

public Boolean displayPopup1 {get; set;}

public void showpopup1(){
displayPopup1 = true ;
}

public void closepopup1(){
displayPopup1 = false ;
}

// -------------------------------------------------------------------

}

Hi All, I am getting following error message while Installing Force.com Plugins.. Eclipse Version : 3.6 Platform : Window's xp An error occurred while collecting items to be installed session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). Problems downloading artifact: osgi.bundle,com.salesforce.ide.api,24.0.0.201202291629. MD5 hash is not as expected. Expected: 7251ab037ae632a5a9835c7c07210451 and found f663af525ce4de0c678c7dc323180130. Problems downloading artifact: osgi.bundle,com.salesforce.ide.documentation,24.0.0.201202291629. MD5 hash is not as expected. Expected: 6d87eb2e76e7e19f7b709682e5272dfc and found a11e7953f0c3d905bf1c6fc69235408e. Can some one let me know why this error is coming. How I can rectify this issue. Thanks, Ram
I am getting the following error message while running the Apex batch. Can any one suggest me that what is the reason why I am getting this error. Error Message : "All attempts to execute message failed, message was put on dead message queue". Regards, Ram

Hi All,

 

I have Account hierarchy in my project and the max level of depth is 7 level.

My client requirement is to while showing the hierarchy the top most node should show the cumulative count of child in hierarchy.

I am looking an approach  to show cumulative count of all nodes ie. like for node Test 1 [cumulative count :7].

For example I have

 

Test1   [cumulative count : 7]

   |

   |

Test2 --------------------------

  |                |                     |

  |              Test21          Test 22

Test3   ---------------------------

  |               |                     |

  |             Test31          Test32

Test4

 For the above hierarchy For the node (Test1) cumulative count should be 7.

 

 

 

Thanks,

I have an account hierarchy in my project. I have to count cumulative child for all account and store into Child_count__c in Account. I wrote the following Batch apex, but not getting success. Please let me know any right approach.
Batch Apex code as follows:

global class AccountChild_count implements Database.Batchable<sObject>{
     global Database.QueryLocator start(Database.BatchableContext BC){      
          return Database.getQueryLocator('Select Id, ParentId, Parent.ParentId, Parent.Parent.ParentId,Parent.Parent.Parent.ParentId, Parent.Parent.Parent.Parent.ParentId,Parent.Parent.Parent.Parent.Parent.ParentId from account where ACCT_STATUS__c=\'ACTIVE\' AND COUNTRY_FORM__c=\'USA\' LIMIT 5');   
          }   
          global void execute(Database.BatchableContext BC, List<sObject> scope){     
          try{    
              Map<ID, String> map_str1 =  new Map<Id, String>();    
              Map<ID, Account> map_str2 =  new Map<Id, Account>();    
              String str_of_Ids;    
              for(Integer i=0;i<scope.size();i++){           
                  Account acc=(Account)scope.get(i);           
                    str_of_Ids=String.ValueOf(acc.ParentId)+','+acc.Parent.ParentId+','+acc.Parent.Parent.ParentId+','+acc.Parent.Parent.Parent.ParentId+','+acc.Parent.Parent.Parent.Parent.ParentId+','+acc.Parent.Parent.Parent.Parent.Parent.ParentId;           
                    map_str1.put(acc.id, str_of_Ids);           
                    map_str2.put(acc.id, acc);    
                    }         
                    List <Account> accList=map_str2.values();        
                    for(Account acc1 :accList){          
                        acc1.Parent_ID_List__c=map_str1.get(acc1.id);                
                        }     
                        update accList;  
                         
                    for(Account acc2:accList){
                        Integer intNumberOfContacts = [SELECT count()FROM Account WHERE Parent_ID_List__c Like : acc2.ID];          
                        acc2.Child_Count__c=intNumberOfContacts;      
                    }    
                    update accList;
                       
                    }catch(Exception ex){    }      
                    }   
                    global void finish(Database.BatchableContext BC){   
                    }  
  }

Hi , I have created Business hours and holidays also associated the Holiday to Business Hours. Now I need to get no of holidays for a business hours in Apex class . But there is no reference of Business Hours in Holidays Object. Could you please suggest any work around . Thanks, Ram

I am getting the following error message : Please some one help me to getrid off this problem .

 

 

Error:

Update failed. First exception on row 0 with id 500Q0000002FHIoIAO; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, RecordType_Change: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 500Q0000002FHIoIAO; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 500Q0000002FHIo) is currently in trigger RecordType_Change, therefore it cannot recursively update itself: [] Trigger.RecordType_Change: line 12, column 16: []

 

 

trigger RecordType_Change on Case (before Update) {
IF(Trigger.isUpdate){
IF(!CaseRecordTypeUpdate.flag){
List<Case> listCaseold = [Select Id,Accountability__c,Accountable_Agent_VF__c,RecordType.Name from Case where ID =:Trigger.Old[0].ID];
List<Case> listCasenew = [Select Id,Accountability__c,Cause_Level_1__c,Accountable_Agent_VF__c,RecordType.Name from Case where ID =:Trigger.new[0].ID];       
IF(listCaseold[0].RecordType.Name.equalsIgnoreCase('csi')){
          IF(listCasenew[0].Accountability__c.equalsIgnoreCase('AXP') && listCasenew[0].Cause_Level_1__c.equalsIgnoreCase('Service Quality')){    
               RecordType objRec=[Select Id from RecordType where Name =: 'quick feedback'];
               listCasenew[0].RecordType.Name=objRec.ID;
               System.debug('Record Type  :'+objRec.ID);
               listCasenew[0].Accountable_Agent2__c=listCaseold[0].Accountable_Agent_VF__c;                 
               update listCasenew[0];  
     }
   }
}
CaseRecordTypeUpdate.flag=false;
}
}

 

Thanks,

Ram

Hi All,

 

 Any one pls help me on it............How I could achive?

 

In New task page we have Reminder Section. I want reminder setting as per the following way......

1). If user selects "Reminder" check box then changes the Time----> Reminder should come at the changed Time.

2). If user don't select "Reminder", then Reminder should come Current Time 1 hr.

 

Thanks in Advanced

 

 

I've one custom object on this custom object I've one approval process.

 

in final approval action I've one field update : IsCommentscopy__c==true.

 

I've one before update trigger on same object where I've below code:

 

 
Name
Version
Namespace
Type
Salesforce.com API29.0 Salesforce.com API
Apttus Contract Management6.126Apttus Installed Package
Apttus Echosign Integration1.45Apttus_Echosign Installed Package
DiscoverOrg1.75DiscoverOrg Installed Package
EchoSign12.6echosign_dev1 Installed Package
Eloqua1.3ELOQUA Installed Package
GridBuddy3.24GBLite Installed Package
Indicee Analytics3.8indicee_apps Installed Package
Informatica Data Loader4.0INFA Installed Package
LOOP9.49Loop Installed Package
NetProspex Executive Directory2.5Netprx Installed Package
Nitro for Salesforce1.87nitro Installed Package
Object Console1.9obj_con Installed Package
OrgChartPlus1.23OrgChartPlus Installed Package
Salesforce clients connected apps1.5sf_com_apps Installed Package
Walker PowerInsights1.16Walker_Info Installed Package
Override Log Filters
CategoryLevel
DatabaseNONEERRORWARNINFODEBUGFINEFINERFINEST
WorkflowNONEERRORWARNINFODEBUGFINEFINERFINEST
ValidationNONEERRORWARNINFODEBUGFINEFINERFINEST
CalloutsNONEERRORWARNINFODEBUGFINEFINERFINEST
Apex CodeNONEERRORWARNINFODEBUGFINEFINERFINEST
Apex ProfilingNONEERRORWARNINFODEBUGFINEFINERFINEST
SystemNONEERRORWARNINFODEBUGFINEFINERFINEST
 
trigger SP_copyComments_Trigger on SP_Milestone__c (before update) {
System.debug('SP_copycomments_Trigger called ##');  
String commentsStr='';
  set<id> setmiles=new set<id>();
  for(SP_Milestone__c m : Trigger.New){
    if(m.IsCommentscopy__c){
       setmiles.add(m.id);
    }  
  }
   for (ProcessInstance pi : [SELECT TargetObjectId,
                              ( 
                                 SELECT Id, Comments
                                 FROM Steps                                                               
                              )
                               FROM ProcessInstance
                               WHERE TargetObjectId In :setmiles
                             ])
    {   
     if(pi.steps.size() >0){
       trigger.new[0].BDM_Approver_comments__c=pi.steps[0].Comments ;   
       }   
    }  
}
 
The comments value coming as null. Can any one help.
 
 
Thanks in advanced.
 
Ramadhar Mishra
 

Hi , I have following Vf page there I have tab panel with 5 different tabs While click on first 'Language' tab it i not displaying the Selected items in Selected Panel section in right hand side but while selecting Last tab 'Others' it is displaying the selected items. Can any one suggest what wrong I am doing. VF code as follows.....................

 

VF Page ####

<apex:page controller="ctlr_Checkbox_Class" Tabstyle="Account" sidebar="false" showHeader="true">

<style type="text/css">

.customPopup{
background-color: white;
border-style: solid;
border-width: 2px;
left: 50%;
padding:1px;
position: absolute;
z-index:9;
/* These are the 3 css properties you will need to tweak so the pop
up displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can also add
the height property for a fixed size pop up.*/
width: 800px;
margin-left: -400px;
top:100px;
}

.customNewPopup{
background-color: white;
border-style: solid;
border-width: 1px;
left: 50%;
padding:5px;
position: absolute;
z-index: 9;
/* These are the 3 css properties you will need to tweak so the pop
up displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can also add
the height property for a fixed size pop up.*/
width: 700px;
margin-left: -350px;
top:100px;
}

.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 50);
position:absolute;
width: 95%;
height: 95%;
top: 0;
left: 0;
z-index:8;

}
.buttonStyle{
text-align: right;
}

.customNewPopupRelative{
background-color: white;
border-style: solid;
border-width: 1px;
left: 50%;
padding:5px;
position: relative;
z-index: 9;
/* These are the 3 css properties you will need to tweak so the pop
up displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can also add
the height property for a fixed size pop up.*/
width: 700px;
margin-left: -350px;
top:10px;
}


</style>

<script language="javascript">
function DummyHold() {
// Dummy Empty Method
}
</script>

<apex:form >
<apex:pageBlock >
Test1: :::::{!Selected2}
Test2: :::::{!Selected}
<apex:pageBlockSection Title="List of Available Templates" collapsible="false">
<apex:tabPanel switchType="client" value="{!selectTab}" selectedTab="name1" id="theTabPanel" width="100%" tabClass="activeTab" inactiveTabClass="inactiveTab" title="List of Available Templates">
<!--
<apex:tab label="Language" name="name1" id="tabOne">
<apex:PageblockTable value="{!AccountsforLanguage}" var="a1" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!a1.selected}" id="checkedone1">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/>
</apex:inputCheckbox>
</apex:column>

<apex:column headervalue="Template Name" value="{!a1.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Template ID" value="{!a1.acc.Name}" width="250" />
<apex:column headervalue="Record Type" value="{!a1.acc.RecordType.Name}" width="200"/>

</apex:PageblockTable>
</apex:tab>

--->


<apex:tab label="Language" name="name1" id="tab1">
<apex:PageblockTable value="{!accountsforlanguage}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" reRender="Selected_PBS" id="first"/>
</apex:inputCheckbox>
</apex:facet>
<apex:inputCheckbox value="{!a.selected}" id="checkedone1">
<apex:actionSupport event="onclick" action="{!GetSelected2}" reRender="Selected_PBS" id="second"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!a.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!a.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!a.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>


<apex:tab label="Insurance" name="name2" id="tab2">
<apex:PageblockTable value="{!AccountsforInsurance}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!a.selected}" id="checkedone2">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS,form"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!a.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!a.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!a.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>

<apex:tab label="Diversity" name="name3" id="tab3">
<apex:PageblockTable value="{!AccountsforDiversity}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!a.selected}" id="checkedone3">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS,form"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!a.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!a.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!a.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>

<apex:tab label="Document" name="name4" id="tab4">
<apex:PageblockTable value="{!accounts}" var="d" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!d.selected}" id="checkedone4">
<apex:actionSupport event="onclick" action="{!GetSelected2}" rerender="Selected_PBS,form"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!d.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!d.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!d.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>


<apex:tab label="Others" name="name5" id="tab5">
<apex:PageblockTable value="{!accountsforOthers}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header"> <apex:inputCheckbox >
<apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:facet>
<apex:inputCheckbox value="{!a.selected}" id="checkedone5">
<apex:actionSupport event="onclick" action="{!GetSelected2}" rerender="Selected_PBS"/>
</apex:inputCheckbox></apex:column>
<apex:column headervalue="Template ID" value="{!a.acc.Name}" width="200" />
<apex:column headervalue="Template Name" value="{!a.acc.Template_Library_Name__c}" width="1000"/>
<apex:column headervalue="Record Type" value="{!a.acc.RecordType.Name}" width="400"/>

</apex:PageblockTable>
</apex:tab>


</apex:tabPanel>
<!-- </apex:pageBlockSection> -->


<apex:outputPanel id="Selected_PBS" title="Selected Templates" layout="block">

<!-- <table> <tr><td style="font-weight: bold"> Selected Templates </td></tr></table> --->
<!-- <apex:sectionHeader title="Selected Templates" /> --->
<apex:pageBlock title="Selected Templates">


<!-- <apex:pageBlockSection Title="Selected Templates" id="Selected_PBS"> --->
<apex:PageBlockTable value="{!SelectedAccounts}" var="s" columnswidth="350px,350px" cellpadding="4" border="1" >
<!--- <apex:outputLink value="{$!s.Name}" rendered="{$!s.Name}" >{$!s.Name}</apex:outputLink> --->

<apex:column headervalue="Template Name" value="{!s.Template_Library_Name__c}" />
<apex:column headervalue="Record Type" value="{!s.RecordType.Name}" />
<apex:column width="350px!important">
<apex:facet name="header" > Edit and Save </apex:facet>
<!--
<apex:outputPanel styleClass="customNewPopup" layout="block" rendered="{!displaypopup1}">
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" style="vertical-align:middle;width:80px;height:20px;"/>
<apex:commandButton value="Cancel" action="{!closepopup1}" style="vertical-align:middle;width:80px;height:20px;"/>
</apex:pageBlockButtons>

</apex:pageBlock>
</apex:outputPanel>
-->


<apex:outputLink rendered="true" onclick="window.open('/apex/NewTemplateRequirementTL?templId={!s.Id}&progId={!progId}','myWindow','width=800,height=410,toolbar=0,status=1,scrollbars=1,resizable=yes,getCall(this)'); return false;"> Edit </apex:outputLink>
<apex:outputLink rendered="false" onclick="window.open('/apex/NewTemplateRequirementTL?templId={!s.Id}&progId={!progId}','myWindow','width=800,height=410,toolbar=0,status=1,scrollbars=1,resizable=yes'); return false;"> Modify/Delete </apex:outputLink>
</apex:column>
</apex:pageblocktable>

</apex:pageBlock>
<br/>
<table align="right"> <tr><td style="font-weight: bold" > <apex:commandButton value="Submit"/> </td></tr></table>
</apex:outputPanel>
</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

<!-- </apex:pageBlock> --->


<script>
function checkAll(cb){
var inputElem = document.getElementsByTagName("input");
for(var i=0; i<inputElem.length; i++){
//if(inputElem[i].id.indexOf("checkedone")!=-1)
inputElem[i].checked = cb.checked;
}
var tabname=getSelectedTabName();
alert('This is the tab selected....'+tabname);
}

function getSelectedTabName() {
if (RichFaces) {
var tabs = RichFaces.panelTabs['p:f:tp'];
for (var i = 0; i < tabs.length; i++) {
var tab = tabs[i];
if (RichFaces.isTabActive(tab.id + '_lbl')) {

return tab.name;
}
}
}
return null;
}


</script>

</apex:page>

 

 

 

Apex Class ###

 

 

public class ctlr_Checkbox_Class
{
/*
* This source code was written by Kumar Narasimha.

*/

List<accountwrapper> accountListIns = new List<accountwrapper>();
List<accountwrapper> accountListDoc = new List<accountwrapper>();
List<accountwrapper> accountListDiv = new List<accountwrapper>();
List<accountwrapper> accountListLangOther = new List<accountwrapper>();
List<accountwrapper> accountList = new List<accountwrapper>();

List<Template_Library__c> selectedAccounts = new List<Template_Library__c>();

// Map will store the records those are finally ready for insert in database
Map <ID,Template_Library__c> mapModifiedAccounts=new Map <ID,Template_Library__c>();


public String progId {get; set;}

public boolean linktype{get;set;}

public string selectTab{get; set; }



public ctlr_Checkbox_Class() {
progId = ApexPages.currentPage().getParameters().get('progId');
}

public List<accountwrapper> getAccounts()
{
accountList = new List<accountwrapper>();

for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='Document' order by Name Desc])
accountList.add(new accountwrapper(a));
return accountList;
}



public List<accountwrapper> getAccountsforDiversity()
{
accountList = new List<accountwrapper>();

for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='Diversity' order by Name Desc])
accountList.add(new accountwrapper(a));
return accountList;
}



public List<accountwrapper> getAccountsforInsurance()
{
accountList = new List<accountwrapper>();
for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='Insurance' order by Name Desc])
accountList.add(new accountwrapper(a));
return accountList;
}


public List<accountwrapper> getAccountsforLanguage()
{
accountList = new List<accountwrapper>();

for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='Language' order by Name Desc])
accountList.add(new accountwrapper(a));
return accountList;
}


public List<accountwrapper> getAccountsforOthers()
{

accountList = new List<accountwrapper>();

for(Template_Library__c a : [select Id, Name, RecordType.Name, Template_Library_Name__c from Template_Library__c where RecordType.Name='COI' OR RecordType.Name='Contractor Validation Worksheet' order by Name Desc])

accountList.add(new accountwrapper(a));
return accountList;
}

public PageReference getSelected()
{
selectedAccounts.clear();
for(accountwrapper accwrapper : accountList)
if(accwrapper.selected == true)
selectedAccounts.add(accwrapper.acc);

System.debug('These are the selected Records...................................................................');
for(Template_Library__c con : selectedAccounts) {
system.debug(con.Name);
}
return null;
}

public PageReference getSelected2()
{
selectedAccounts.clear();
for(accountwrapper accwrapper : accountList)
if(accwrapper.selected == true){
selectedAccounts.add(accwrapper.acc);
}
return null;
}

public Map<ID,Template_Library__c> getModifiedAccounts(){
if(selectedAccounts.size()>0){
for(Template_Library__c con : selectedAccounts){
system.debug(con.Name);
mapModifiedAccounts.put(con.ID,con);
}
return mapModifiedAccounts;
}
return null;
}

public List<Template_Library__c> GetSelectedAccounts()
{
if(selectedAccounts.size()>0)
return selectedAccounts;
else
return null;
}



public class accountwrapper
{
public Template_Library__c acc{get; set;}
public Boolean selected {get; set;}
public accountwrapper(Template_Library__c a)
{
acc = a;
selected = false;
}
}


// ---------------------------- POP UP Junk -------------------------

public Boolean displayPopup1 {get; set;}

public void showpopup1(){
displayPopup1 = true ;
}

public void closepopup1(){
displayPopup1 = false ;
}

// -------------------------------------------------------------------

}

I have an account hierarchy in my project. I have to count cumulative child for all account and store into Child_count__c in Account. I wrote the following Batch apex, but not getting success. Please let me know any right approach.
Batch Apex code as follows:

global class AccountChild_count implements Database.Batchable<sObject>{
     global Database.QueryLocator start(Database.BatchableContext BC){      
          return Database.getQueryLocator('Select Id, ParentId, Parent.ParentId, Parent.Parent.ParentId,Parent.Parent.Parent.ParentId, Parent.Parent.Parent.Parent.ParentId,Parent.Parent.Parent.Parent.Parent.ParentId from account where ACCT_STATUS__c=\'ACTIVE\' AND COUNTRY_FORM__c=\'USA\' LIMIT 5');   
          }   
          global void execute(Database.BatchableContext BC, List<sObject> scope){     
          try{    
              Map<ID, String> map_str1 =  new Map<Id, String>();    
              Map<ID, Account> map_str2 =  new Map<Id, Account>();    
              String str_of_Ids;    
              for(Integer i=0;i<scope.size();i++){           
                  Account acc=(Account)scope.get(i);           
                    str_of_Ids=String.ValueOf(acc.ParentId)+','+acc.Parent.ParentId+','+acc.Parent.Parent.ParentId+','+acc.Parent.Parent.Parent.ParentId+','+acc.Parent.Parent.Parent.Parent.ParentId+','+acc.Parent.Parent.Parent.Parent.Parent.ParentId;           
                    map_str1.put(acc.id, str_of_Ids);           
                    map_str2.put(acc.id, acc);    
                    }         
                    List <Account> accList=map_str2.values();        
                    for(Account acc1 :accList){          
                        acc1.Parent_ID_List__c=map_str1.get(acc1.id);                
                        }     
                        update accList;  
                         
                    for(Account acc2:accList){
                        Integer intNumberOfContacts = [SELECT count()FROM Account WHERE Parent_ID_List__c Like : acc2.ID];          
                        acc2.Child_Count__c=intNumberOfContacts;      
                    }    
                    update accList;
                       
                    }catch(Exception ex){    }      
                    }   
                    global void finish(Database.BatchableContext BC){   
                    }  
  }

I am getting the following error message : Please some one help me to getrid off this problem .

 

 

Error:

Update failed. First exception on row 0 with id 500Q0000002FHIoIAO; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, RecordType_Change: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 500Q0000002FHIoIAO; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 500Q0000002FHIo) is currently in trigger RecordType_Change, therefore it cannot recursively update itself: [] Trigger.RecordType_Change: line 12, column 16: []

 

 

trigger RecordType_Change on Case (before Update) {
IF(Trigger.isUpdate){
IF(!CaseRecordTypeUpdate.flag){
List<Case> listCaseold = [Select Id,Accountability__c,Accountable_Agent_VF__c,RecordType.Name from Case where ID =:Trigger.Old[0].ID];
List<Case> listCasenew = [Select Id,Accountability__c,Cause_Level_1__c,Accountable_Agent_VF__c,RecordType.Name from Case where ID =:Trigger.new[0].ID];       
IF(listCaseold[0].RecordType.Name.equalsIgnoreCase('csi')){
          IF(listCasenew[0].Accountability__c.equalsIgnoreCase('AXP') && listCasenew[0].Cause_Level_1__c.equalsIgnoreCase('Service Quality')){    
               RecordType objRec=[Select Id from RecordType where Name =: 'quick feedback'];
               listCasenew[0].RecordType.Name=objRec.ID;
               System.debug('Record Type  :'+objRec.ID);
               listCasenew[0].Accountable_Agent2__c=listCaseold[0].Accountable_Agent_VF__c;                 
               update listCasenew[0];  
     }
   }
}
CaseRecordTypeUpdate.flag=false;
}
}

 

Thanks,

Ram

i am wondering if the holiday object can be used to check is the current date is not that of a holiday and how would one go about it?

Hi All,

 

 Any one pls help me on it............How I could achive?

 

In New task page we have Reminder Section. I want reminder setting as per the following way......

1). If user selects "Reminder" check box then changes the Time----> Reminder should come at the changed Time.

2). If user don't select "Reminder", then Reminder should come Current Time 1 hr.

 

Thanks in Advanced