• ShashForce
  • PRO
  • 3208 Points
  • Member since 2014
  • Developer Relations Manager
  • Salesforce


  • Chatter
    Feed
  • 102
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 0
    Questions
  • 786
    Replies
Hey everyone,

we're currently facing the problem that we are getting the outbound message error "javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated" for all our outbound messages sent from salesforce without having made any changes to either salesforce or our endpoint and ssl certificates.

Our ssl root certificate is valid and is also listed in the salesforce wiki as being accepted by salesforce: http://wiki.developerforce.com/page/Outbound_Messaging_SSL_CA_Certificates#thawteprimaryrootca

As mentioned, the implementation has worked without problems until today but now somehow started throwing errors.

Maybe anyone has faced a similar problem or has an idea how to resolve the issue?

Thanks for any feedback!
Hi,
I have a Custom Object named preferred rate. It is related to the account in a Master detail relation ship with the account being the Master.

There are two record types in Account named Customer and SIte with the Customer Record type being the Parent of the Site Account record type. A Preferred Rate record can be created on Customer as well as Site account.

I am looking for a validation rule such that When the Expiration Date entered on the Preferred Rate record on Site Account is greater than that on the Customer Account, it should throw an error.
The Site Account record type is the child of the Customer Record Type.
  • August 28, 2014
  • Like
  • 0
Hi,

I have a request to have a trigger create a new case if a user adds a comment to a closed case via the portal or email 2 case.  As part of this they would like any existing solutions added to the new case(s).

My question is what is the best way to bulkify this behaviour?  OK, so in this scenario, there should only be one update at a time, but as we know we should bulkify our trigger code.

I'm creating a list of new cases and then inserting that list, the problem comes with then trying to associate the solutions from the old cases to the new cases, is there a "standard" way of doing this?

Thanks,
David

Hi All,

In my visual force page where ever I place the cursor it is showing the page name as the tooltip(title).Its really annoying.

I need to remove this one...can anyone know how to do this...???

Thanks
Chitra
Hi folks,
      I have to assign user manger  in the orgnaisation...Like user1 manager is User2 and user2 manager is user3 and etc
     for that Ive created code but whether its correct or not
@isTest
public class UserInsertTest
{
static testMethod void createTestUser()
{
List<User> users = new List<User>();
String pid = [Select id from Profile where Name='System Administrator'].Id; // here put your profile name
for(integer i=1; i<=100; i++)
{
    String orgId = UserInfo.getOrganizationId();
    String dateString = String.valueof(Datetime.now()).replace(' ','').replace(':','').replace('-','');
    Integer randomInt = Integer.valueOf(math.rint(math.random()*1000000));
    String uniqueName = orgId + dateString + randomInt;
  
    User tuser = new User(  firstname = 'test',
                            lastName = 'user'+i,
                            email = uniqueName + '@test' + orgId + '.org',
                            Username = uniqueName + '@test' + orgId + '.org',
                            EmailEncodingKey = 'ISO-8859-1',
                            Alias = 'test',
                            TimeZoneSidKey = 'America/Los_Angeles',
                            LocaleSidKey = 'en_US',
                            LanguageLocaleKey = 'en_US',
                            ProfileId = pid);
    users.add(tuser);
                           
}

insert users;


}

for(Integer i=0;i<users.size();i++){
            if(i!=199){
                users[i].ManagerId=users[i+1].Id;
                update users;
            }
           
        }


}


Please Help!
Hi folks,
   Can anyone tell me how to test the following code:

public class CreateAccount{

Account[]  a=new Account[3]
a[0]=new account (Name=Account1);
a[1]=new account (Name=Account2);
a[2]=new account (Name=Account3);
try{
Database.Insert(a,false);
}
catch(Exception e){
system.debug('Error Message:' +e.getMessage());
}

}


Thanks in advance
Karthick
I have a work flow, whenever the stage move from New opp to anything but closed lost, their will be a date stamp. however, my workflow is change the time when created, and every time it’s edited. I need the date to be stamp not changing every time when people edit it.
How should I do that? It seems like the one I use PRIORVALUE is only supporting "created, and every time it’s edited" as the evaluation rule.

Here is my work flow: 
ISPICKVAL(PRIORVALUE( StageName ),"1. New Opportunity") && NOT(ISPICKVAL( StageName,"Closed Lost")) && NOT(ISPICKVAL( StageName,"Closed - Unqualified")) && NOT(ISPICKVAL( StageName,"1. New Opportunity"))&& NOT(ISPICKVAL( StageName,"2. Discovery Call"))&& NOT(ISPICKVAL( StageName,"Closed - Professional"))
I have a similar problem. I'm trying to update a field (Research_Reason__c) on a custom object (lda_Opportunity__c). I can query a record fine, but updating is a little different and I can't figure it out.

Here is my function:
function FlagFixDeal($id,$reason,$researchtime){
$access_token = $_SESSION['access_token'];
        $instance_url = $_SESSION['instance_url'];

$content = json_encode(array("Research_Reason__c" => $reason));
$url = "$instance_url/services/data/v20.0/sobject/lda_Opportunity__c/$id";

    $curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER,array("Authorization: OAuth $access_token","Content-type: application/json"));
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);

curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ($status != 204) {
  die("Error: call to URL $url failed with status $status, curl_error " . curl_error($curl) .", curl_errno " . curl_errno($curl));
}

echo "HTTP status $status updating deal.<br /><br />";
curl_close($curl);
}


Error I'm getting is:
Error: call to URL https://na19.salesforce.com/services/data/v20.0/sobject/lda_Opportunity__c/a0Oa000000LAkarEAD failed with status 404, curl_error , curl_errno 0

Thanks in advance for any help you can provide.
I'm trying to create a button on case console called New Customer Service Case.  It shoudl create a case of a specific record type (Customer Service Case) and I can't get the button to work - "Illegal Character" 

srcUp (‘ /500/e?retURL={!Case.Id} &cas5=Customer Service Case&isdtp=vw&def_case_id={!Case.Id} &RecordType= 012L00000008mRV’);
Hey everyone,

I am having an issue with the way a page is displaying with a hacked URL.

I have a new button that overrides the old new opportunity button to prepopulate look up fields. 

Here is my button:

 /006/e?
CF00NF000000CFJSi={!Loan__c.Name}
&CF00NF000000CFJSi_lkid={!Loan__c.Id}
&CF00NF000000CVahZ={!Loan__c.Borrower__c}
&CF00NF000000CVahZ_lkid={!Loan__c.BorrowerId__c}
&opp4={!Loan__c.Portfolio_Owner__c}
&opp4_lkid={!Loan__c.Portfolio_OwnerId__c}&
retURL=/{!Loan__c.Id}&saveURL=/{!Loan__c.Id}

The issue I am having is with the page, it displays another salesforce inside of the existing salesforce page. If anyone has any ideas or work arounds to this that would be awesome! Thank you so much in advance.

  
  • August 21, 2014
  • Like
  • 0
I need to alter my trigger to run on Batch jobs as well as when they are updated one at a time.  Could someone help me do that?  This trigger creates a task when a lead is created and the Lead Web Comment field is filled out.



trigger CreateTaskOnLead on Lead (after insert) {
    List<Task> lTask = new List<Task>();
      Task t;
    
      if(Trigger.isAfter) {
        if(Trigger.isInsert) {
           for(Lead l: Trigger.new) {
              
               if((l.Lead_Web_Comment__c != null)){
                 t = new Task();
                 t.OwnerId = l.OwnerId;
                 t.Subject = 'Lead Web Comment';
                 t.Priority = 'Normal';
                 t.Status = 'Completed';
                 t.Type = 'Lead Web Comment';
                 t.Description = l.Lead_Web_Comment__c;
                 t.ActivityDate = Date.today();
                // t.CallDuration=0;
                 t.whoid=l.id;
                 lTask.add(t);  
               }
            }
            if(!lTask.IsEmpty())
                       insert t;
           }       
      }
}
Hi All,

Lemme expalne in detail..
There two  objects called Case(Master parent) and Logsheet(child)

Say there are 3 cases...
caseA
CaseB
CaseC

now i should create only one child record for each parent case record..
Means.. for caseA , only one logsheet1(record of Logsheet)
              
Means for one CASE ID i should not create multiple Logsheet records,...
Please hlep to to write a trigger to avoid this duplication....

                    
                  
In the Summer '14 release notes (see link), the user profile page layout can be customized for Salesforce1, but only for Android devices. Does anyone have a workaround for iOS devices, or is there any timeline for when it might become available?

http://docs.releasenotes.salesforce.com/en-us/summer14/release-notes/rn_mobile_salesforce1_newfeat_profile_layout.htm
Our cases will come in via a form on our website. Every case will therefor have the same "From" email address. Is it possible for Email-to-Case to extract the correct email from the body of the email? Can it extract other custom fields that are included in the email?

I am not a programmer, so we will have a consultant do this work for us. I just want to know if it's possible! Thank you.
Hi all,

While exploring the salesforce features i came across supoort process
  1. Support processes are used to add or remove the status values of cases
  2. After a support process has been created its assigned to a record type
Now my confusion  is ,why  are we  using support processes to add/remove the picklist values? as It can also be achieved when creating record types.
Record types allow us to customize the picklist values then why wud we use this solution process feature?

Hi, 

I could really use some guidence on a current problem I'm faced. Any help would be much appreciated.

I have 2 custom objects with a master detail relationship: parent__c and child__c. 

A Parent__c record  contains information for 4 payments. Chilld__c will be the recipt for each individual payment. 

What I want is for a user to be able to press a button on the parent and create 4 new child records. Each child record will be a recipt for one of the 4 payments.

Can anyone tell me how this can be achieved?

So far I've seen similar examples using Apex, Flows, Custom Controllers, VF pages and more. All of them are fine, I just don't know which would be most appropriate. 

Thanks in advance. 
  • August 19, 2014
  • Like
  • 0
Dear Developers,

I would like to implement mass convert custom object to lead page on APEX.

As first, I wrote following program.
It is not able to show error message when you don't select any records from a list view.

>ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Please select one record at least');
<apex:page StandardController="CustomObj__c" extensions="CheckDupClass" recordSetVar="DupRecords" id="Page">
    <apex:form id="form">
        	<apex:pageBlock id="step1" title="Selected Records" mode="edit" >
      			<apex:pageBlockTable value="{!selectedItems}" var="m">
          			<apex:column value="{!m.Name}" />
          			<apex:column value="{!m.LastName__c}" />
          			<apex:column value="{!m.FirstName__c}" />
                    <apex:column value="{!m.EmailAddress__c}" />
      			</apex:pageBlockTable>
            	<apex:pageBlockButtons location="bottom">   
               		<apex:commandButton value="Execute"  action="{!Ex_CheckDupClass}"/>
               		<apex:commandButton value="Cancel" action="{!cancel}"/>
        		</apex:pageBlockButtons>
     		</apex:pageBlock>
    </apex:form>
</apex:page>
public with sharing class CheckDupClass {

	public List<CustomObj__c> selectedItems{get;set;}
	
    public CheckDupClass(ApexPages.StandardSetController controller) {
       	List<CustomObj__c> ubId = (List<CustomObj__c>)controller.getSelected();
       	this.selectedItems=[select Id, Name, LastName__c, FirstName__c, EmailAddress__c, OwnerId 
                            		  from CustomObj__c where Id IN :ubId ORDER BY Name ASC LIMIT 10];
        	if (selectedItems.size() <= 0)
			{
			 //Want to show error message when user didn't select any records and display the page.
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Please select one record at least');
        	}
    }
	
    //Insert records in lead module
    public void Ex_CheckDupClass(){
    	Map<String,CustomObj__c> targetEmailMap = new Map<String,CustomObj__c>();
    
        for(CustomObj__c selectedItem : selectedItems){
            if(selectedItem.EmailAddress__c != null){
                if(!targetEmailMap.containsKey(selectedItem.EmailAddress__c)){
                    targetEmailMap.put(selectedItem.EmailAddress__c,selectedItem);
                }else{
                    targetEmailMap.get(selectedItem.EmailAddress__c).addError('The email address exists in leads module')
                }
            }
        }
        
	    if(targetEmailMap.size() !=0){
        	List<Lead> leads = [SELECT id, email FROM Lead WHERE email in :targetEmailMap.keyset()];
        if (leads.size() > 0) {
            for(Lead lead: leads){
               targetEmailMap.get(lead.email).addError('The email address exists in leads module');
             }
        }else{
            //Execute insert operation when no duplication
            for (Integer i = 0; i < selectedItems.size(); i++){
            Lead lc1 = new Lead();
            		lc1.Company = selectedItems[i].Name;
            		lc1.LastName = selectedItems[i].LastName__c;
            		lc1.FirstName = selectedItems[i].FirstName__c;
            		lc1.email = selectedItems[i].EmailAddress__c;
            		lc1.Status = 'Open - Not Contacted';
            		lc1.OwnerId = selectedItems[i].OwnerId;
            	insert lc1;
        	}       
        }
    }
}
    
    
    public PageReference cancel() {
		String retUrl = Apexpages.currentPage().getParameters().get('retUrl');
		if (retUrl == '')
		{
			return new PageReference('/');
		}
		else
		{
			return new PageReference(retUrl);
		}	
	}      
}

In above code, you can insert all selected records if emails are not duplicated.
It means that you can not insert any records if there are the email address in lead module already.

I can not find the information I wanted in help page and past topic.
(I am so sorry my searching way is not good)
Could you please support me to resolve above issues?

Could you please let me know if you need more details?

Best Regards,
Tack 

  • August 19, 2014
  • Like
  • 0
The [Salesforce Console Integration Tookit][1] provides two functions for detecting switching focus of console tabs:

- `onFocusedPrimaryTab`
http://www.salesforce.com/us/developer/docs/api_console/Content/sforce_api_console_onfocusedprimarytab.htm
- `onFocusedSubtab` http://www.salesforce.com/us/developer/docs/api_console/Content/sforce_api_console_onfocusedsubtab.htm

I've been working on a Custom Visualforce Global Action and I'm able to use `onFocusedSubtab` without any issue to detect focus.  However `onFocusedPrimaryTab` does not work in the same way.  I have tested both functions using the samples from the documentation and I have no errors in Chrome dev tools that would indicate the callback is not being registered with `onFocusedPrimaryTab`.

The documentation does not indicate that they should behave differently, the only subtle hint that they may be different is that `onFocusedSubtab` is in the "Methods for Primary Tabs and Subtabs" section of the docs whilst `onFocusedPrimaryTab` is in the "Methods for Application-Level Custom Console Components" section.  For this reason I tried hooking up a callback in the console from a Custom Console Component in the highlights panel (top of Service Console), but it still didn't work.

Does anyone have any experience of `onFocusedPrimaryTab` working?

  [1]: http://www.salesforce.com/us/developer/docs/api_console/index.htm
 Hi there

I am experimenting with outbound messaging and so far it works fine. What i noticed is that the IDs (AccountID, OpportunityID...) that i receive with the outbound message do not match the IDs defined in Salesforce frontend. For example:

Opportunity

In SalesForce: 0062000000YwVSD
ID passed by Message: 0062000000YwVSDAA3


Account

In SalesForce: 0012000001BWnkc
ID passed by Message: 0012000001BWnkcAAD

It seems the last 3 characters get added with the message and i don' t know why...
Is there a system behind this or can someone explain me how this works?
With this i have difficulties matching the 2 IDs, which is essential for my problem. I have a static list of Account IDs defined in SharePoint  (the ones i find in the frontend of SalesForce) and i need to seach that list with the ID passed by the message.


I hope someone can help me there or give me a hint.


Thanks,

~ Fabian
I need notification to fire an email with 3 criterias:
1) if account is A or B or C
2) if Lead generator is AK or BG or CS
3) if there is information on the criterias.

AND (OR(ISPICKVAL( Account.Type , "A"),
ISPICKVAL( Account.Type , "B"),
ISPICKVAL( Account.Type , "C"),

OR(ISPICKVAL( Lead_Generator_Detail__c, "AK"),
ISPICKVAL ( Lead_Generator_Detail__c ,"BG"),
ISPICKVAL ( Lead_Generator_Detail__c , "CS"),

(OR(NOT(ISBLANK( Account.Payment_Terms__c)),
NOT (ISBLANK ( Account.Override__c )),
NOT(ISBLANK( Account.Pricing__c )),
NOT(ISBLANK( Account.Remarks__c ))) ))))

However, according to my manager this workflow has the brackets wrongly input, can anyone please help.
Thanks.
Hi,
I need to disable the developement mode for the particular VisualForce page, is it possible lo disable only for particular page ???
Hey everyone,

we're currently facing the problem that we are getting the outbound message error "javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated" for all our outbound messages sent from salesforce without having made any changes to either salesforce or our endpoint and ssl certificates.

Our ssl root certificate is valid and is also listed in the salesforce wiki as being accepted by salesforce: http://wiki.developerforce.com/page/Outbound_Messaging_SSL_CA_Certificates#thawteprimaryrootca

As mentioned, the implementation has worked without problems until today but now somehow started throwing errors.

Maybe anyone has faced a similar problem or has an idea how to resolve the issue?

Thanks for any feedback!
So I'm building a configurable visualforce page that in an object you type the name of field sets and sech to then display a tabbed view but i get this error when i do so what am i missing 

Error: Could not resolve field '0IX' from <apex:outputField> value binding '{!LLC_BI__Loan__c[f]}' in page ncino_checklist

Apex Class
public with sharing class nCino_ChecklistExt{

    public ApexPages.StandardController stdCtrl {get; set;}
    public Boolean refreshPage {get; set;}
    List<nCino_Config__c> configvalues {get;set;}

        public nCino_ChecklistExt(ApexPages.StandardController controller) {
        stdCtrl=controller;
        refreshPage=true;
    }
    
    public List<nCino_Config__c> getConfigValues() {
    
        configvalues = [SELECT Id, Name, Tab_Name__c, Tab_Display_Order__c, Tab_Color__c, Tabbed_Content_Name__c, Icon_for_Tab__c, Field_Set__c 
                        FROM nCino_Config__c 
                        WHERE App_Name__c = 'Checklist' 
                        ORDER BY Tab_Display_Order__c DESC];
        
    return configvalues;
    }
    
    public PageReference save(){
        LLC_BI__Loan__c loan=(LLC_BI__Loan__c) stdCtrl.getRecord();
        stdCtrl.save();

      return null;
    }
    
    public PageReference cancel(){
        LLC_BI__Loan__c loan=(LLC_BI__Loan__c) stdCtrl.getRecord();  
        stdCtrl.save();  
      return null;
    }

}

Visualforce Page
<apex:page showHeader="false" sidebar="false" standardController="LLC_BI__Loan__c" extensions="nCino_ChecklistExt" standardStylesheets="true">

<head>
<apex:stylesheet value="{!URLFOR($Resource.bootstrap, '/css/bootstrap.css')}"/>
<style type="text/css">
.thebox{
    margin: 15px;
    width:auto;
    height:400px;
    background-color:#F0F0F0;
    border-radius:15px;
    }
    
.left-side{
    float:left;
    width:16.66666667%;
    background-color:#FFF;
    height:400px;
    }
    
.right-side{
    float:left;
    width:83.33333333%;
    height:400px;
    }

.border-green{border-left-color:#88C240;border-left-width:5px;}
.border-blue{border-left-color: #2D79D7;border-left-width:5px;}
.border-red{border-left-color: #BA202F;border-left-width:5px;}
.border-yellow{border-left-color: #F5AB3F;border-left-width:5px;}
.border-gray{border-left-color: #666;border-left-width:5px;}

.top-border-blue{border-top-color:#88C240;border-top-width:5px;}

</style>

<title>Untitled Document</title>
</head>
<div class="thebox">
    <div class="left-side">
        <div class="list-group" role="tablist" id="myTab">
            <apex:repeat value="{!ConfigValues}" var="cv">
                <a href="#tab{!cv.Tab_Display_Order__c}" class="list-group-item border-{!cv.Tab_Color__c}" role="tab" data-toggle="tab"><i class="gyphicon glyphicon-{!cv.Icon_for_Tab__c}"></i>&nbsp;{!cv.Tab_Name__c}</a>
            </apex:repeat>
        </div>
    </div>
    <apex:form>
    <div class="right-side tab-content" id="myTabcontent">
        <div class="tab-pane active">
            Main Page :)
        </div>
        <apex:repeat value="{!ConfigValues}" var="ncv">
            <div class="tab-pane" id="tab{!ncv.Tab_Display_Order__c}">
                <apex:pageBlock title="{!ncv.Tabbed_Content_Name__c}">
                    <apex:pageBlockSection>
                        <apex:variable value="{!ncv.Field_Set__c}" var="fieldset"/>
                        <apex:repeat value="{!$ObjectType.fieldset}" var="f">
                            <apex:outputField value="{!LLC_BI__Loan__c[f]}">
                                <apex:inlineEditSupport event="ondblclick"/>
                            </apex:outputField> 
                        </apex:repeat>  
                    </apex:pageBlockSection>     
                    <apex:pageBlockButtons location="bottom">
                        <apex:commandButton action="{!save}" value="Save"/>
                        <apex:commandButton action="{!cancel}" value="Cancel"/>
                    </apex:pageBlockButtons>                
                </apex:pageBlock>
            </div>
        </apex:repeat>
       
    </div>
    </apex:form>
</div>

<apex:includeScript value="{!URLFOR($Resource.bootstrap, '/js/jquery-2.1.1.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.bootstrap, '/js/bootstrap.min.js')}"/>

<script>
  $('#myTab a').click(function (e) {
  e.preventDefault()
  $(this).tab('show')
})
</script>
</apex:page>


Hi Dears,

I am using javascript and the Service Console Integration Toolkit.

<A HREF="#" onClick="testOpenSubtab();return false">
    Click here to open a new subtab</A>

Now when i renderAs="pdf" then its is not working. Please assist on this.

Hi,

Please help me in understanding,Is OU Auth 2.0 the only way to interact with salesforce using rest API'S or does is support the session Id(I,e the session Id we get as part of login menthod in SOAP API).

I am trying to call Query method of REST API by passing the session Id as Authorization header, I get from login method of SOAP API.I am getting below error:
<errorCode>INVALID_SESSION_ID</errorCode>
      <message>Session expired or invalid</message>

below is the url I am calling by passing Authorization header with the value of session Id I am getting from login method form SOAP API.
https://cs2.salesforce.com/services/data/v31.0/query/?q=SELECT ID,name from Contact

Please help.Are there any SOAP UI test cases or samples to refer.I am trying to test from SOAP UI.

Thanks,
Rathna
the link i have provided is that of the salesforce dashboard i hv created related to report bt wen i run this vf page i get the broken image..like in pic below

iwant to create   a gauge which points to total sum of account ( adding sum fiels of all related contacts).
https://developer.salesforce.com/blogs/developer-relations/2012/10/animated-visualforce-charts.html
i referred this link bt i dnt know where from it created the image or whethr it copied from dashboard.

      controller
:


<apex:page standardController="Account" extensions="GaugeChartController">

   <apex:chart name="MyChart" height="300" width="450" animate="true" data="{!data}">

       <apex:axis type="Gauge" position="gauge" title="Total Sum" minimum="0" maximum="300" steps="10"/>

       <apex:gaugeSeries dataField="size" donut="50" colorSet="#78c959,#ddd"/>

   </apex:chart>
   <script>

    MyChart.on('beforeconfig', function(config) {

        config.axes[0].margin=-10;});
</script>
<a class="overlay" href="https://ap1.salesforce.com/01Z90000000noOl"><img class="size-medium wp-image-10915 aligncenter" src="https://ap1.salesforce.com/01Z90000000noOl" alt="" width="300" height="156"/></a>
</apex:page>

class

public class GaugeChartController {

    public String acctId {get;set;}



    public GaugeChartController(ApexPages.StandardController controller){

        acctId = controller.getRecord().Id;

    }



    public List<gaugeData> getData() {

          Integer TotalOpptys = 0;

          Integer TotalAmount = 0;

          Integer thisMonth = date.Today().month();



          AggregateResult ar = [select SUM(Sum__c) totalsum,
                                            COUNT(Name) numC
                                   from contact

                                   where AccountId =: acctId

                                   GROUP BY LastName LIMIT 1];



          List<gaugeData> data = new List<gaugeData>();

          data.add(new gaugeData(Integer.valueOf(ar.get('numC')) + ' contact', Integer.valueOf(ar.get('totalsum'))));


          return data;

     }



    public class gaugeData {

        public String name { get; set; }

        public Integer size { get; set; }



        public gaugeData(String name, Integer data) {

            this.name = name;

            this.size = data;

        }


}
}

   User-added image


I've recently started working with Salesforce, so this is all still pretty new to me. I just got OAuth working with the PHP Toolkit, and I'm not able to perform queries. Great! The trouble is I'm a little perplexed by what I'm getting.

In any Records object, I'm getting three fields: Id, any, and type. Id and type make sense, but any seems to be xml for every non-id column I've queried.. I am using the Partners.wsdl, and I understand it's loosely typed. Is this a consequence of using that? It's just unfortunate that I'll have to parse every value for every object. That can result in a  lot of overhead.

Thanks for any and all advice!
Hi

I am trying to update picklist value for leadsource through metadata api but not sure why getting 'Concurrent modification from setup pages' error. 
Below is my code :
private bool UpdatePicklist(string sfObject, string picklistName, List<string> picklistValues)
        {
            List<string> extraPickList = new List<string>();
            if (_ms == null)
                GetMetaDataService();
            DescribeSObjectResult sr = _sf.describeSObject(sfObject);
            if (sr == null || sr.fields == null || sr.fields.Length == 0)
            {
                _log.Info("Error occured : sf object description is null");
                return false;
            }

            foreach (Field field in sr.fields)
            {
                if (!(field.type == fieldType.picklist && field.name == picklistName))
                    continue;
                foreach (PicklistEntry entry in field.picklistValues)
                {
                    if (!picklistValues.Contains(entry.value))
                    {
                        extraPickList.Add(entry.value);
                    }

                }
                if (extraPickList.Count > 0)
                {
                    extraPickList.AddRange(picklistValues);
                    CustomField co = new CustomField();
                    co.fullName = sfObject + "." + picklistName;
                    co.type = (SfApi.FieldType)Enum.Parse(typeof(SfApi.FieldType), "Picklist");
                    co.picklist = new Picklist();
                    co.picklist.sorted = true;
                    List<PicklistValue> picklistArray = new List<PicklistValue>();
                    foreach (string picklistValue in extraPickList)
                    {
                        PicklistValue pick = new PicklistValue();
                        pick.fullName = picklistValue;
                        // setting default value
                        if (picklistValue == "Other")
                            pick.@default = true;
                        picklistArray.Add(pick);
                    }
                    co.picklist.picklistValues = picklistArray.ToArray();
                    Metadata[] m = new Metadata[] { co };
                    UpdateMetadata um = new UpdateMetadata();
                    um.metadata = m[0];
                    UpdateMetadata[] uma = new UpdateMetadata[] { um };
                    AsyncResult r = _ms.update(uma)[0];
                    //AsyncResult r = _ms.create(m)[0];
                    while (!r.done)
                    {
                        System.Threading.Thread.Sleep(10 * 1000);
                        r = _ms.checkStatus(new string[] { r.id })[0];
                        _log.Info("Still On");
                    }
                    if (r.state == AsyncRequestState.Error)
                    {
                        _log.Info("Error : " + r.statusCode + " " + r.message);
                        return false;
                    }
                    else
                    {
                        _log.Info("Picklist successfully recreated");
                        return true;
                    }
                }
                else
                    return true;
                break;
            }
            return false;
        }

Please let me know the solution for this, tried many things but no success.
I'm having a hard time getting answer as to how to properly set up Public Knowledge when using multiple sites and categories. 

We have 3 main categories groups set up with sub categories in each. The main Categories are "Print and Sign", "Nonprofit" and "Small-Medium Business". Each category is assigned to a different site. We have some articles that are only assigned to the Nonprofit category. However, when you search on the site that's using the "Small-Medium Business" category and search using "No Filter", articles that only belong to the Nonprofit category are returned even though they don't belong to that category and specifically say "No Category" in Article Management for "Small-Medium Business".

I've tried editing the Visibility Settings to change from "All Categories" to Custom categories and that doesn't fix the problem. What am I missing? How can I restrict articles that are returned in searches with No filters? Is that the intended result when "No Filter" is selected?

Here are some images of how I have things set up:

here are the data categories. Each Category has children categories and all of them have "All" as the first subcategory.

User-added image

Data Category Visibility Settings:
User-added image

I have three sites. Each Site is set up to use a different Category and each site's profiles has data visibilty to a different category:

User-added image

Here's how an Article is set up and it's only category is "Nonprofit".
User-added image

When I go to the site for "Print and Sign" and do a search using "No Filter", it returns the article from above that is only assigned to the "Nonprofit" category.

User-added image

Can anyone help me figure out how to limit the search results to only articles that belong to a specific category? Do I need to set up the categories different? I've tried changing visibility settings and that seems to only cause the filter list to change (as in all of the sub categories are gone).
Hi All,

I am creating a service console app for service cloud. I wanted to integrate facebook and twitter with the service console app so that cases can be generated from facebook and twitter. But I don't know how to do it and I didn't find any helping guide or material. Please help.
Does anybody has a working example that uses the connection.login.js ?

I'm trying to connect to salesforce from an exterior website using javascript and getting an Error.

Here is My code:

<!DOCTYPE HTML>
<HTML>
<HEAD>

<script src="https://na6.salesforce.com/soap/ajax/30.0/connection.js" ></script>

<script type="text/javascript" >

function logincall()
{

    try{
   
   
    var usrname = document.getElementById('userid').value;
    var passwrd = document.getElementById('passid').value;

    if(usrname == null || usrname == '' || passwrd == null || passwrd == '')
    {
        alert('Please enter Username AND Password');
        return;
    }
   
    var result = sforce.connection.login(usrname, passwrd);

    alert("Logged in with session id " + result.sessionId);
    }
    catch(error)
    {
        alert(error);
       
       
    }

}
</script>

</HEAD>

<BODY>

To test logging into a Salesforce Instance using the connection.js "login" call

<table>
        <tr>
            <td>Username</td>
            <td><input type="text" id="userid" value="" /></td>
        </tr>
        <tr>
            <td>Password</td>
            <td><input type="password" id="passid" value="" /></td>
        </tr>

</table>

    <input type="button" value="Login" onclick="logincall();" />

</BODY>

</HTML>


I'm getting an Error :  The requested url services/Soap/u/30.0 was not found on this server


Any idea anyone?

I am using a 30-day trial version of force.com
When I am trying to create project in Eclipse IDE(Kepler), after entering credentials and security token, I am getting the message as " Force.com require an organisation with the metadata API enabled. API is not enabled for this Organisation or Partner"
Can someone help in getting this work for me.
Thanks in adavance!!!
Hi,
I have a Custom Object named preferred rate. It is related to the account in a Master detail relation ship with the account being the Master.

There are two record types in Account named Customer and SIte with the Customer Record type being the Parent of the Site Account record type. A Preferred Rate record can be created on Customer as well as Site account.

I am looking for a validation rule such that When the Expiration Date entered on the Preferred Rate record on Site Account is greater than that on the Customer Account, it should throw an error.
The Site Account record type is the child of the Customer Record Type.
  • August 28, 2014
  • Like
  • 0
 Hi all,

I'm trying to create a job to update account data via the bulk API matching on the salesforce id.
I could create the job and the batch ok, however i continuously get an error when the batch tries to run: it keeps telling me that the salesforce id field available in the CSV file, whatever the way i named it:
I've tried Id, RecordId, id (in lower case), AccountNumber and for all 4 tentatives, i got the same error message.
I need to be able to mass-update data using the salesforce id (the data i've got was pulled out of salesforce with the SOAP API, retaining the field names the way they are provided by the SOAP API) and can't rely on external id (i'll be always pulling out data from salesforce first, therefore i'll have the salesforce id).

I've been struggling on this error since beginning of the week, unable to find relevant information on using salesforce id in bulk API update specifically. I would be really grateful if someone could help.

Thx in advance
Hi,
Is there any one written a trigger to retrieve price from selected price book into customer object?
Please advice
Thank you
Working on a cloud app.  We develop software that makes calls to 3rd part REST apis (ie Facebook or Twitter) to get/put data under the user's account (using OAuth2 procedures to authorize).

In Salesforce, I created a connected app and it works great for ME.  But we tried to use an account that belonged to a different organization and that failed.  We were able to login during the OAuth2 token acquisition procedure and received back both access & refresh tokens.  However, when we ran the app using that account the token was rejected.

I did some research and it appears that I would need to package my app and have the administrator of the other organization install it.  My coworkers are sure that this is wrong and that it should work fine just like FB & Twitter.  Am I wrong?  If so, any guess why the other user's token failed? Maybe I just need to tweak the app's permissions somehow?
global class CampaignReminder
{

  WebService static void SendReminder(string id)
    {
     
      id cmpid = id;
      Integer batchSize = 1; 
      database.executebatch(new SendeMailinBatch(cmpid) , batchSize);
       
    }
}
=================batch process====
global class SendeMailinBatch implements Database.Batchable<sObject>,Database.Stateful 

  Public id campaignid;
  global SendeMailinBatch(id campid) 
   { 
       campaignid = campid;
   }
  global Database.QueryLocator start(Database.BatchableContext BC) 
   { 
      //Batch on all campaign memeber who belongs to the requetsed campaign 
      String query = 'select id, emailtobesentid__c from campaignmember where campaignid = :campaignid'; 
      return Database.getQueryLocator(query); 
   }
  global void execute(Database.BatchableContext BC, List<sObject> scope) 
   { 
      //***  Select the campaign details
      List<campaignmember> cmx = new list<campaignmember>();
      campaign cmp = new campaign();
      cmp = [ select id, From_eMail__c, Reply_To__c, templatetobesent__c from campaign where id = :campaignid ];  
      for(Sobject s : scope) 
      { 
          //Type cast sObject in campaign object 
          campaignmember CM = (campaignmember)s ; 
          //Sending Mail
          Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
          mail.setSenderDisplayName(cmp.From_eMail__c);
          mail.setReplyTo(cmp.Reply_To__c);
          mail.setTargetObjectId(CM.emailtobesentid__c);
          mail.setTemplateId(cmp.templatetobesent__c);
          Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
      }
   }
   global void finish(Database.BatchableContext BC) 
   { 
     
   } 
}