• Dhaval Panchal
  • PRO
  • 2211 Points
  • Member since 2010
  • GyanSys Inc.


  • Chatter
    Feed
  • 67
    Best Answers
  • 6
    Likes Received
  • 0
    Likes Given
  • 33
    Questions
  • 341
    Replies
Hi,

I am getting below error while uploading unmanaged package:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using salesforce.com!

Error ID: 1838907660-1664 (701532195)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Is there a way around?

Thank you for your help!! 

Dhaval Panchal
Gyansys Infotech pvt ltd.
Bangalore
Hello,

I am facing strange issue with Bulk API (insert/upsert).
below is the error:
   Error in upsert (Account) record:
   Error Message - Record Type ID: this ID value isn't valid for the user:
   Status Code - INVALID_CROSS_REFERENCE_KEY
   Fields: RecordTypeId

But when I use SOAP API it works perfact this issue only occurs when I use Bulk API.

Any Idea?

Thanks,
Dhaval Panchal
Hello,

I am using Bulk Api with C#.net.
every time I am getting below error if xml file has more than 50 records.

<stateMessage>InvalidBatch : Failed to parse XML. Found invalid XML. entity reference names can not start with character ' ' (position: START_TAG seen ...&lt;SMS_Zip_Code_Map_EUC__c>J &amp; ... @1:72405)</stateMessage>

Below 50 records It works fine.

Anyone has some idea?

Thanks in Advance,
Dhaval Panchal

Hi, 

Using Dodge tool all the leads from "McGraw-Hill Construction" are updating to salesforce. This is there by installing package to salesforce. But now my client requirement is, I have to integrate to McGraw-Hill Construction Dodge tool for updating all records to salesforce using salesforce APex integration process. i'e using API s of Dodge tool. Is there any way to implement using rest Api or SOAP inorder to connect directly by salesforce coding.

Hi,

 

How many different ways to integrate .net with salesforce?

 

I tried using enterprice.wsdl. I was able to connect with salesforce but there are some problems using enterprise.wsdl

1. we need to get enterprise.wsdl if we need to use this code with other environment (i.e. if we have used sandbox during development and then we need to use that code with production)

2. every time we need to get latest enterprice.wsdl if we make changes to salesforce metadata.

 

I want to make it dynamic like java. I have integrated salesforce with java and it was dynamic (using parner.wsdl). But I donot have idea for .net.

 

Any one provide me sample code?

Below is my Code.   I am getting an error that I am attepting to dereference a null object.  I am not sure how to fix it.   I am very new to writtng triggers and any help would be very appriciated. 

 

 

 

trigger LastActDate3 on Task (after insert, after update) {

Set <ID> OptyIDs = new Set <ID> ();

Set<Id> Ready4Update = new Set<Id>();

List<Opportunity> OppList = new List<Opportunity>();

for (Task t: Trigger.new){

OptyIDs.add(t.WhatID);

}

Map<ID, Opportunity> OptyMap = new Map<ID, Opportunity> ([Select ID,Last_Activity__c from Opportunity where ID in :OptyIDs]);

for (Task t: Trigger.new){

if (t.WhatID != NULL){

 

Opportunity OptyRec = OptyMap.get(t.WhatID);

If (((!t.subject.contains('Act-On Email')) )){

 

Optyrec.Last_Activity__c = t.ActivityDate;

 

}

if(!Ready4Update.contains(OptyRec.id)){

 

   OppList.add(OptyRec);   

   Ready4Update.add(OptyRec.id);

 

}

 

}

}

if(OppList.size() > 0){

update oppList;

}

}

   
 

I created a new custom field that is a replacement of an existing one.  The existing field is referenced in an Apex Class.  When I attempt to update the Apex Class with the new field API name I receive the following error:

 

Error: Compile Error: alias is too long, maximum of 25 characters

 

Has anyone seen this error before?  Any suggestions on how to correct it?

 

Thanks

 

Hi,

 

I'm receiving the following error for code that has existed in our org for several years - I've only changed the reference from Estimated_Volume__c to Estimated_Annual_Volume__c.

 

Method does not exist or incorrect signature: EncodingUtil.urlEncode(Decimal, String)

 

Original lines:

        if(rec.Estimated_Volume__c != null){
            url += '&' + '00N600000029OCc=' + EncodingUtil.urlEncode(rec.Estimated_Volume__c,'UTF-8');

 

 

Revised lines:

        if(rec.Estimated_Annual_Volume__c != null){
            url += '&' + '00N600000029OCc=' + EncodingUtil.urlEncode(rec.Estimated_Annual_Volume__c,'UTF-8');

 

Any help would be greatly appreciated! 

 

Thanks!

Hi ,

 

Can any once face this problem when we executin some code using developer console the log will not open.

 

Any one face this problem.

 

Thank you

Hi,

 

I'm getting 'You have uncommitted work pending. Please commit or rollback before calling out' msg when I run my test class.  Can somebody help me to fix this please?

 

global class LeadCallOutBatchable implements Database.Batchable<sObject>, Database.AllowsCallouts{

global final String Query;

   global final String Entity;

 

   global LeadCallOutBatchable() {

      Query='SELECT Id, FirstName, LastName, UserName__c, Email, Title, fs_skills__c, fs_overview__c, fs_facebook__c, fs_twitter__c, fs_linkedin__c ' +   'FROM Lead WHERE UserName__c != null';  

        Entity= 'Lead';

   }

 

   global Database.QueryLocator start(Database.BatchableContext BC) {

      return Database.getQueryLocator(query);

   }

    

   global void execute(Database.BatchableContext BC, List<Lead> scope) {

        

        List<Lead> leadsToUpdate = new List<Lead>();

        String PersonURL ;

        Integer count = 0;

        System.debug('scope: ' + scope);

        

        for(Lead leadRec : scope ) {   

            String jResponse = '';

            JPersonList deserialPersonList = new JPersonList();

            count++;

            System.debug('Count: ' + count);           

            PersonURL =  URL

            

            try {

                HttpRequest req = new HttpRequest();

                req.setMethod('GET');

                String username = JUSERNAME;

                String password = JPW;

                Blob headerValue = Blob.valueOf(username + ':' + password);

                String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);

                req.setHeader('Authorization', authorizationHeader);

                req.setHeader('Accept', 'application/json');

                req.setEndPoint(PersonURL);

                

                Http http = new Http();

                system.debug('req: ' + req);

                HTTPResponse res = http.send(req);

         

               jResponse = res.getBody();

                

 

                jResponse = jResponse.Replace('throw \'allowIllegalResourceCall is false.\';', '');    

                //System.debug('Request Body: ' + jResponse);

                

                JSONParser parser = JSON.createParser(jResponse);

 

  // deserialize

                JObject personRecord = (JObject) System.JSON.deserialize(jResponse, JObject.class);

 

//some codes to compare

                

                       leadsToUpdate.add(leadRec);

                       System.debug('leadsToUpdate: ' + leadsToUpdate);

            }

            }

            catch(Exception ex) {

                System.debug('Exception: ' + ex);   

            }

        }

        System.debug('leadsToUpdate: ' + leadsToUpdate);

        update leadsToUpdate;

    }

        

   global void finish(Database.BatchableContext BC){ 

   }

}

 

 

test classes:

 

@isTest

public class LeadCalloutBatchableTest{

    public static testmethod void TestLeadCalloutBatchable() {

        

        List<ID> acRecs=new List<ID>();

        Lead testLead = new Lead( IncludeInSFToSync__c = true, FirstName = 'STEVE' , LastName = 'JOHN', UserName__c = 'stevej', Email = 'r@gmail.com', Title = 'testtest', fs_skills__c = 'developement' , fs_overview__c='good', fs_facebook__c='facebook', fs_twitter__c='twitter', fs_linkedin__c = 'linkedin');

        insert testLead;

        acRecs.add(testLead.id);

       

        string JSONstr = 

        SingleRequestMock fakeResponse = new SingleRequestMock(200,'Complete', JSONstr ,null);

 

        Test.startTest();

        Test.setMock(HttpCalloutMock.class, fakeResponse);

        Database.executeBatch(new LeadCallOutBatchable(), 200);

       

        Test.stopTest();

   

    }

}

 

 

@isTest

global class SingleRequestMock implements HttpCalloutMock {

    protected Integer code;

    protected String status;

    protected String bodyAsString;

    protected Blob bodyAsBlob;

    protected Map<String, String> responseHeaders;

  

   

    public SingleRequestMock(Integer code, String status, String body, Map<String, String> responseHeaders) {

        this.code = code;

        this.status = status;

        this.bodyAsString = body;

        this.bodyAsBlob = null;

        this.responseHeaders = responseHeaders;

 

    }

         

   public SingleRequestMock(Integer code, String status, Blob body, Map<String, String> responseHeaders) {

        this.code = code;

        this.status = status;

        this.bodyAsBlob = body;

        this.bodyAsString = null;

        this.responseHeaders = responseHeaders;

    }

    

    public HTTPResponse respond(HTTPRequest req) {

        HttpResponse resp = new HttpResponse();

        resp.setStatusCode(code);

        resp.setStatus(status);

        if (bodyAsBlob != null) {

            resp.setBodyAsBlob(bodyAsBlob);

        } else {

            resp.setBody(bodyAsString);

        }

        

        if (responseHeaders != null) {

            for (String key : responseHeaders.keySet()) {

                resp.setHeader(key, responseHeaders.get(key));

            }

        }

        return resp;

    }  

}

 

 

 

I have 4 text fields that I need to set to null. But am getting an error 'Null is not definied' when trying to use the button. Any feedback as to syntax for this?

 

 

 

Here is the relevant piece of my javascript Onclick button code:

 

var caseUpdate = new sforce.SObject("Case");

 

caseUpdate.Id = caseObj.Id;
caseUpdate.InEditUserId__c = Null;
caseUpdate.InEditUser__c =Null;
caseUpdate.InEditTime__c =Null;
caseUpdate.InEditViewURL__c=Null;


updateRecords.push(caseUpdate);

 

 

 

 

 

I'm wondering if someone could help me bulkify this trigger. As background, we have a custom object RBA_Invoice_Line_Item__c in master-detail to RBA_Participant__c and RBA_Invoice__c. We would like to get a double amount updated on the Participant based on the Invoice Date. If it's in the current month, the total amount from the Line Items would update "Current Month Total" on the Participant. The same would happen for Line Items where the invoice date = last month, to update a "Previous Month Total" field on Participant.

 

Here is the trigger:

trigger RBA_Invoice_Line_Item_RollupTrigger on RBA_Invoice_Line_Item__c (after update, after insert, after delete) {

     Map<Id, Double> previousMonthTotals = new Map<Id, Double>();
     Map<Id, Double> currentMonthTotals = new Map<Id, Double>();
     List<RBA_Participant__c> participantsToUpdate = new List<RBA_Participant__c>();
     List<RBA_Invoice_Line_Item__c> itemsForParticipant;
     
    
     List<RBA_Invoice_Line_Item__c> items;

     if (trigger.isDelete) {
         items = trigger.old;
     }
     else {
         items = trigger.new;
     }
     
        // Go through all of the line items that the trigger
        // is acting on
        
        for (RBA_Invoice_Line_Item__c triggerItem: items) {
            
            // Get the participant's ID for the line item and then
            // ensure their ID exists in the previous / current month totals
            // maps and their totals default to $0.00
            
            Id participant = triggerItem.RBA_Participant__c;
            
            if (!previousMonthTotals.containsKey(participant)) {
                previousMonthTotals.put(participant, 0.0);
            }
            if (!currentMonthTotals.containsKey(participant)) {
                currentMonthTotals.put(participant, 0.0);
            }
            
            // Sum the total cost of all previous month's line items
            // for the current participant (see participant above)
            //
            // 1. get all of the line items for the previous month
            // 2. for each line item update the mapping for the participant 
            //    to be (previous total + total cost)
                        
            itemsForParticipant =
                [SELECT Id, Total_Cost__c FROM RBA_Invoice_Line_Item__c
                    WHERE Invoice_Date__c = LAST_MONTH AND RBA_Participant__c = :participant];
            
            for (RBA_Invoice_Line_Item__c item : itemsForParticipant) {
                // previous month total = current total cost + total cost of line item
                previousMonthTotals.put(participant, 
                    previousMonthTotals.get(participant) + item.Total_Cost__c);
            }
            
            // Sum the total cost of all current month's line items
            // for the current participant (see participant above)
            //
            // 1. get all of the line items for the current month
            // 2. for each line item update the mapping for the participant 
            //    to be (previous total + total cost)
                          
            itemsForParticipant =
                [SELECT Id, Total_Cost__c FROM RBA_Invoice_Line_Item__c
                    WHERE Invoice_Date__c = THIS_MONTH AND RBA_Participant__c = :participant];
            
            for (RBA_Invoice_Line_Item__c item : itemsForParticipant) {
                // current month total = current total cost + total cost of line item
                currentMonthTotals.put(participant, 
                    currentMonthTotals.get(participant) + item.Total_Cost__c);
            }
                          
        }
        
        // Collect all of the unique participant IDs from both
        // mappings into a list
        
        List<Id> participants = new List<Id>();
        
        // First add all previous month unique participants
        
        for (Id previous : previousMonthTotals.keyset()) {
            participants.add(previous);
        }
        
        // ... then add any participants in the current month totals
        // that aren't in the previous month totals
        
        for (Id current : currentMonthTotals.keyset()) {
            if (!previousMonthTotals.containsKey(current)) {
                participants .add(current);
            }
        }
        
        // For each collected participant ID from the previous step, retrieve the participant
        // record from Salesforce then update their totals if and only if we collected
        // totals from them
        
        for (Id id : participants) {
        
            RBA_Participant__c participant = [SELECT Id, Previous_Month_Total__c, Current_Month_Total__c
                 FROM RBA_Participant__c WHERE Id = :id];
                 
            if (previousMonthTotals.containsKey(id)) {
                participant.Previous_Month_Total__c = previousMonthTotals.get(id);
            }
            
            if (currentMonthTotals.containsKey(id)) {
                participant.Current_Month_Total__c = currentMonthTotals.get(id);
            }
            
            // Collect participant record in a list we will then batch update
            // once we are done looping
            
            participantsToUpdate.add(participant);
        }
        
        // Batch update all updated participants
        
        update participantsToUpdate;

}

 

I see this in the debug log:

09:22:32.982|CUMULATIVE_PROFILING|SOQL operations|
Trigger.RBA_Invoice_Line_Item_RollupTrigger: line 43, column 1: [SELECT Id, Total_Cost__c FROM RBA_Invoice_Line_Item__c
                    WHERE Invoice_Date__c = LAST_MONTH AND RBA_Participant__c = :participant]: executed 51 times in 279 ms
Trigger.RBA_Invoice_Line_Item_RollupTrigger: line 60, column 1: [SELECT Id, Total_Cost__c FROM RBA_Invoice_Line_Item__c
                    WHERE Invoice_Date__c = THIS_MONTH AND RBA_Participant__c = :participant]: executed 50 times in 182 ms

 

but I'm not sure how/where to move those queries?

i need Chatter same view on my Visualforce page.Urgent

 

Hi,

 

 

can any one send the code pls.

 

 

thankns

Ramesh

<apex:page name="Queue Criteria" tabStyle="Contact" id="Page"  title="Criteria"  standardController="Queue_Criteria__c" extensions="QueueCriteriaStdController">
    <apex:form id="Form" title="Criteria">
        <apex:sectionHeader title="Queue Criteria" subtitle="New Queue Criteria" id="PSHeader"/>
        <apex:pageBlock title="Queue Criteria Edit" id="PBlock" tabStyle="Contact" mode="edit">
            <apex:pageMessages >
            </apex:pageMessages>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" />
                <apex:commandButton value="Save & New" />
                <apex:commandButton value="Cancel" action="{!cancel}" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Information" columns="2" id="PBSection" collapsible="false">
                <apex:inputField value="{!Queue_Criteria__c.Name__c}" required="true"/>
                <apex:inputField value="{!Queue_Criteria__c.Contact_Name__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="1"  collapsible="false" >
                <apex:selectList > value="{!Queue_Criteria__c.Operator__c}" required="true" >
                <apex:actionSupport event="onmouseover" reRender="UBV2"/>
                </apex:selectList>
                <apex:inputField value="{!Queue_Criteria__c.Bounded_Value__c}"/>
                <apex:inputField value="{!Queue_Criteria__c.UnBounded_Value1__c}" styleClass="hidden"/>
                </apex:pageBlockSection>
                                <apex:outputPanel id="UBV2"  >
                                <apex:pageBlockSection id="pbs" rendered="{!IF((Queue_Criteria__c.Operator__c=='Between'),true,false)}" >
              
                <apex:inputField value="{!Queue_Criteria__c.UnBounded_Value2__c}"  />                  
                               </apex:pageBlockSection>
                                </apex:outputPanel>

                    </apex:pageBlock>
    </apex:form>     
    <script>
    function callUBV()
    {
    var Opr=document.getElementById('Page:Form:PBlock:j_id32:j_id33').value;
           
    }
    </script>
</apex:page>

My Custom Visualforce page.
<apex:page controller="UnapprovedList">
<apex:pageBlock title="Opportunities">
<apex:pageBlockTable value="{!Opportunity}" var="item">
<apex:column value="{!item.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

My Controller
public class UnapprovedList{
private final Opportunity opportunity;

public UnapprovedList() {
opportunity = [SELECT Id, Name FROM Opportunity limit 1];
// the page displays error if i remove limit 1.
//System.QueryException: List has more than 1 row for assignment to SObject
}

public Opportunity getOpportunity () {
return opportunity;
}
}

where is the problem?? i want to show more than one row but when i return multiple row the error pops up..
Any help would be appricated.

Hello,

        I need bulk api code in C#.net.The developer guide gives the code for client java application.I need it for C#.net.or can i convert the same code to C#.I tried it using IKVM,buit couldnot do it successfully.Please help.

Does anyone know how to use Bulk API in C#?

the Web Service API can only update max 200 records at once.

Bulk API can update 10,000 records at once.

I only find sample code using Java.

Thanks.