• Sumit@TCS
  • NEWBIE
  • 10 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 14
    Replies
I have once similar requirement, want to dispaly records in tree structure

Below Example

Parent 1 V
       Child 1 V
                Sub child 1
Parent 2 V
         Child 2
                Sub child 2
Parent 3 V
         Child 3 V
                Sub child 3


 
Hello Everyone,

I am getting below error when scheduling my job, please suggest

First error: Only variable references are allowed in dynamic SOQL/SOSL.

***************************

global class DeleteAccount_US_PR_scheduled  implements Schedulable{     global void execute(SchedulableContext sc){                  String[] set1= new String[]{'012F0000000qGHn'};         String[] set2= new String[]{'012F0000000wkju'};         String[] set3= new String[]{'012F0000000qEwY'};                  string rec1 = ('012F0000000qGHn');         String rec2 = ('012F0000000wkju');         string rec3 =('012F0000000qEwY');         Set<Id> RecIDs = new Set<Id>{rec1,rec1,rec1};         string c1=('US');         string c2=('PR');                  //String query = 'SELECT Id FROM Account WHERE (RecordTypeId in ('+ \'' + rec1 + \'' + ',' + '"' + rec2 + '"' + ',' + '"' + rec3 + '"' +') AND territory_Country_LLY__c in (' + c1 + ',' + c2 +')';         String query = 'SELECT Id FROM Account WHERE RecordTypeId in: (\'' + set1 + '\'' + ',' + '\'' + set2 + '\'' + ',' + '\'' + set3 + '\'' +')' ;         //String query = 'SELECT Id FROM Account' ;                   System.debug('@@@@@@@@@@@@@@@@@@@' + query );         DeleteAccount_US_PR delBatch = new DeleteAccount_US_PR (query);         Id BatchProcessId = Database.ExecuteBatch(delBatch);     } }

**************************
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
******************************

global class DeleteAccount_US_PR implements Database.Batchable<sObject>{     global final String Query;     global DeleteAccount_US_PR(String q){         Query=q;     }     global Database.QueryLocator start(Database.BatchableContext BC){         system.debug('******** Query ***** ' + query);         return Database.getQueryLocator(query);     }     global void execute(Database.BatchableContext BC,List<Account> scope){          List<Account> accns = new List<Account>();              for(Sobject s : scope){                    Account a = (Account)s;                     {                                                    accns.add(a);                                                }              }                                //update accns;            delete accns;     }     global void finish(Database.BatchableContext BC){}

*******************************
In Specific country there will be two set of different profile users working in parallel for a period of time and suppose both of them need to use same application, they’ll handle different product, is it possible to limit those users to  access in application by product? As there will be risk if they can see each other’s case records in application. They are

In specific country, two vendors working parallel for two different products. We need to hide their cases from each other based on products.

Products:-  access of set of products(P1) for Countrry C1
Users :-   Different profile users can view only those cases related to P1

More Info - Suppose we have two set of vendors V1 and V2 and they have access on products P1 and P2.

Vender V1 created a case C1 and V2 created C2. we need to hide case C2 (created by V2)  from V1 and vice
In Specific country there will be two set of different profile users working in parallel for a period of time and suppose both of them need to use same application, they’ll handle different product, is it possible to limit those users to  access in application by product? As there will be risk if they can see each other’s case records in application. They are

In specific country, two vendors working parallel for two different products. We need to hide their cases from each other based on products.

Products:-  access of set of products(P1) for Countrry C1
Users :-   Different profile users can view only those cases related to P1

More Info - Suppose we have two set of vendors V1 and V2 and they have access on products P1 and P2.

Vender V1 created a case C1 and V2 created C2. we need to hide case C2 (created by V2)  from V1 and vice
How can  Administrator delete users auto generated chatter posts ?

How can I delete Salesforce auto generated chatter post.

Example :- Sumit Kumar changed Case Owner from Sumit Kumar to Rohit Kumar.

The above post is auto generated by Salesforce How to delete it
Hi ,
I want to display recors in treeview fro three objects all three objects in relation of parent-->child--->grandchild.


Can any one help me out for this.

Thanks,
Sarvesh
Hi,
i want to show record in tree view structure for three objects.
Opportunity under this two objects oppLineitem, Invoice objects and under invoice object invoice line item object.

i wnt to show records inthree levels.

Can any one help me out for this.


Thanks,
Sarvesh.

 

Hi Everybody,

I have the below Simple apex code 

 

global class ReportTest1 implements System.Schedulable{
     global void execute(SchedulableContext sc) {
        ApexPages.PageReference report = new ApexPages.PageReference('/00O90000003Qn7T?excel=1'); //sandbox
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('TestReport.xls');
        attachment.setBody(report.getContent());
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('TEst Report');
        message.setHtmlBody('Dear All,<br><br/>Please Find Attached the Report Excel File.<br/>');
        message.setToAddresses( new String[] { 'MY EMAIL ID'} );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
       
     }
}

 

 

Now i am scheduling this for running Every 5 hours and the scheduler runs fine , but i get the blank report.


Now if i change the above class to below , I get a perfect Report when CONSTRUCTOR IS invoked but When scheduler is run i get a blank report   :(

 

global class ReportTest1 implements System.Schedulable{
public ReportTest1()
{
Starter();
}
public void Starter()
{
ApexPages.PageReference report = new ApexPages.PageReference('/00O90000003Qn7T?excel=1'); //sandbox
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('TestReport.xls');
        attachment.setBody(report.getContent());
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('TEst Report');
        message.setHtmlBody('Dear All,<br><br/>Please Find Attached the Report Excel File.<br/>');
        message.setToAddresses( new String[] { 'MY EMAIL ID'} );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
}
 
     global void execute(SchedulableContext sc) {
        ApexPages.PageReference report = new ApexPages.PageReference('/00O90000003Qn7T?excel=1'); //sandbox
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('TestReport.xls');
        attachment.setBody(report.getContent());
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('TEst Report');
        message.setHtmlBody('Dear All,<br><br/>Please Find Attached the Report Excel File.<br/>');
        message.setToAddresses( new String[] { 'MY EMAIL ID'} );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
       
     }
}
 

 

Kindly I request your expert advise.

 

Regards,

San

 

 

  • May 16, 2013
  • Like
  • 0

Hi,

 

iam new to salesforce and have been learning for past 1 month. i wonder how to create dependency field for textbox.

 

 

for example:  i have a picklist with 2 values 

                          1.Nurse

                          2.Doctor

 

If i choose doctor 

 

following textfields should be active.

 

1.operation details

2.patient to operate on

3.type of operation etc,..

 

can anyone explain me clearly, to understand it easily

 

Can somebody help me to understand the follwoing points ?

1) how to  insert data in salesforce with Informatica Power center ?

2) How to integrate the informatica with the Salesforce .?  any API or Adpater for webserivces 

3) Can we automate the process ?

 

Button Click is not working 

i am using @remoteaction 

actually what i want is when i am selecting Date From and Date To and click on GO button it should show me result according to the dates

 

Visualforce Page:

<apex:page controller="DashPortalController" sidebar="false">
<apex:pageMessages ></apex:pageMessages>
<!-- Google API inclusion -->
<apex:includeScript id="a" value="https://www.google.com/jsapi" />
<apex:sectionHeader title="Google Charts" subtitle="Chart 1"/>

<!-- Google Charts will be drawn in this DIV -->
<apex:form >

<table align="center">
<td><b>Date From:</b>
<apex:inputField value="{!servList.Service_Start_Date__c}" /></td>
<td><b>Date To:</b>
<apex:outputText value="{0,date,dd/MM/yyyy}">
<apex:param value="{!NOW()}" />
</apex:outputText></td>
<td><input type="button" onclick="initCharts()" value="Go"/></td>

</table>
<div id="chartBlock" style="width: 600px; height: 500px;"/>

<script type="text/javascript">
google.load('visualization', '1', {'packages':['corechart']});
google.setOnLoadCallback(initCharts);

function initCharts() {
DashPortalController.loadCustomerServiceSuccessRate(
function(result, event){
// load Column chart
var visualization = new google.visualization.PieChart(document.getElementById('chartBlock'));
var data = new google.visualization.DataTable();
data.addColumn('string','Success or Failure');
data.addColumn('number','Percentage');

var finalBean= result;
data.addRows([

['Service Success Rate', finalBean.totalServiceColl],
['Service Failure Rate', finalBean.totalCases]]);


visualization.draw(data,{title:'Service Success Rate',legend : {position: 'bottom', textStyle: {color: 'blue', fontSize: 10}}, width:window.innerWidth,vAxis:{textStyle:{color:'red', fontSize: 15}}});
}, {escape:true});
}
</script>
</apex:form>
</apex:page>

 

Controller Coding:

 

global with sharing class DashPortalController{

public Service__c servList{get;set;}


@RemoteAction
global static CaseFailBean loadCustomerServiceSuccessRate(){

Map<Id,CaseFailBean> caseBeanMap=new Map<Id,CaseFailBean>();

map<id,Decimal> mapgrandParentsCounts = new map<id,Decimal>();
Service__c serviceList= [select id,Name,Service_Start_Date__c,Last_90_Days__c,
Last_Month__c,Last_Week__c,Last_Year__c
from Service__c s where Status__c = 'Active'
AND Customer__c!=null limit 1];
Date Last90days= serviceList.Last_90_Days__c;
Date LastWeek= serviceList.Last_Week__c;
Date LastMonth= serviceList.Last_Month__c;
Date LastYear= serviceList.Last_Year__c;
Date DateFrom= serviceList.Service_Start_Date__c;

List<Service__c> sr2= [select id, Name, Customer__c,Status__c, s.Customer__r.Grand_Parent_Account__c,
Week_Number__c,Count_of_Pickup_Days__c,Service_Start_Date__c
from Service__c s where Status__c = 'Active'
AND Count_of_Pickup_Days__c!=null AND Customer__c!=null AND Week_Number__c!=null
AND Service_Start_Date__c>=:LastMonth] ;

List<service__c> srList= [select id, Name, Customer__c,Status__c, s.Customer__r.Grand_Parent_Account__c,
Week_Number__c,Count_of_Pickup_Days__c,Service_Start_Date__c
from Service__c s where Status__c = 'Active'
AND Count_of_Pickup_Days__c!=null AND Customer__c!=null AND Week_Number__c!=null
AND Service_Start_Date__c>=:LastYear];

if(DateFrom>=LastYear){
for(Service__c sr:srList){
if(mapgrandParentsCounts.containskey(sr.Customer__r.Grand_Parent_Account__c) && sr.Name!=null)
{
Decimal tCount = mapgrandParentsCounts.get(sr.Customer__r.Grand_Parent_Account__c);
tCount = tCount + (sr.Count_of_Pickup_Days__c * sr.Week_Number__c);
mapgrandParentsCounts.put(sr.Customer__r.Grand_Parent_Account__c,tCount);
}
else
{
mapgrandParentsCounts.put(sr.Customer__r.Grand_Parent_Account__c,(sr.Count_of_Pickup_Days__c * sr.Week_Number__c));
}
}
}


List<Service__c> sr1 = [select id, Name, Customer__c,Status__c, s.Customer__r.Grand_Parent_Account__c,
Week_Number__c,Count_of_Pickup_Days__c,Service_Start_Date__c
from Service__c s where Status__c = 'Active'
AND Count_of_Pickup_Days__c!=null AND Customer__c!=null AND Week_Number__c!=null
AND Service_Start_Date__c>=:Last90days];
system.debug('========sr1=========='+sr1);
if(DateFrom>=Last90days){
for(Service__c srObj: sr1){
if(mapgrandParentsCounts.containskey(srObj.Customer__r.Grand_Parent_Account__c) && srObj.Name!=null)
{
Decimal tCount = mapgrandParentsCounts.get(srObj.Customer__r.Grand_Parent_Account__c);
tCount = tCount + (srObj.Count_of_Pickup_Days__c * srObj.Week_Number__c);
mapgrandParentsCounts.put(srObj.Customer__r.Grand_Parent_Account__c,tCount);
}
else
{
mapgrandParentsCounts.put(srObj.Customer__r.Grand_Parent_Account__c,(srObj.Count_of_Pickup_Days__c * srObj.Week_Number__c));
}
}
}else if(DateFrom>=LastMonth){
for(Service__c srObj1: sr2){
if(mapgrandParentsCounts.containskey(srObj1.Customer__r.Grand_Parent_Account__c) && srObj1.Name!=null)
{
Decimal tCount = mapgrandParentsCounts.get(srObj1.Customer__r.Grand_Parent_Account__c);
tCount = tCount + (srObj1.Count_of_Pickup_Days__c * srObj1.Week_Number__c);
mapgrandParentsCounts.put(srObj1.Customer__r.Grand_Parent_Account__c,tCount);
}
else
{
mapgrandParentsCounts.put(srObj1.Customer__r.Grand_Parent_Account__c,(srObj1.Count_of_Pickup_Days__c * srObj1.Week_Number__c));
}
}
}




CaseFailBean beanList=new CaseFailBean();

for(id gpAcc : mapgrandParentsCounts.keyset()) {

system.debug('==========ServiceSuccessRate========='+ServiceSuccessRate);
system.debug('==========ServiceFailureRate========='+ServiceFailureRate);
CaseFailBean beanObj=new CaseFailBean(ServiceSuccessRate,ServiceFailureRate);
beanList=beanObj;

}

system.debug('==========beanList=========='+beanList);
return beanList;
}

global class CaseFailBean{
public Decimal totalCases{get;set;}
public Decimal totalServiceColl{get;set;}


public CaseFailBean(Decimal ServiceSuccessRate,Decimal ServiceFailureRate){
this.totalServiceColl=ServiceSuccessRate;
this.totalCases=ServiceFailureRate;
}

public CaseFailBean(){

}
}
}

 

 

 

  • September 17, 2012
  • Like
  • 0
So, I'm dealing with the largest org instance I've ever come across, and apparently when I do a Schema.getGlobalDescribe() and try to put the key set into a Set<String>, I get "Collection size 1,629 exceeds maximum size of 1,000".

Now, I'm no stranger to getting arounds limits... I've obviously ran into data limi problems in this org, and metadata limits on the Eclipse side, but I'm not quite sure how to get around this one, since the Schema.getGlobalDescribe() method is not a SOQL query... It's a method that returns a Map<String,Schema.SObjectType> , and the limit for a map is 1,000. I know with a large query, you can do something akin to this for an org with 30,000 accounts:
for(List<Account> lstAccts : [SELECT Id, Name FROM Account]){
for(Account a : lstAccts){
a.Name = a.Name + ' some change';
}
update lstAccts;
}

... but the method Scena.getGlobalDescribe() is not a query, it's a method call that returns a Map<String,Schema.SObjectType>. How can I populate a full set (or list of sets) of API names of SObjects in my org if there's more than 1,000?

Here's what I have so far:

Controller:
public class CustomObjectsViewController{
public Map<String,Schema.SObjectType> mapGDescribe{get; set;}
public Set<String> setObjNames{get; set;}

public CustomObjectsViewController(){
this.mapGDescribe = Schema.getGlobalDescribe();
this.setObjNames = mapGDescribe.keySet();
}
}

VisualForce Page:
<apex:page controller="CustomObjectsViewController">
<apex:pageBlock >
<apex:pageBlockTable value="{!setObjNames}" var="objName">
<apex:column value="{!objName}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

Error when loading VFpage:
Collection size 1,629 exceeds maximum size of 1,000

Note:
At the end of the day... I'm really trying to implement a List View of custom objects.
All I want is a list view "Unmanaged Custom Objects" like I have for classes, triggers, components, and VFpages.
Is there an idea like that I can vote for?

Any help is GREATLY appreciated.


Thanks,

Nathan Pepper
SalesForce.com Developer
YouTube: www.youtube.com/MayTheSForceBWithYou
Twitter: @SForceBeWithYou

Hello,

We have configured territory management and implemented a trigger on account object to update a field based on specific conditions. This field is used as a criteria for running territory assignment rules but when the field is updated by the Apex trigger, we have noticed that the territory rules are not evaluated.

According to online documentation and forums, the territory rules are only triggered from the Salesforce interface (if the option "Run territory assignment rules on save" is enabled and visible on page layouts) or from an API call.

With the new release, is it possible to trigger territory assignment rules from Apex and how to implement it ?

 

If its not possible from Apex, can you please provide some sample PHP codes to run the rules via REST API ?

 

Hi All,

I have a doubt that whether it is possible that an approver is not available for approval process.

What are the conditions that primary approver is not available.

How is the approval process delegated to delegate of primary approver by system.

 

Hi,

 

In my application i need to develop a component for Tree view,

it means I need to get the child records when a master record is clicked

if the child is master for other object then it should be displayed

also the other child for the master if any.

 

 

If any one know the solution,help me.

 

 

  • March 09, 2011
  • Like
  • 0

I'm new to Salesforce so this may be an easy one:

I would like to create a Picklist whose values I can manage in one place but will be included in multiple objects.

For example, I want to create a Picklist called End User Types.

It will have the values: Hospital, Restaurant, University, etc.

I want to add the End User Types picklist  to Account, Opportunities, Leads, and other custom objects. 

Most importantly, I don't want the user to have to do a Lookup of the values.  I want it to look like a regular Picklist within Account, Opportunities, etc.

It will show up as a dropdown.

But I can manage the values in one place rather than creating separate Picklists within each object (Account, Opportunities, etc.)

 

It seems that I can do this with custom java development, but that is beyond my skillset.  Isn't there another way?

 

 

 

Hi all,

Informatica documentation describes the process of setting up web service connections as shown below.  Does any one know if this will work with an apex webservices exposed from a salesforce org?  Has anyone tried this?

 

There is a seperate process for "PowerExchange for Salesforce Connections", but I believe this exposes calls available through the partner api only (i.e. not a custom written web service).

 

---------------------------

 

 

PowerExchange for Web Services Connections

The Integration Service can use Web Services Consumer application connections to extract data from web service sources, write data to web service targets, or transform data using Web Services Consumer transformations. Web Services Consumer application connections allow you to control connection properties, including the endpoint URL and authentication parameters.

To connect to a web service, the Integration Service requires an endpoint URL. If you do not configure a Web Services Consumer application connection or if you configure one without providing an endpoint URL, the Integration Service uses the endpoint URL contained in the WSDL file on which the source, target, or Web Services Consumer transformation is based.

Use the following guidelines to determine when to configure a Web Services Consumer application connection:

*
Configure a Web Services Consumer application connection with an endpoint URL if the web service you connect to requires authentication or if you want to use an endpoint URL that differs from the one contained in the WSDL file.
*
Configure a Web Services Consumer application connection without an endpoint URL if the web service you connect to requires authentication but you want to use the endpoint URL contained in the WSDL file.
*
You do not need to configure a Web Services Consumer application connection if the web service you connect to does not require authentication and you want to use the endpoint URL contained in the WSDL file.

If you need to configure SSL authentication, enter values for the SSL authentication-related properties in the Web Services application connection. For information about SSL authentication, see the PowerExchange for Web Services User Guide.

To create a Web Services Consumer application connection:

1.
In the Workflow Manager, connect to a PowerCenter repository.
2.
Click Connections > Application.
The Application Connection Browser dialog box appears.
3.
From Select Type, select Web Services Consumer.
4.
Click New.
The Connection Object Definition dialog box appears.
5.
Enter a name for the application connection.
6.
Enter the following connection information:
Connection Attributes
Description
User Name
User name that the web service requires. If the web service does not require a user name, enter PmNullUser.
To define the user name in the parameter file, enter session parameter $ParamName as the user name, and define the value in the session or workflow parameter file. The Integration Service interprets user names that start with $Param as session parameters.
Use Parameter in Password
Indicates the web service password is a session parameter, $ParamName. If you enable this option, define the password in the workflow or session parameter file, and encrypt it using the pmpasswd CRYPT_DATA option. Default is disabled.
Password
Password that the web service requires. If the web service does not require a password, enter PmNullPasswd.
Code Page
Connection code page. The Repository Service uses the character set encoded in the repository code page when writing data to the repository.
End Point URL
Endpoint URL for the web service that you want to access. The WSDL file specifies this URL in the location element.
You can use session parameter $ParamName, a mapping parameter, or a mapping variable as the endpoint URL. For example, you can use a session parameter, $ParamMyURL, as the endpoint URL, and set $ParamMyURL to the URL in the parameter file.
Domain
Domain for authentication.
Timeout
Number of seconds the Integration Service waits for a connection to the web service provider before it closes the connection and fails the session. Also, the number of seconds the Integration Service waits for a SOAP response after sending a SOAP request before it fails the session.
Trust Certificates File
File containing the bundle of trusted certificates that the Integration Service uses when authenticating the SSL certificate of the web services provider. Default is ca-bundle.crt.
Certificate File
Client certificate that a web service provider uses when authenticating a client. You specify the client certificate file if the web service provider needs to authenticate the Integration Service.
Certificate File Password
Password for the client certificate. You specify the certificate file password if the web service provider needs to authenticate the Integration Service.
Certificate File Type
File type of the client certificate. You specify the certificate file type if the web service provider needs to authenticate the Integration Service. The file type can be either PEM or DER. For information about converting the file type of certificate files, see the PowerExchange for Web Services User Guide.
Private Key File
Private key file for the client certificate. You specify the private key file if the web service provider needs to authenticate the Integration Service.
Key Password
Password for the private key of the client certificate. You specify the key password if the web service provider needs to authenticate the Integration Service.
Key File Type
File type of the private key of the client certificate. You specify the key file type if the web service provider needs to authenticate the Integration Service. PowerExchange for Web Services requires the PEM file type for SSL authentication. For information, see the PowerExchange for Web Services User Guide.
Authentication Type
Select one of the following authentication types to use when the web service provider does not return an authentication type to the Integration Service:
-
Auto. The Integration Service attempts to determine the authentication type of the web service provider.
-
Basic. Based on a non-encrypted user name and password.
-
Digest. Based on an encrypted user name and password.
-
NTLM. Based on encrypted user name, password, and domain.
Default is Auto.
7.
Click OK.
The application connection appears in the Application Connection Browser.

How can I generate a report involving similar fields of two independent custom objects in salesforce?

 

Can anyone tell me the solution of this please?

  • March 18, 2010
  • Like
  • 0
Hi,
 
I would like to know if there is a way to Override the Salesforce related list records link with Visual Force page. So that when we click on the related list record in salesforce it opens up a visualforce page with that particular details. If any one know please share the information as how this can be done.
 
Regards
Tejesh
  • September 01, 2008
  • Like
  • 0