• Wilmer
  • NEWBIE
  • 285 Points
  • Member since 2007

  • Chatter
    Feed
  • 10
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 121
    Replies

{faultcode:'soapenv:Client', faultstring:'System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'

 

Class.ApexcallingBpelSimple.ApexCalling_BPEL_SimplePort.process: line 19, column 13
Class.SFDCSyncWrapper.CreateFunction: line 12, column 17
External entry point', }

 

how to fix this

 

Thanks,

Vivek.

Hi,

 

     I have a trigger on opportunity update which will update the opportunity line items  accordingly.

 

     Through the debug log I found the trigger is triggered twice, even though I specify it will only be triggered if there is a stage change from sA to sB. 

 

     From the discussion board, I found the reason is due to certain workflow rule did field update right after the trigger. But the funny thing is after the first firing, the previous stage of the opportunity is still considered as sA instead of sB, while the opportunity line items data did accumulated after the firing.

 

     In the end, the number of line items doubled.  Although I have ways to prevent the line items from the second round of accumulation, I am just curious how to deal with the second fire of trigger?

 

 

     Btw, I found the governer limit of SOQL in sandbox increased from 20 to 100! Good news!

 

 

Thanks,

Dawn

Message Edited by dawnzdy on 04-15-2009 12:23 PM

We went Live with SF today, and I'm getting Too many SOQL queries error on a trigger of mine.

 

The trigger is fairly simple in concept in that it takes the ownership of an opportunity and makes certain related objects (or certain objects related to those related objects) and makes the owner of the record the same.

 

In implmentation, I had to do maps and limit the scope of of things with comparisions to keep under the limits and I succeeded until now. 

 

But I'm making no sense of this error message.  At my count there are at most 12 SOQL queries in my code, none in any sort of loop.  So..... how is it adding up to 20?  Is it counting Workflows, Triggers that trigger other triggers, triggers that trigger other triggers that trigger this trigger again?  What are the exception to the rule in which I can't just count the number of potential queries in a given query code to see if I'm going to exceed this SOQL limit?

 

Here's the code:

trigger Opportunity_Ownership_Trigger on Opportunity (after insert, after update) {
    List<String> theIds = new List<String>();
    for(Opportunity opp : Trigger.new) {
          theIds.add(opp.Id);
      }
      boolean updated = false;
     
      List<Order_Detail__c> od_list = [SELECT Id,Opportunity__c,OwnerId,Order__c FROM Order_Detail__c WHERE Opportunity__c IN :theIds];
      for(Order_Detail__c od : od_list) {
        if (Trigger.newMap.get(od.Opportunity__c).OwnerId != od.OwnerId) {
              od.OwnerId = Trigger.newMap.get(od.Opportunity__c).OwnerId;
              updated = true;
        }
      }
      if (updated)
      {
          update od_list;
      }
      Map<Id, Order_Detail__c> od_map = new Map<Id, Order_Detail__c>([SELECT Id,Opportunity__c,OwnerId,Order__c FROM Order_Detail__c WHERE Opportunity__c IN :theIds]);
      Map<Id, Order_Detail__c> od_order_map = new Map<Id, Order_Detail__c>();
      for(Order_Detail__c od : [SELECT Id,Opportunity__c,OwnerId,Order__c FROM Order_Detail__c WHERE Opportunity__c IN :theIds]) {
          if(!od_order_map.containsKey(od.Order__c)) {
              od_order_map.put(od.Order__c,od);
          }         
      }
 
      updated = false;
     
      List<Invoice_Detail__c> id_list = [SELECT Id,Opportunity__c,OwnerId,Invoice__c FROM Invoice_Detail__c WHERE Opportunity__c IN :theIds];
      for(Invoice_Detail__c id : id_list) {
        if (Trigger.newMap.get(id.Opportunity__c).OwnerId != id.OwnerId) {
              id.OwnerId = Trigger.newMap.get(id.Opportunity__c).OwnerId;
              updated = true;
        }
      }
      if (updated)
      {
          update id_list;
      }
      Map<Id, Invoice_Detail__c> id_map = new Map<Id, Invoice_Detail__c>();
      for(Invoice_Detail__c id : [SELECT Id,Opportunity__c,OwnerId,Invoice__c FROM Invoice_Detail__c WHERE Opportunity__c IN :theIds]) {
          if(!id_map.containsKey(id.Invoice__c)) {
              id_map.put(id.Invoice__c,id);
          }
      }
     
      updated = false;
      theIds = new List<String>();
    for(Order_Detail__c od : od_list) {
          theIds.add(od.Id);
      }
      List<Order_Release__c> or_list = [SELECT Id,OwnerId,Order_Detail__c FROM Order_Release__c WHERE Order_Detail__c IN :theIds];
      for(Order_Release__c or_item : or_list) {
        if (od_map.get(or_item.Order_Detail__c).OwnerId != or_item.OwnerId) {
              or_item.OwnerId = od_map.get(or_item.Order_Detail__c).OwnerId;
              updated = true;
          }
      }
      if (updated)
      {
          update or_list;
      }
     
      updated = false;
      theIds = new List<String>();
    for(Order_Detail__c od : od_list) {
          theIds.add(od.Order__c);
      }     
      List<Sales_Orders__c> o_list = [SELECT Id,OwnerId FROM Sales_Orders__c WHERE Id IN :theIds];
      for(Sales_Orders__c o : o_list) {
        if (od_order_map.get(o.Id).OwnerId != o.OwnerId) {
              o.OwnerId = od_order_map.get(o.Id).OwnerId;
              updated = true;
          }
      }
      if (updated)
      {
          update o_list;
      } 
         
      updated = false;
      theIds = new List<String>();
    for(Invoice_Detail__c id : id_list) {
          theIds.add(id.Invoice__c);
      }     
      List<Invoice_Object__c> i_list = [SELECT Id,OwnerId FROM Invoice_Object__c WHERE Id IN :theIds];
      for(Invoice_Object__c i_item : i_list) {
        if (id_map.get(i_item.Id).OwnerId != i_item.OwnerId) {
              i_item.OwnerId = id_map.get(i_item.Id).OwnerId;
              updated = true;
          }
      }
      if (updated)
      {
          update i_list;
      }       
}

 

Additionally these triggers support that trigger by invoking it appropriately, but do not error out:

trigger Opportunity_Ownership_Trigger_Order_Detail on Order_Detail__c (after insert, after update) {
    List<String> theIds = new List<String>();
    if (Trigger.isInsert) {
        for (Order_Detail__c od : trigger.new) {
            if (od.Opportunity__c != null) {
                theIds.add(od.Opportunity__c);   
            }   
        }
    }
    else if (Trigger.isUpdate) {
        for (Order_Detail__c od : trigger.new) {
            if (Trigger.oldMap.get(od.Id).Opportunity__c != od.Opportunity__c) {
                if (od.Opportunity__c != null) {
                    theIds.add(od.Opportunity__c);     
                }
            }
        }
    }
    List<Opportunity> opp_list = [SELECT Id FROM Opportunity WHERE Id IN :theIds];
    update opp_list;
}

trigger Opportunity_Ownership_Trigger_Invoice_Detail on Invoice_Detail__c (after insert, after update) {
    List<String> theIds = new List<String>();
    if (Trigger.isInsert) {
        for (Invoice_Detail__c od : trigger.new) {
            if (od.Opportunity__c != null) {
                theIds.add(od.Opportunity__c);   
            }   
        }
    }
    else if (Trigger.isUpdate) {
        for (Invoice_Detail__c od : trigger.new) {
            if (Trigger.oldMap.get(od.Id).Opportunity__c != od.Opportunity__c) {
                if (od.Opportunity__c != null) {
                    theIds.add(od.Opportunity__c);     
                }
            }
        }
    }
    List<Opportunity> opp_list = [SELECT Id FROM Opportunity WHERE Id IN :theIds];
    update opp_list;
}

Code:
public class List1 
{
Public void abc()
{
List<Account> acc = new List<Account>();
List<String> IdList = new List<String>();
List<Contact> ConList = new List<Contact>;
acc = [select Id from Account];
for(Account a : Acc)
{
String temp = '\''+a.Id+'\'';
IdList.add(temp);
}
String s = 'select id from Contact where Account.id in '+IdList;
ConList = Database.query(s);
}
}

While executing the above dynamic SOQL query, I am getting the following error. System.QueryException: unexpected token: .

If my Account  query is returning <= 10 then its working fine, but if it returns more than 10 then I am getting the error.

Any suggestions on this are highly appreciated.


Note: I need to execute this as Dynamic SOQL not the static SOQL.



 



Message Edited by hisrinu on 12-29-2008 04:29 AM
I don't know if anyone else is running into this now but ever since I installed the Apex Toolkit 8.1.0.200710161138 Eclipse is replacing my latin characters with question marks when compiling Apex Code.  For example:

République des Îles Fidji

Becomes:

R?publique des ?les Fidji

After compiling the code (saving in Eclipse).

(Edited, retrieving from SFDC does not filter latin characters, just compiling.)

Message Edited by EJW on 11-07-2007 09:17 AM

  • November 07, 2007
  • Like
  • 0
Hi, I'm working in a customized trasfering process and I tried to make it by Dynamic DML operation. In spite of I have already enable the "Allow reparent checkbox attribute at the master-detail field, I got an error llike: "Invalid field  for ChildObject__c" (seems like no field name were given).

Here is my sample code:
public class myTransferClass_cls{

public void fnTransfer(){
id TargetAccId = 'myTargetAccountId'; // this is an Id

// Get the records to be transferred
Account SourceAcc : [SELECT Id, Name, 
	// Related Plans: Planes asociados
	(SELECT Id, ParentId__c FROM ChildRecords__r)
	FROM Account
	WHERE Id = 'mySourceAccId' LIMIT 1];

myTransferClass_cls  ctr = new myTransferClass_cls();
ctr.transferChildRecords(SourceAcc.ChildRecords__r, TargetAccId, 'ChildObject__c', 'ParentId__c');
}

// Here is the generic Method to transfer child records
private integer transferChildRecords(list<sObject> RecordsToTransfer_lst, id TargetPatientId, string strObjectName, string strParentFieldName){
		integer intTransferredRecords = 0;
		
		if(!RecordsToTransfer_lst.isEmpty()){

			for(sObject record : RecordsToTransfer_lst){
				record.put(strParentFieldName, TargetPatientId);
			}
			system.debug('*** NEW RecordsToTransfer VALUES: '+RecordsToTransfer_lst);
			update RecordsToTransfer_lst;
			intTransferredRecords = RecordsToTransfer_lst.size();
		}
		
		return intTransferredRecords;
	}
}
Any ideas? or it's not possible to do it with Dynamic DML by now?

Thanks for your help.

Regards,

Wilmer






 
  • September 15, 2015
  • Like
  • 0
Hi, I would like to get some information or sample code about how to read an external file (ie. pdf file) which is located at AWS S3. I´ve already know there is a toolkit to do that, but I also found out that Amazon has deprecated SOAP for their services and it would be sooner or later when they decide not to support anymore new SOAP request (now for example they do it only in https calls and said they won't updgrade SOAP methods, according to their documentation).

Any help on this with some sample code would be appreciated.

Hi,

 

I would like to know how can I show a custom label value into a message displayed by an onclick event in a Command Link button.

 

In example

<apex:commandLink value="{!$Label.MyLabel1}" onclick="return confirm('Are you sure?')" action="{!removeItem}">
   <apex:param name="removeItemId" value="{!item.objId}" assignTo="{!selectedItemId}" />
</apex:commandLink>

 

I would like to replace the hard coded 'Are you sure?' message by a custom Label value, but everytime I try, the related button doesn't  work properly. Any kind of suggestion?

 

Regards,

 

Wilmer

 

 

  • February 22, 2013
  • Like
  • 0

Hi, I just upgraded my Eclipse to 3.5 version, downloaded the 19.0 API and everything seems to be ok but the Javascript code is not highlighted.

 

Could someone help me up? I tried to follow some directions I found in this forum with 3.4 version, but didn't work this time.

 

I need it because I have some javascript code embeed into my Visualforce page that I need to edit, and with syntax coloring it is much easier.

 

Regards,

 

Wilmer

Hi, I've just upgraded Eclipse to 3.5 version, installed the 19.0 API plugin of Salesforce but unfortunatelly, when I open Visualforce pages, no Javascript code is highlighted.

 

Last time (with 3.4 version) I had the same problem and found a solution. But this time I tried to do the same and nothing happens. See this post.

 

Could someone please help me up?

 

Regards,

 

Wilmer

 

Hi, I need help in developing a custom formula field that calculates the Age from a given date, in terms of years and months, like this:

 

MyDate: 18/05/1990  (dd/mm/yyyy)

 

Calculated Age: 19 year(s), 11 month(s)

 

I have tried several formulas, but I only could get the year and I got problems with the months calculation.

 

Could someone help with this?

 

Regards,

 

Wilmer

Hi everyone,

 

I got Windows Vista and Office 2003, I installed the Office Toolkit 3.0 and Sforce connector 6.16, but I got a problem, everytime I try to build a query using its wizzard, no objects are shown in the picklist, so can't select fields and later, run the query. I just login, choose the cell A1 as the place to put the query but as I said, no object list is shown.

 

Besides, if I take a former excel file with a previous query (builded before), I can run that query with no problem.

 

I hope you could help me.

 

Regards,

 

Wilmer

Message Edited by Wilmer on 01-31-2010 11:55 PM
  • February 01, 2010
  • Like
  • 0

Hi,

 

I'm working in an integration using call outs to external webservice and got a problem exchanging date values.

 

Look, in the webservice WSDL document the field is defined as: 

 

<element name="BIRTH_DAY" type="date"/>

I generated the apex class from its WSDL and now, when I try to consume the external webservice, I got an error because the other app is waiting the date value in format dd/MM/yyyy but Salesforce sends it like yyyy-MM-dd.

 

Is there any way to convert its format before we send the request?

 

Regards,

 

 

Wilmer

 

 

 

 

 

 

 

 

 

  • January 28, 2010
  • Like
  • 0

Hi,

 

Does anybody have an example of how to do that? I mean, the problem is that it seems "Oracle SOA Suite" doesn't allow to process the WSDL of external webservices by its file, only by giving a valid URL address where the webservice is located.

 

For example: www.mycompany.com/service.asp?wsdl   or  www.mycompany.com/service/process.wsdl

 

The problem with Salesforce is that the generated WSDLis not public from an URL address.

 

Please, help in this case.

 

Regards,

 

 

Wilmer

  • January 26, 2010
  • Like
  • 0

Hi everybody,

 

I'd like to know how receive a XML string input and respond with a XML string output in an Apex webservice. I already know that this kind of communication is not problem when you use the Generate from WSDL button and call an external webservice. But, how could I receive the required informatio and send the respond by using XML in an apex webservice in order to make other systems talk to SFDC in that language?

 

Is there something like this?

 

 

webservice static XML myApexWebservice(XML MyINPUTString) { XML XML_Response; // here comes more logic; return XML_Response; }

 

 I found the following example:

 

global class AccountPlan { webservice String area; webservice String region; //Define an object in apex that is exposed in apex web service global class Plan { webservice String name; webservice Integer planNumber; webservice Date planningPeriod; webservice Id planId; } webservice static Plan createAccountPlan(Plan vPlan) { //A plan maps to the Account object in salesforce.com. //So need to map the Plan class object to Account standard object Account acct = new Account(); acct.Name = vPlan.name; acct.AccountNumber = String.valueOf(vPlan.planNumber); insert acct; vPlan.planId=acct.Id; return vPlan; } }

 

 Is this the answer am I looking for? But that means if the INPUT/OUTPUT XML is complex, Do I have to simulate all the XML schema by building the required objects?

 

Thank you very much for your help.

 

Regards,

 

Wilmer

 

 

 

 

 

 

 

  • October 19, 2009
  • Like
  • 0

Hi everybody,

 

I'm working on a new trigger in the UPDATE event and we need to identify specifically which fields of that object have changed its values. I know there is a comparison between trigger.new and trigger.old objects but as I can see, it is required to hardcode the field name to know what we are asking for.

 

Is it possible that catch that behavior dynamically? 

 

Regards,

 

Wilmer

  • August 24, 2009
  • Like
  • 0

Hi,

 

I have recently change my PC and reinstalled the development tools. I did it with Eclipse 3.4, the salesforce plugin and I found that Apexcode and visualforce code are colored, but javascript code (embeded in VF code) is not.

 

Does anybody know how to enable that in my Eclipse?

 

Regards,

 

Wilmer 

Hi everyone, 

 

I need to get some data from a related object through a lookup field in a trigger. I expected that in a Before event the only way to get data from the related object was by using a query. But in an AFTER event all relationships should be established and related could be get from lookup fields.

 

Here is my sample trigger code:

 

for(integer i = 0; i < trigger.new.size(); i++){ if(trigger.IsAfter && (trigger.IsInsert || trigger.IsUpdate)){ childObject__c RecordNew = trigger.new[i]; if(!RecordNew.ChildLkpField__r.ParentLkpField__r.ParentParentCheckbox__c && RecordNew.ChildLkpField__r.ChildCheckbox__c){ if(trigger.IsInsert){ // more code }else if(trigger.IsUpdate){ // more code } } }}

 

Suppose the lookup field name is "ChildLkpField__c", the poblem is that when I compile the code it doesn´t show any syntax error and when I print the values of the ChildLkpField__r."checkboxes" fields are shown as false and never like null.

 

Does anybody know how to catch the real value of the parent object fields without quering it (in a after event trigger)? If not possible please let me know. Or is it a Salesforce bug?

 

Thanks,

 

 

Wilmer 

 


 

 

 

 

 

Message Edited by Wilmer on 07-02-2009 04:55 PM

Hi,

 

I need to get a Field value from a Dynamic Query and I can do it when the query is over a child-to-parent relationship like this:

 

Object FieldValue;

SObject c = Database.query('select id, FirstName, AccountId, Account.Name from Contact limit 1');
SObject a = c.getSObject('Account');
FieldValue= a.get('Name');

 

 But, when I try to get the value from a parent-to-child relationship I get the error message "System.SObjectException: Invalid relationship Contacts for Account".

 

Here is the example of the code I used:

 

 

Object FieldValue;

 

SObject a = Database.query('SELECT id, (SELECT Name FROM Contacts limit 1) FROM Account limit 2');

SObject c = a.getSObject('Contacts');

FieldValue = c.get('Name');

 

The query is working fine and by the other way, I already know the subquery in normal (not dynamic) Apex is retrieved as an Object array. But, how could I  get the child field value from this query? (In this case, How could I get the list of Names of the related Contacts from the retrieved Accounts?).

 

The program is being stopped at line ("SObject c = a.getSObject('Contacts')" ). I looked into the apex documentation but I couldn't find such an example to follow. Please at least let me know if this is possible.

 

Regards,

 

Wilmer

 

 

 

 

 

 

Message Edited by Wilmer on 05-28-2009 06:20 PM
Message Edited by Wilmer on 05-28-2009 09:19 PM

Hi,

 

All I want is to enable an unique selection from one row, like this:

 

 

 Select one      Type           Class       Full Address 

       o               Option 1     class 1       Apple street 19 88
       o               Option 2     class 2       Orange avenue 30 56 

 

 

I have a pageBlockTable and want that one of the columns be a selectRadio button according to the record I display in the row.

 

 

<apex:pageBlockTable value="{!Direcciones}" var="Direccion" id="theTable" width="100%">
<apex:column id="col0">
<apex:facet name="header">Select one</apex:facet>
<apex:selectRadio id="selectDir" value="{!MiDireccion}" layout="pageDirection">
<apex:selectOption itemValue="{!Direccion.id}" itemLabel="{!Direccion.Name}">

</apex:selectOption>

</apex:selectRadio>
</apex:column>
<apex:column id="col1">
<apex:facet name="header">Type</apex:facet>
<apex:outputText value="{!Direccion.Tipo__c}"/>
</apex:column>
<apex:column id="col2">
<apex:facet name="header">Class</apex:facet>
<apex:outputText value="{!Direccion.Clase_Direccion__c}"/>
</apex:column>
<apex:column id="col3">
<apex:facet name="header">Full Address</apex:facet>
<apex:outputText value="{!Direccion.Direccion_Completa__c}"/>
</apex:column>
</apex:pageBlockTable>

 

The problem is that for every row it is set a new selectRadio object and for that reason the selection is not unique. I tried to make the next workaround but didn´t work because of a sintax error.

 

 

<apex:selectRadio id="selectDir" value="{!MiDireccion}" layout="pageDirection">
<apex:column id="col0">
<apex:facet name="header">Select one</apex:facet>
<apex:selectOption itemValue="{!Direccion.id}" itemLabel="{!Direccion.Name}"></apex:selectOption>
</apex:column>
</apex:selectRadio>

 

 

Please help with this issue.

 

 Thanks,

 

Wilmer

 

Message Edited by Wilmer on 05-22-2009 01:12 PM

Hi,

 

We have a scontrol that calls an apex webservice by the API an it was working fine until some days ago that it started to retrieve the following error message (not all the time):

 

 

ERROR: ........... {faultcode:'soapenv:Server', faultstring:'Unable to deserialize inputstream', }

 

This is the summary of the scontrol code:

 

 

<script src="/soap/ajax/13.0/connection.js"></script>
<script src="/soap/ajax/13.0/apex.js"></script>
<Script language="JavaScript">
// here goes another code
function callWS(){
var process = sforce.apex.execute('MyApexWebservice', 'Method1',{param1:1, starting: var_mystart, param2: var_for_param2, param3: var_for_param3 },
function(result){
// here is another logic according to the received result.
if(result[0]!='0'){
// If process hasn´t finished yet it is recalled for next iteration
var_mystart = result[0];
settimeout("callWS();",90);
}
});
}
</script>

 

 

 So now,

 

1: I would like to know what does that error message means? It seems to be a Server side problem.

2. Is there any possible way to catch that error? I already tried to add the "try catch" sentence to the scontrol and to the apex webservice but in none place it is catched.

 

I'd like to catch that kind of error message so I could implement a RETRY method.

 

Thanks to all of you who could help me.

 

Regards,

 

Wilmer

Hi,

 

We have a scontrol that calls an apex webservice by the API an it was working fine until some days ago that it started to retrieve the following error message (not all the time):

 

 

ERROR: ........... {faultcode:'soapenv:Server', faultstring:'Unable to deserialize inputstream', }

 

This is the summary of the scontrol code:

 

 

<script src="/soap/ajax/13.0/connection.js"></script>
<script src="/soap/ajax/13.0/apex.js"></script>
<Script language="JavaScript">
// here goes another code
function callWS(){
var process = sforce.apex.execute('MyApexWebservice', 'Method1',{param1:1, starting: var_mystart, param2: var_for_param2, param3: var_for_param3 },
function(result){
// here is another logic according to the received result.
if(result[0]!='0'){
// If process hasn´t finished yet it is recalled for next iteration
var_mystart = result[0];
settimeout("callWS();",90);
}
});
}
</script>

 

 

 So now,

 

1: I would like to know what does that error message means? It seems to be a Server side problem.

2. Is there any possible way to catch that error? I already tried to add the "try catch" sentence to the scontrol and to the apex webservice but in none place it is catched.

 

I'd like to catch that kind of error message so I could implement a RETRY method.

 

Thanks to all of you who could help me.

 

Regards,

 

Wilmer

 

 

Message Edited by Wilmer on 05-16-2009 09:02 AM

Hi,

 

I got a scontrol which calls out an external webservice using Ajax. It has been working very well for a long time  but since yesterday it returns the error message: Unable to deserialize inputstream

 

Does anybody know what could be the reason? I think it could be a problem in the external webservice or the communication but I'm not sure.

 

Thanks for your answers,

 

 Wilmer

  • April 15, 2009
  • Like
  • 0

Hi, I´d like to know if it is possible to send or receive .Net object to and from Apex webservices? For example, it is possible to send or received Recordsets ?

 

Thanks,

 

Wilmer

Message Edited by Wilmer on 04-06-2009 11:52 PM
  • April 07, 2009
  • Like
  • 0

Hi, I´d like to know if it is possible to send or receive .Net object to and from Apex webservices? For example, it is possible to send or received Recordsets?

 

Thanks,

 

Wilmer

Message Edited by Wilmer on 04-06-2009 11:53 PM
  • April 07, 2009
  • Like
  • 0
Hi, I would like to get some information or sample code about how to read an external file (ie. pdf file) which is located at AWS S3. I´ve already know there is a toolkit to do that, but I also found out that Amazon has deprecated SOAP for their services and it would be sooner or later when they decide not to support anymore new SOAP request (now for example they do it only in https calls and said they won't updgrade SOAP methods, according to their documentation).

Any help on this with some sample code would be appreciated.
HI All,

Im trying to create bulk upload scripts using CLIq however when trying to log in to the sandbox using the CLIq interface I recieve the following error,

UNSUPPORTED_CLIENT - TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https.

How can I change the settings in CLIq to support TLS 1.1?

Thanks,

Jay
Hi, I'm working in a customized trasfering process and I tried to make it by Dynamic DML operation. In spite of I have already enable the "Allow reparent checkbox attribute at the master-detail field, I got an error llike: "Invalid field  for ChildObject__c" (seems like no field name were given).

Here is my sample code:
public class myTransferClass_cls{

public void fnTransfer(){
id TargetAccId = 'myTargetAccountId'; // this is an Id

// Get the records to be transferred
Account SourceAcc : [SELECT Id, Name, 
	// Related Plans: Planes asociados
	(SELECT Id, ParentId__c FROM ChildRecords__r)
	FROM Account
	WHERE Id = 'mySourceAccId' LIMIT 1];

myTransferClass_cls  ctr = new myTransferClass_cls();
ctr.transferChildRecords(SourceAcc.ChildRecords__r, TargetAccId, 'ChildObject__c', 'ParentId__c');
}

// Here is the generic Method to transfer child records
private integer transferChildRecords(list<sObject> RecordsToTransfer_lst, id TargetPatientId, string strObjectName, string strParentFieldName){
		integer intTransferredRecords = 0;
		
		if(!RecordsToTransfer_lst.isEmpty()){

			for(sObject record : RecordsToTransfer_lst){
				record.put(strParentFieldName, TargetPatientId);
			}
			system.debug('*** NEW RecordsToTransfer VALUES: '+RecordsToTransfer_lst);
			update RecordsToTransfer_lst;
			intTransferredRecords = RecordsToTransfer_lst.size();
		}
		
		return intTransferredRecords;
	}
}
Any ideas? or it's not possible to do it with Dynamic DML by now?

Thanks for your help.

Regards,

Wilmer






 
  • September 15, 2015
  • Like
  • 0
We currently have a visualforce tab which is the default tab selected upon logging into Salesforce.  With the Winter '16 update in our sandboxes, now I automatically see a redirect notice "you will be redirected to....<URL of tab>".  I have to click "OK" before it'll open.  Can anyone help point me in the right direction of how I might fix this so we can bypass this fun new redirect notice?

User-added image

Hi,

 

I would like to know how can I show a custom label value into a message displayed by an onclick event in a Command Link button.

 

In example

<apex:commandLink value="{!$Label.MyLabel1}" onclick="return confirm('Are you sure?')" action="{!removeItem}">
   <apex:param name="removeItemId" value="{!item.objId}" assignTo="{!selectedItemId}" />
</apex:commandLink>

 

I would like to replace the hard coded 'Are you sure?' message by a custom Label value, but everytime I try, the related button doesn't  work properly. Any kind of suggestion?

 

Regards,

 

Wilmer

 

 

  • February 22, 2013
  • Like
  • 0

I am having bulk data in a text file, out of which i required to read some content and put those contents in list.

can any provide solution

  • January 09, 2013
  • Like
  • 0

Hello,

 

I'm trying to format a date's month in the user's language but keep getting it in English.

Here's the code I have:

 

Datetime d = System.now();
Datetime thisDate = DateTime.newInstance(d.year(), d.month(), d.day());
String format = thisDate.format('MMMM');
System.debug(format);

 Any ideas?

Many thanks, Dan

Can I use Apex data loader with Windows 2008 Server? I don't find any documentation which says that Apex data loader is compatible with 2008 server. Has anyone use this? and what are the opinions on using data loader on 64 bit machine, does this work fine without any issues?

Hi everyone,

 

I would like to show the values of each bar on the bar chart I created at the top of the bar chart like a report. However I am having trouble figuring out how to do that. I would appreciate the help. 

 

Thank,

I have created an apex:chart and added a chartLabel to the barSeries; however, the labels are not centered over the bars.  Does anyone know how to fix this?  I can't seem to add a styleClass or use any sort of css.  Thanks!  

 

chart

 

<apex:pageBlockSection title="Future Tasks">
    <apex:chart height="250" width="800" data="{!
<apex:axis type="Category" position="bottom" fields="ActivityDate" title="Day of Month"> <apex:chartLabel orientation="vertical"/> </apex:axis> <apex:axis type="Numeric" position="left" fields="Total" title="Open Tasks"/> <apex:barSeries axis="bottom" orientation="vertical" xField="ActivityDate" yField="Total"> <apex:chartLabel display="outside" /> </apex:barSeries> </apex:chart> </apex:pageblocksection>

 

In a visualforce barchart, we need to be able to put a label on top of each bar which reads the peakvalue of that particular bar

  • October 03, 2012
  • Like
  • 0

 

This is just some example code, I don't want the focus of what I'm doing to cloud the concept I'm trying to figure out.

 

code:

 

sobject[] something = [SELECT Contact.FirstName, Contact.Account.Name, contact.account.type from Contact];

 

I've used sobject[] here instead of contact[] because in my project the query is dynamic and could be from a different table.

 

My question is, how do I get the relationship field from this? Normally, I know you can do this:

 

string theName = something[0].Account.Name;

 

However, this results in the error: Field expression not allowed for generic SObject

 

How do I get around this?

  • April 29, 2012
  • Like
  • 1

Good afternoon. I am working on implementing an SSO solution with SF acting as the IdP. In doing so, I have generated a self-signed certificate (Setup->Security Controls->Certificate and Key Management) and downloaded the resultant cer file for import into an existing keystore. However, I am receiving an error when I import the cert into my keystore:

 

 keytool error: java.lang.Exception: Public keys in reply and keystore don't match
java.lang.Exception: Public keys in reply and keystore don't match
        at sun.security.tools.KeyTool.establishCertChain(KeyTool.java:2618)
        at sun.security.tools.KeyTool.installReply(KeyTool.java:1870)
        at sun.security.tools.KeyTool.doCommands(KeyTool.java:807)
        at sun.security.tools.KeyTool.run(KeyTool.java:172)
        at sun.security.tools.KeyTool.main(KeyTool.java:166)

 

I am thinking the alias used on Salesforce.com to generate the cert does not match the alias I am specifying in the keystore. I thought this was the unique name assigned when the self-signed certificate was created on SF, but it does not appear to be the case. Is there any way of telling the alias SF uses when the certificate is generated?

Hi all,

 

I'm reading page 206 on the Apex reference doc and it states that one Apex transaction can make 10 callouts to an HTTP request. If I need to make more than 10 callouts, what are all my options other than using the @future notation? I'm calling a geocoding webservice, and the app will be making closer to 200 callouts/day.

 

Any suggestions will be appreciated.

 

Thanks in advance.

I'm working with a standard object that's used by a managed package. The managed package includes some software that runs on the package author's own server and that calls into Salesforce using the web services API, to create records for that standard object. Other Salesforce apps also create records for that standard object. I need to write a trigger that can detect if a record is being added by the managed package's code (i.e., as a result of an API call) or by some other means.

 

I have no control over the way the external server calls into Salesforce to create records for this object. I can't modify that software.

 

I have no control over the UI. Because it's a standard object, many apps can create records for it. I can't change all of those apps to make them set some kind of flag that says "I'm not creating this record through the API."

 

Given those limitations, is there any way a trigger can determine whether it's being called as a result of an API call?

 

I've tried various UserInfo methods, without much luck. I thought if I called UserInfo.getUiThemeDisplayed() from a trigger invoked as a result of an API call, it might tell me that there's no UI Theme being displayed, but it doesn't.  

UserInfo.getUserId() doesn't help me because the external server logs into Salesforce using the same login credentials that a browser user would.

  

Is there anything in UserInfo.getSessionId() that might be useful? 

 

Thanks for your help!

  • June 10, 2010
  • Like
  • 1

Hi,

 

I am using the Force.com Amazon Webservices Toolkit. I have 2 issues here  -

 

1. When I use the WSDL2APEX "GetObject" method, I get an error - Unable to parse the callout response. I had run into a similar issue in March 09 with the CopyObject method and was asked a HTTP request/respose wrapper to make the calls.

 

2. GetObject works with the HttpRequest/Response calls. Now, I get the error  "Exceeded max size limit of 100000". The file on Amazon S3 is about 120 KB. As per documentation, the max limit for a SOAP callout is 1 MB. So, the file is definitely within the limits. Why am I getting this error ?

 

 

  • September 28, 2009
  • Like
  • 0

I want to put up a confirmation dialog before calling an action in a custom controller.  The first command button shown below works.  For the second one, I tried to create the script as shown below but the page doesn't compile. I get the error "Save error: Unknown property 'MyCustomerController.save'.  But that's the same method that the regular button calls and that button compiles???

 

<apex:commandButton value="Save to Mass Sample " action="{!save}" />    
<apex:commandButton value="Javascript Save to Mass Sample " onclick="javascript:confirmSave();" />  

 

<script>
    function confirmSave(){
      var answer = confirm("Are you sure you want to create samples?")
      if (answer){
        window.top.location = "{!URLFOR(save)}";
        <!-- window.top.location = "{!save}";   Tried it this way too. sample problem -->
      }
      else {
        alert("No samples have been created.")
      }
    }
</script>
 
 

my apex class method is trying to call an external webservice function, and it gives this
 
Failed to invoke future method 'public static void mycall()'

Debug Log:
System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':html'
 
any idea of how to fix this? what should I do to make it work?
  • January 14, 2009
  • Like
  • 0
Hi I am trying to integrate salesforce.com with Oracle Apps using BPEL. I have published my BPEL as a webservice in our test server and had created an apex class which calls this webservice. Later I am invoking this using an S-control button in Accounts tab.

But I am getting the following error when I invoke the button.

**
{faultcode:’soapenv”Client’, faultstring:’System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element ‘http://schemas.xmlsoap.org/soap/envelope/:Envelope’ but found ‘:html’

Class.wwwTrianzCom.Create_AccountPort.process: line 15, column 13
Class.AccountWrapper.CreateFunction: line 5, column 10
**

Please help me to figure out the problem.

Thank you, Aneesh
Hi, I'm trying to develop a trigger that checks a document number format (validation digit), so I need to use the Math.mod method in ApexCode but I found it seems to reject the Double variable as Argument. Here is the related code:
 
Code:
trigger AccountDigitoVerificacion_tgr on Account (before insert, before update) {
    if (Trigger.new.size() > 1 ) { // bulk process only
    }else{    
        Integer DIV = 0;
        Double DocNumber = 0;
        Boolean Calculate = false;
                
        for (Account MyAccount : System.Trigger.new) {
            if(MyAccount.RecordTypeId=='012T0000000CiygIAC' || MyAccount.RecordTypeId=='012T0000000CissIAC'){
                DocNumber = MyAccount.Document_Number__c;
                if(System.Trigger.isInsert){
                    Calculate = true;
                }else{
                    if(System.Trigger.isUpdate){
                        for (Account MyAccountOld : System.Trigger.old) {
                            if(MyAccount.Document_Number__c!=MyAccountOld.Document_Number__c){
                                Calculate=true;
                            }
                        }
                    }
                }
                if(Calculate==true){ // Calculates the validation digit
                    Integer M=0;
                    Integer S=1;
                    for(;DocNumber!=0;DocNumber=Math.floor(DocNumber/10)){
                        // Here is where the code validator shows an Error : S+Math.mod(DocNumber, 10)
                        S=Math.mod((S+Math.mod(DocNumber, 10)*(9-Math.mod(M++,6))), 11);
                    }
                    MyAccount.Validation_Digit__c = S?S-1:'k'; 
                }
            }
        } 
    }
}

 I tried inserting a value in the first argument directly and it works, but, when I replace it by a variable, it shows the following error (NO MATTER the value source):
"Method does not exist or incorrect signature: Math.mod(Double, Integer)".
 
Any suggestion to correct it or replace that function??
 
Thanks,
 
WILMER
 
 
  • October 18, 2007
  • Like
  • 0