• _Prasu_
  • SMARTIE
  • 1243 Points
  • Member since 2009


  • Chatter
    Feed
  • 45
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 4
    Questions
  • 456
    Replies
Dear all,

I´ve installed in the customer´s Sandbox NPSP and Marketing Cloud connect and when I´m performing the APEX Test during the validation of the change sets to Production, the system is giving 1012 fails of 1842, how is that even possible with a Salesforce managed software?
I´m Junior in this matter and not a developer, I don´t know how many errors in the APEX test the customer had before and couldn´t check in their production either. But we need help in this matter because this is Salesforce managed code and we couldn´t access it to even see what is giving the error or change the test conditions. 

I have removed my APEX code since I used it only for a minor thing, but... even with the code disabled (trigger and class), the errors from the managed packages are there and I want to give our customer the best possible assistance.

I know that A LOT of the errors are from Validation rules and required fields (more than half of them), but ... how do I solve them if I´m not able to modify the test? 

And what about the other kind of errors, where do they come? Did you have similar problems? 

The list of errors is huge, so I will leave here just a glimpse of some:
 
Test_abTestDetailControl constructorTest System.QueryException: List has no rows for assignment to SObject Stack Trace: Class.et4ae5.TestUtility.createUser: line 303, column 1 Class.et4ae5.Test_abTestDetailControl.constructorTest: line 49, column 1 

Test_abTestDetailControl testCancel System.QueryException: List has no rows for assignment to SObject Stack Trace: Class.et4ae5.TestUtility.createUser: line 303, column 1 Class.et4ae5.Test_abTestDetailControl.getabTestDetailControl: line 10, column 1 

Class.et4ae5.Test_abTestDetailControl.testCancel: line 78, column 1 Test_businessUnitListControl test_save System.QueryException: List has no rows for assignment to SObject Stack Trace: Class.et4ae5.Test_businessUnitListControl.setupData: line 14, column 1 

Class.et4ae5.Test_businessUnitListControl.test_save: line 545, column 1 Test_businessUnitListControl test_selectAll System.QueryException: List has no rows for assignment to SObject Stack Trace: Class.et4ae5.Test_businessUnitListControl.setupData: line 14, column 1 

Class.et4ae5.Test_businessUnitListControl.test_selectAll: line 459, column 1 ACCT_IndividualAccounts_TEST attachToIndividualAccount System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, El teléfono, el correo electrónico o el móvil deben estar cumplimentados.: [] Stack Trace: Class.npsp.ACCT_IndividualAccounts_TEST.attachToProcessor: line 521, column 1 Class.npsp.ACCT_IndividualAccounts_TEST.attachToIndividualAccount: line 500, column 1 ACCT_IndividualAccounts_TEST contactAddedToExistingHHAccount System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, El teléfono, el correo electrónico o el móvil deben estar cumplimentados.: [] Stack Trace: 

Class.npsp.ACCT_IndividualAccounts_TEST.contactAddedToExistingProcessor: line 675, column 1 

Class.npsp.ACCT_IndividualAccounts_TEST.contactAddedToExistingHHAccount: line 659, column 1 BDI_DataImport_TEST2 ManyDIMultiContactMatchRules5 System.AssertException: Assertion Failed: Expected: 3, Actual: 0 Stack Trace: 

Class.npsp.BDI_DataImport_TEST2.ManyDIMultiContactMatchRules: line 1167, column 1 Class.npsp.BDI_DataImport_TEST2.ManyDIMultiContactMatchRules5: line 1125, column 1 BDI_DataImport_TEST2 ManyDIMultiContactMatchRules6 System.AssertException: Assertion Failed: Expected: 3, Actual: 0 Stack Trace: 

Class.npsp.BDI_DataImport_TEST2.ManyDIMultiContactMatchRules: line 1167, column 1 Class.npsp.BDI_DataImport_TEST2.ManyDIMultiContactMatchRules6: line 1129, column 1 UTIL_UnitTestData_TEST testCreateNewUserWithDefaultRole System.QueryException: List has no rows for assignment to SObject Stack Trace: 

Class.npsp.UTIL_UnitTestData_TEST.createNewUserWithRoleForTests: line 355, column 1 Class.npsp.UTIL_UnitTestData_TEST.createNewUserForTests: line 409, column 1 Class.npsp.UTIL_UnitTestData_TEST.testCreateNewUserWithDefaultRole: line 468, column 1 UTIL_UnitTestData_TEST testCreateNewUserWithRandomRole System.QueryException: List has no rows for assignment to SObject Stack Trace: 

Class.npsp.UTIL_UnitTestData_TEST.createNewUserWithRoleForTests: line 355, column 1 Class.npsp.UTIL_UnitTestData_TEST.testCreateNewUserWithRandomRole: line 485, column 1

Thank you very much!

PS: I can´t open a Salesforce case since It doesn´t allow me from a Partner or standard user account. 
 

I have a reject button that I want to call a VF Page when certain criteria are met,  Everything works fine BUT when you click Save, a new change record ends up being created and thats the page you return to.  I just want the page to save the info you just enetered and return to the same record.

 

Here's the code right now in the button

window.location='/apex/rejectChangeChgMgr';

 

VF Page

<apex:page standardController="Change__c" extensions="rejectChange">
<apex:form id="frm"> 
<apex:detail subject="{!Change__c.Id}" relatedList="false" title="false"/> 
<apex:outputPanel id="tstpopup" rendered="{!IF(isDisplayPopUp ==true,true,false)}" > 
<apex:outputPanel styleClass="popupBackground" layout="block" /> 
<apex:outputPanel styleClass="custPopup" layout="block"> 
<apex:pageMessages >
</apex:pageMessages> 
<apex:pageBlock >
<apex:pageBlockSection columns="1" > 
<apex:inputField label="Change Manager Rejected Comments" value="{!Change__c.Change_Manager_Approver_Rejected_Comment__c}" required="true" style="width: 500px"/>


<apex:outputPanel > 
<apex:CommandButton action="{!save}" value="Save!"/> 
<apex:CommandButton action="{!cancel}" value="cancel"/> 
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:outputPanel>





</apex:form> 



<style type="text/css"> .errorMsg{ width:159px; } 
.custPopup{ background-color: white; border-width: 3px; 
border-style: solid; 
z-index: 9999; 
left: 25%; 
padding:10px;
position: absolute; 
width: 1000px; 
//margin-left: -80px; top:100px; margin-left: -170px; 
//top:305px; 
border-radius: 5px; 
} 

.datePicker{z-index:10000}



.popupBackground{ background-color:black; opacity: 0.20; filter: alpha(opacity = 20); 
 position: absolute; width: 100%; height: 100%; top: 0; left: 0; 
 z-index: 997 } a.actionlink:hover{ text-decoration:underline; } 
 .customactionLink { color: #015BA7; font-weight: normal; text-decoration: none; } </style> 

 <script>
      function setFocusOnLoad() { }
</script>




</apex:page>

 Class

public class rejectChange 
{ 
public Boolean isDisplayPopUp {get; set;} 
public rejectChange(ApexPages.StandardController controller) 
{ 
isDisplayPopUp = true;

}}

 What am I doing wrong?

  • July 12, 2013
  • Like
  • 0

public class preventInvalidCMember_cls {
     @future     
     public static void  preventInvalidCMember(set<id> cmemberIds) {
         List<CampaignMember> cmember_list = new List<CampaignMember>();
         cmember_list = [SELECT id FROM Campaignmember WHERE id IN:cmemberIds];

         for(CampaignMember mycamp : cmember_list){

                 mycamp.adderror('My message');

         }

     }

}

I need a custom button in Salesforce that It redirect in other web

 

I need a custom button that redirects to another web and will automatically log. The external web only reveives by POST.

 

*** I'm trying to do the following. This returns the HTML of the web. But do not know how to paint.

 

public pagereference contactSend2() {
            HttpRequest req= new HttpRequest();
            HttpResponse res = new HttpResponse();
            Http http = new Http();
            req.setEndpoint('http://extranet.groupalia.com/user/login'); 
            req.setMethod('POST');
            req.setBody('username=***&password=***'); 
            res = http.send(req);
            return null;
   }

 

*** Also I'm trying this:

 

public static HTTPResponse contactSend() {
      HttpRequest req = new HttpRequest();
      req.setMethod('POST');
      req.setEndpoint('http://extranet.groupalia.com/user/login'); 
      req.setBody('username=***&password=***');
      req.setTimeout(60000);
      
      Http http = new Http();
      HTTPResponse res = http.send(req);
      return res;
    }

 

Please anyone have any idea? I'm going crazy.

 

Sergio.

  • February 06, 2013
  • Like
  • 1

Hi,

 

i have created a full sandbox from my production org. as we know record IDs are identical in both these orgs for records that are migrated from production org. so whenever i update a record in my production , the same updation is not happening in sandbox. i thought as the record ids are same both records(sandbox and production) are pointing to same data in the backend , but it is not.

 

so please let me know how salesforce maintains this and why the record IDs are same(is there any specifi reason for that)

 

 

thanks in advance

 

Regards,

Rakesh

Hi All,

 

 

whether or not emails sent from an Apex class are routed according to our email relay settings or do they bypass the relay settings and go to the recipient directly from Salesforce?

 

Any help is appriciated..

 

Thanks & Regards,

Bharath

 

 

  • November 19, 2012
  • Like
  • 0

I have a custom object called " Deal Desk Form"that is a detail to the Opportunity object. We've just started noticing that when we go to create a new Deal Desk Form, it runs all of the validation rules on the Opportunity before saving. This is not behavior that occurs in any of our sandboxes, except for one which we refreshed and activated today. Is this new behavior that Salesforce deployed recently? Is it expected? We can't figure out why it's happening.

Thanks for any insight!!

Hi all,

 

We use the following code behind a custom button that's displayed on our opp detail page to automatically create a case.  We're using Professional Edition, so we don't have Apex available to us for this to happen automatically when the opp stage is changed to closed won.

 

You can see below that we're using an IF statement to only create the case if the opp stage is closed won, and to alert the user if otherwise.

 

{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}
var status = "{!Opportunity.StageName}";
var newRecords = [];

if (status == "Closed Won")
{
   var c = new sforce.SObject("Case");
   c.AccountId = "{!Opportunity.AccountId}";
   c.Type = "{!Opportunity.Type}";
   c.Subject = "{!Opportunity.Name}";
   c.Origin = "Converted Opportunity";
   c.Description = "{!Opportunity.Requirement__c}";
   c.ContactId = "{!Opportunity.Opportunity_ContactId__c}";

   newRecords.push(c);

   result = sforce.connection.create(newRecords);
   alert ('Case has been created.');
}
else
{
alert ('Opportunity must be won before a case can be created.');
}

 

I need to complicate this further with another IF statement, but not sure how to do so ... here's what we need:

 

We still need the case only to be created if the opp stage = closed won, and to alert the user if otherwise.

 

We have 6 opp types (we'll call them types 1 to 6), and in addition to the above IF statement, we also need the button to create the case if opp type = 1, 2, 3 or 4, but to alert 'A case cannot be created for opportunity types 5 or 6.' (and not create the case) if the opp type = 5 or 6.

 

Can anyone help me with a tweak to my button code to achieve this?

 

Thanks in advance.

 

Steve

I am trying to create a Save Method on a Visual Force Page that uses a custom controller.  I am able to create the input text field on the Visualforce page that accepts the value of the Date field I am trying to populate.  However, when I try to save the page (committ the value to the salesforce.com database), I receive the following error:

 

"Visualforce Error

 

System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []

 

Class.ProductsController.save: line 47, column 1"

    

 

Can someone please help me with this.

 

Here is the ProductsController class:


public class ProductsController {

 public List <Opportunity>getProducts(){



List<Opportunity>opp;


opp = [Select Name, Product_Family__c, StageName, Probability, AUM_Total__c, Product_Client_Demand_Summary__c, Competing_Product_pl__c, Idea_Origination__c, Inception_Date__c, Product_Client_Demand__c, Advisor_Team__c, IOI__c, Target_Launch_Date__c
From Opportunity
Where Product_Family__c != null
Order by Product_Family__c desc, Probability desc
];


return opp;



}

public Date targetlaunch {get; set;}

public void save(){

Opportunity o = new Opportunity(

Target_Launch_Date__c = targetlaunch

);

update o;
}




@istest
static void ProductTest()
{

ProductsController opp = new ProductsController();

opp.getProducts();
}


}

 

 

 

 

Here is the VisualForce Page:

 

 

<apex:page controller="ProductsController" sidebar="true" showheader="true">

<h1>Products Page</h1>

<apex:form >


<apex:pageBlock title="Products Onboarding">

<apex:pageBlockButtons location="top">

<apex:commandButton action="{!save}" value="Save"/>


</apex:pageBlockButtons>

<apex:pageBlockSection title="Sorted by Product Family & Opportunity Stage" >


</apex:pageBlockSection>


<!-- Printout Today's Date -->
<apex:outputText value="Displayed as of -">

</apex:outputText>
{! MONTH(Today())}

<apex:outputText value=" /">

</apex:outputText>
{! DAY(Today())}

<apex:outputText value=" /">

</apex:outputText>
{! YEAR(Today())}


</apex:pageBlock>

<apex:dataTable value="{!products}" var="prod"
cellspacing="0"
cellpadding="3"
columnswidth="100px"
border="3"
style="color:#151B8D; align:right"
styleClass="TableClass"
align="center" >


<apex:column style="font-weight:bold">

<apex:facet name="caption">Product Name</apex:facet>

<apex:facet name="header">Product Name</apex:facet>

<apex:outputField value="{!prod.Name}"/>

</apex:column>

<apex:column >

<apex:facet name="caption">Stage</apex:facet>

<apex:facet name="header">Stage</apex:facet>

<apex:outputField value="{!prod.StageName}"/>

</apex:column>
<apex:column >

<apex:facet name="caption">Probablity</apex:facet>

<apex:facet name="header">Probability</apex:facet>

<apex:outputField value="{!prod.Probability}"/>

</apex:column>

<apex:column >

<apex:facet name="caption">Target Launch Date</apex:facet>

<apex:facet name="header">Target Launch Date</apex:facet>

<apex:inputField value="{!prod.Target_Launch_Date__c}"/>


</apex:column>







<apex:column >

<apex:facet name="caption">Product Family</apex:facet>

<apex:facet name="header">Product Family</apex:facet>

<apex:outputField value="{!prod.Product_Family__c}"/>

</apex:column>







<apex:column >

<apex:facet name="caption">Idea Orgination</apex:facet>

<apex:facet name="header">Idea Origination</apex:facet>

<apex:outputField value="{!prod.Idea_Origination__c}"/>

</apex:column>


<apex:column >

<apex:facet name="caption">Product Client Demand</apex:facet>

<apex:facet name="header">Product Client Demand</apex:facet>

<apex:outputField value="{!prod.Product_Client_Demand_Summary__c}"/>

</apex:column>


<apex:column >

<apex:facet name="caption">Advisor Team</apex:facet>

<apex:facet name="header">Advisor Team</apex:facet>

<apex:outputField value="{!prod.Advisor_Team__c}"/>

</apex:column>


<apex:column >

<apex:facet name="caption">Indication of Interest</apex:facet>

<apex:facet name="header">Indication of Interest</apex:facet>

<apex:outputField value="{!prod.IOI__c}"/>

</apex:column>




</apex:dataTable>



</apex:form>



<apex:outputlink value="{! URLFOR($Action.Opportunity.New) }">Create New Product Opportunity</apex:outputlink>






</apex:page>

 

 

Any help given on the Save Method for the Custom Controller would be appreciated.

I have a custom object. There are combination of fields like month_c,Project_c,contact_c and role_c which determine the record as unique.

I can write a trigger on before insert to check if there are any records with the same combination already existing. The question i wanted to ask was

how can i make the insertion stop. once i find there is already an record then it should just not insert the record. it doesnt need to throw / show an error.

Thanks

Prady



  • November 10, 2011
  • Like
  • 0

Hello,

 

We are trying to set up the development environment for our developers. The problem is that after the installation the Force.com IDE dows not start.

All we get is an error message from Forceide, I have attached the copied contets of the message. It would be much appreciated if someone could tell us what we need to change to get it running:

 

---------------------------
Forceide
---------------------------
JVM terminated. Exit code=-1
-Dfile.encoding=UTF-8
-Xms256m
-Xmx1024m
-XX:PermSize=128M
-XX:MaxPermSize=512M
-Djava.class.path=C:\Programme\salesforce.com\Force.com IDE\../Common/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
-os win32
-ws win32
-arch x86
-showsplash
-launcher C:\Programme\salesforce.com\Force.com IDE\forceide.exe
-name Forceide
--launcher.library C:\Programme\salesforce.com\Force.com IDE\../Common/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519\eclipse_1206.dll
-startup C:\Programme\salesforce.com\Force.com IDE\../Common/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
-install C:\Programme\salesforce.com\Force.com IDE
-configuration C:\Programme\salesforce.com\Force.com IDE\configuration
-vm C:\Programme\Java\jre6\bin\client\jvm.dll
-vmargs
-Dfile.encoding=UTF-8
-Xms256m
-Xmx1024m
-XX:PermSize=128M
-XX:MaxPermSize=512M
-Djava.class.path=C:\Programme\salesforce.com\Force.com IDE\../Common/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
---------------------------
OK  
---------------------------

 

Best regards,

Till Woerner

I am trying to call Salesforce API from my Java application in NetBeans. I imported Partner wsdl into NetBeans and create web service client using appropriate wizard. Login() and logout() operations finished successfully, but when I call describeGlobal() an error occurs (SEVERE: com.sforce.soap.partner.UnexpectedErrorFault: UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService). I find in Salesforce documentation that I need to set the session id in the SOAP header and specify the server URL as the target for subsequent service requests, but I do not know how to do it. Does anyone work also in NetBeans and have example/tutorial that shows solution of mentioned problem?

 

 

Yours sincerely,
Darko Androcec

I am fetching attachment object from java. So, I am getting the Attachement Body in base64 type. 

How can I get complete body of attachment in Java. 

 

Please suggest.

Hi,

 

I'm trying to export all of the leads from my database that were created on 02/10/2011.  I know for the purposes of the data loader it needs to be in the format 2011-02-10T00:00:00.000Z to be read by the data loader.  However when formatted that way, the data loader isn't erroring out, but I'm not getting any data returned.

 

Has anybody used the data loader to do this and could suggest where I may be going wrong here?

 

 

Thanks!

There is one system, which has exposed their API through DLL. I want to use that DLL in Salesforce.

For example, DLL have one class and has one function under it called login. I want to use this function in Salesforce Apex.

 

How can I achieve this? Is their any way I can convert DLL to WSDL and import into Salesforce, or any other way?



I have a contact form written in VF using Sites. However it seems when the lead is inserted, the owner assignment rules are not firing and the owner just remains the website.

 

I have a number of rules set up in Lead Assignment Rules and would like to use them. Is there something I am missing?

 

Here's the controller code:

global with sharing class ContactFormController {

    Lead lead;
    CampaignMember cmember;
    String submittedPageURL = 'http://asc-net.force.com/cms__Main?name=contact_confirm';
    
    global Lead getLead() {
        if(lead == null)
            lead = new Lead(firstname='First Name...',lastname='Last Name...');
        return lead;
    }
    
    global CampaignMember getCmember() {
        if(cmember == null)
            cmember = new CampaignMember(status='Responded');
        return cmember;     
    }

    global PageReference save() {
        //System.debug('Made it to save!');
        insert lead;
        //System.debug('Inserted Lead');
        
        if(cmember.CampaignId != null) {
            cmember.LeadId = lead.id;
            insert cmember; 
            //System.debug('Inserted Campaign Member');
        }
            
        PageReference submittedPage = new PageReference(submittedPageURL);
        submittedPage.setRedirect(true);
        //System.debug('Redirecting and we are outta here!');
        return submittedPage; 
        
    }
    
}

 

How do I remove the current date which appear at the last of the field where field uses a data type as date ?

At the last of the field means which shows the current date of the system...

Hi,

 

I'm trying to run a Java application that bulk deletes records from Salesforce. However, I get the following error:

 

[UnexpectedErrorFault [ApiFault  exceptionCode='EXCEEDED_ID_LIMIT' exceptionMessage='delete id limit reached: 200']]

 

Here is my code (simplified):

 

public static DeleteResult[] deleteFiles(PartnerConnection conn, String[] idsToDelete) throws Exception

{

try

{

return conn.delete(idsToDelete);

}

catch(ConnectionException e)

{

logger.debug("Exception occured: " + e.getLocalizedMessage(), e);

throw new Exception("Exception occured: " + e.getLocalizedMessage(), e);

}

}

 

where I pass 9000 IDs into the array. Which limit am I hitting and how can I change this limit?

 

Thanks!

How can I create PI CHART in visualforce ?

I want to show my all data in PI CHART format so please tell me that how can i achieve that ?

Regards....

Hi,

I received above error while importing data from csv file to my object. I don't have 'name' column in my source file, neither in destination.

What is the reason for above error?

Thnx in advance.

I am trying to run the Email2Case and it is giving me following error message. Same setup was running till last month. Does v 9.0 no more supported? or I am missing anything? It getting service URL as :

https://ap1-api.salesforce.com/services/Soap/u/9.0/00D90000000Zwhp 
2012-08-27 17:56:44,759 [main] INFO  Attempting to start service com.sforce.mail.EmailService with configuration file D:\Applications\Email2Case\\email2case.txt

2012-08-27 17:56:48,121 [main] INFO  LoginURL: https://www.salesforce.com/servic
es/Soap/u/9.0
2012-08-27 17:56:48,122 [main] INFO  Agent will connect to: https://ap1-api.salesforce.com/services/Soap/u/9.0/00D90000000Zwhp
2012-08-27 17:56:52,388 [main] ERROR Failed to bind to SFDC service on initialization.
HTTP transport error: javax.net.ssl.SSLHandshakeException: sun.security.validato
r.ValidatorException: PKIX path building failed: sun.security.provider.certpath.
SunCertPathBuilderException: unable to find valid certification path to requested target


 Any help will be really helpful.

I am trying to create a CaseTeamMember from  apex with Customer Portal user and getting following error.

 

DML operation INSERT not allowed on CaseTeamMember

Error:

 

Does Customer Portal license has any limitation?

One can not split string on '.' character?

 

 

Following code does not work.

String strTest = 'test.test';
String[] arrTest = strTest.split('.');

 

 

 

Is it possible to access the SFURL in apex code?

 

What i want to do is to get the URL for creating the link in the email template which body is set through the trigger code?

 

If the subscriber org has a profile with some permissions on a custom object (custom object from managed package). If we upgrade package, does the permissions get overwritten? And is it same behaviour with package uninstall and re-install?
I'm making a REST callout to a client webservice which is a https URL. I know that salesforce cannot make a call to an endpoint which has self-signed certificate. The certificate which client has on the endpoint is signed by thier company named CA, say "CompanyX CA". Is there any list of CA that is supported by Salesforce? or if the endpoint certificate signed by any CA would work for callout?
Hi,
I wrote trigger as following:

trigger UpdateSADeclined on Task (before insert,before update) {
for(Task x: Trigger.new)
{
If (x.Declined_by__c==null|| x.Date_Time_Declined__c==null|| x.Declined_Reason__c==null)
{
x.SA_Declined__c=true;
}
else
{ x.SA_Declined__c=false;
}
}
}
By this trigger checkbox field SADeclined is checked whenever any of date field value ( declined by, date time declined and declined reason) is null, otherwise it’s unchecked ( means whenever all three fields are populated).

Now, My requirement is whenever there is value in date field SADeclined should be unchecked, i.e. when all three date fields are null the SADeclined will be checked.
Kindly help me to change the trigger.
HI All, 

I am trying to write simple batch class in which i have send multiple emails from the finish method of batch class , Please see the below code that i am trying to use: 
 
global class NotifyBatch2 implements Database.Batchable<sObject>, Database.Stateful {

datetime dt = System.now()-1;
public string query = 'select Id, name,Status__c,CreatedDate,Materials_Meeting_Date__c,Materials_Due_Date__c,CreatedBy.Email,Submitter__c,Book_Coverage__c,Notes__c,Materials_Request_Organization__c from MR_Product__c where Status__c=\'Pending Submission\'';

//Here i am getting the problem.
public List<Messaging.SingleEmailMessage>  mails = new List<Messaging.SingleEmailMessage>();

global database.querylocator start(Database.BatchableContext BC)
{

    return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext BC, Sobject[] scope)
{ 


  //
    EmailTemplate emailTemplate = [select Id, Body  from EmailTemplate where DeveloperName = 'BOOK_REQUEST_Template'];

    for (MR_Product__c  item : (List<MR_Product__c>)scope) {
        
    
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
             string MatDueDate = string.valueOfGmt(item.Materials_Due_Date__c);
             string MatMeetingDate = string.valueOfGmt(item.Materials_Meeting_Date__c);      
                    
                    string body = emailTemplate.body;
                    
                    body  = body.replace('{!MR_Product__c.Submitter__c}', item.Submitter__c);
                    body  = body.replace('{!MR_Product__c.Materials_Request_Organization__c}', item.Materials_Request_Organization__c);
                    body  = body.replace('{!MR_Product__c.Materials_Due_Date__c}', MatDueDate );
                    body  = body.replace('{!MR_Product__c.Materials_Meeting_Date__c}', MatMeetingDate);
                    
                    if(item.Notes__c!=null && item.Notes__c!=''){
                    body  = body.replace('{!MR_Product__c.Notes__c}', item.Notes__c);
                    }
                     if(item.Book_Coverage__c!=null && item.Book_Coverage__c!=''){
                    body  = body.replace('{!MR_Product__c.Book_Coverage__c}', item.Book_Coverage__c);
                    
                    }

                    email.setToAddresses(new String[] {item.createdby.Email});
                    email.setSaveAsActivity(false);
                    email.setPlainTextBody(body);
                    
                    email.setTemplateId(emailTemplate.Id);
                    system.debug('Checkemails' + email);
					//Here i am getting problem
                    mails.add(email);
            
           Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
       
    }
    
          
}

global void finish(Database.BatchableContext BC) {

    // for sending final emails:
    Messaging.sendEmail(mails);



}


}
Error i am getting : 

First error: Not Serializable: com/salesforce/api/fast/List$$lcom/salesforce/api/Messaging/SingleEmailMessage$$r

I have already tried making it as transient with no sucess, 

All i want is to send Emails for all records "created by user " in finish method i single go, plaese help , thanks


 
We have written some processes using process builder and since there is a limit of 1000 flow interviews that can be invoked per an hour, I would like to know the current number in my org for performance scaling. Please tell me how to use tooling API to fetch the no.of process flows executed in my org per hour. I am totally new to tooling API, so looking forward to some guidance.
Dear all,

I´ve installed in the customer´s Sandbox NPSP and Marketing Cloud connect and when I´m performing the APEX Test during the validation of the change sets to Production, the system is giving 1012 fails of 1842, how is that even possible with a Salesforce managed software?
I´m Junior in this matter and not a developer, I don´t know how many errors in the APEX test the customer had before and couldn´t check in their production either. But we need help in this matter because this is Salesforce managed code and we couldn´t access it to even see what is giving the error or change the test conditions. 

I have removed my APEX code since I used it only for a minor thing, but... even with the code disabled (trigger and class), the errors from the managed packages are there and I want to give our customer the best possible assistance.

I know that A LOT of the errors are from Validation rules and required fields (more than half of them), but ... how do I solve them if I´m not able to modify the test? 

And what about the other kind of errors, where do they come? Did you have similar problems? 

The list of errors is huge, so I will leave here just a glimpse of some:
 
Test_abTestDetailControl constructorTest System.QueryException: List has no rows for assignment to SObject Stack Trace: Class.et4ae5.TestUtility.createUser: line 303, column 1 Class.et4ae5.Test_abTestDetailControl.constructorTest: line 49, column 1 

Test_abTestDetailControl testCancel System.QueryException: List has no rows for assignment to SObject Stack Trace: Class.et4ae5.TestUtility.createUser: line 303, column 1 Class.et4ae5.Test_abTestDetailControl.getabTestDetailControl: line 10, column 1 

Class.et4ae5.Test_abTestDetailControl.testCancel: line 78, column 1 Test_businessUnitListControl test_save System.QueryException: List has no rows for assignment to SObject Stack Trace: Class.et4ae5.Test_businessUnitListControl.setupData: line 14, column 1 

Class.et4ae5.Test_businessUnitListControl.test_save: line 545, column 1 Test_businessUnitListControl test_selectAll System.QueryException: List has no rows for assignment to SObject Stack Trace: Class.et4ae5.Test_businessUnitListControl.setupData: line 14, column 1 

Class.et4ae5.Test_businessUnitListControl.test_selectAll: line 459, column 1 ACCT_IndividualAccounts_TEST attachToIndividualAccount System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, El teléfono, el correo electrónico o el móvil deben estar cumplimentados.: [] Stack Trace: Class.npsp.ACCT_IndividualAccounts_TEST.attachToProcessor: line 521, column 1 Class.npsp.ACCT_IndividualAccounts_TEST.attachToIndividualAccount: line 500, column 1 ACCT_IndividualAccounts_TEST contactAddedToExistingHHAccount System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, El teléfono, el correo electrónico o el móvil deben estar cumplimentados.: [] Stack Trace: 

Class.npsp.ACCT_IndividualAccounts_TEST.contactAddedToExistingProcessor: line 675, column 1 

Class.npsp.ACCT_IndividualAccounts_TEST.contactAddedToExistingHHAccount: line 659, column 1 BDI_DataImport_TEST2 ManyDIMultiContactMatchRules5 System.AssertException: Assertion Failed: Expected: 3, Actual: 0 Stack Trace: 

Class.npsp.BDI_DataImport_TEST2.ManyDIMultiContactMatchRules: line 1167, column 1 Class.npsp.BDI_DataImport_TEST2.ManyDIMultiContactMatchRules5: line 1125, column 1 BDI_DataImport_TEST2 ManyDIMultiContactMatchRules6 System.AssertException: Assertion Failed: Expected: 3, Actual: 0 Stack Trace: 

Class.npsp.BDI_DataImport_TEST2.ManyDIMultiContactMatchRules: line 1167, column 1 Class.npsp.BDI_DataImport_TEST2.ManyDIMultiContactMatchRules6: line 1129, column 1 UTIL_UnitTestData_TEST testCreateNewUserWithDefaultRole System.QueryException: List has no rows for assignment to SObject Stack Trace: 

Class.npsp.UTIL_UnitTestData_TEST.createNewUserWithRoleForTests: line 355, column 1 Class.npsp.UTIL_UnitTestData_TEST.createNewUserForTests: line 409, column 1 Class.npsp.UTIL_UnitTestData_TEST.testCreateNewUserWithDefaultRole: line 468, column 1 UTIL_UnitTestData_TEST testCreateNewUserWithRandomRole System.QueryException: List has no rows for assignment to SObject Stack Trace: 

Class.npsp.UTIL_UnitTestData_TEST.createNewUserWithRoleForTests: line 355, column 1 Class.npsp.UTIL_UnitTestData_TEST.testCreateNewUserWithRandomRole: line 485, column 1

Thank you very much!

PS: I can´t open a Salesforce case since It doesn´t allow me from a Partner or standard user account. 
 
Hi all,

I have a VF page where i have displayed sObject labels dynamically on this VF page. These field labels are associated with checkboxes.
I want that whichever checkboxes are selected , there labels should get stored in a text area field at the backend.
I will paste my code below. Please help me for the same.
APEX CLASS::::

public class getLabel{

public List<WrapperClass> listWrapper {get;set;}
public Map<String,String> labelMap;
public String resultString {get;set;}  

public getLabel(ApexPages.StandardController controller) {
    listWrapper = new List<WrapperClass>();
    labelMap = new Map<String,String>();
    labelMap = retLabelMap('ProposalFields__c');
    for(String s : labelMap.values()){
        listWrapper.add(new WrapperClass(s,false));
    }
}

public class WrapperClass {  
    public Boolean checkBool {get;set;}
    public String fieldNme{get;set;}  
    public WrapperClass(String prop,Boolean checkBool ){  
        this.fieldNme = prop;  
        this.checkBool = checkBool ;  
    }  
}

public Static Map<String,String> retLabelMap(String type){
    Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe();
    Schema.SObjectType s= m.get(type);
    Map<String, Schema.SObjectField> fieldMap = s.getDescribe().fields.getMap();
    Map<String,String> aMap = new Map<String,String>();
    for (String fieldName: fieldMap.keySet()) {
        aMap.put(fieldName,fieldMap.get(fieldName).getDescribe().getLabel());
    }

    return aMap;
}

public void saveCheckboxValue(){
     Proposal_Form__c p = new Proposal_Form__c();
     p.Fields_Associated__c = resultString;
     insert p;
 }
 
public PageReference getSelected(){
   return null;
}



}



VF PAGE:


<apex:page showHeader="false" sidebar="false" standardController="Proposal_Form__c" extensions="getLabel">
<apex:form >
<style>
.panelWrapper .mainTitle {
   text-align :center;
    
}
</style>
<apex:outputPanel styleClass="panelWrapper" layout="block">
<apex:pageBlock title="Proposal Form">
<apex:pageBlockSection title="Service Requirements">
<apex:inputField value="{!Proposal_Form__c.Service_Family__c}"/>
<apex:inputfield value="{!Proposal_Form__c.Service_Type__c}"/>
<apex:inputField value="{!Proposal_Form__c.Sub_Service_Category__c}"/>
</apex:pageBlockSection>

<apex:pageBlockButtons location="Bottom">
<apex:commandButton value="Save" action="{!Save}"/>
</apex:pageBlockButtons>

<apex:pageBlockSection title="Available fields">
<apex:repeat var="lab" value="{!listWrapper}">
    <apex:pageblockSectionItem >
        <apex:outputlabel value="{!lab.fieldNme}"/>
        <apex:inputCheckbox value="{!lab.checkBool}"/>
    </apex:pageblockSectionItem> 
</apex:repeat>

</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>

</apex:form> 
</apex:page>
Thanks,
Amita Tatar
 
I am new to this.
I am trying to use upsert() method to load/edit contacts.
I have the contact created (contact object is presented by WSDL namespace) adn loaded with values.
Dim newContact As New SFServiceWSDL.Contact
, but when I put it into the method as parameter it complains that
Value of type 'SFSOAPForm.SFServiceWSDL.Contact' cannot be converted to '1-dimensional array of SFSOAPForm.SFServiceWSDL.sObject'
it wants an sObject, which contacts should be.
I am stuck on it for 3 days now. All the info out there does not seem to correspond with what I am seeing on my screen
My WSDL version is 39 (I think).

 
Ok, so I hope someone has more knowledge in SSO than me (which is quite easy).

Problem:
I have a web app within which I want to provide a button to access the Support Community, no additional login/clicks required, as an authenticated user.

So, in essence, I'd like to create an IdP-initiated SSO flow for Salesforce communities.

[Attempted] Solution:
  • Activate community and enable "Allow external users to self-register"
  • Create endpoint within my web app that generates signed, encrypted SAML Response and uses HTML form to POST SAMLResponse & RelayState.
  • Create SAML SSO configuration in Salesforce with "User Provisioning Enabled" checked and "User Provisioning Type" set to Standard.
  • (I set "Identity Provder Login URL" to my SAML response endpoint; in IdP-initiated flow I did not think this mattered.)
  • Update my web app settings to reflect EntityID as Audience parameter, "Sysomos Community Login URL" as Recipient and POST Action URL, and set up issuer/cert to match configuration.
  • Update community login options to display only the above SAML configuration

Testing:
  • Log into web app and navigate directly to web app SAML endpoint (localhost:1302/SFDC/SAML)
  • Set breakpoint and grab SAMLResponse (signed and encrypted).
  • Test response using "SAML Assertion Validator" - Passes everything except "Unable to map the subject to a Salesforce.com user" which is expected.
  • Remove breakpoint and navigate back to web app SAML endpoint.
  • Allow execution to commence.
  • Page redirected to community login page which redirects to web app SAML endpoint which redirects to community login page and round and round we go.
  • Note: no errors are thrown at any point and no records are added to "Login History" in Setup.
So, my questions are:
  • As a SAML IdP is there supposed to be more than one SAML endpoint (say, that the login url in the SAML config should point to)? If so, what do the others do?
  • Given I am POSTing a valid SAMLResponse to the Community login URL, should it not provision the user requested and log them in?
I see in this question (https://developer.salesforce.com/forums?id=906F0000000BMZBIA4) Marcel dos Santos mentions "I've created a SSO configuration in Salesforce with login and logout URLs pointing to my application and provide a SAML response to Salesforce with the user identity" which I feel I've done, but then Salesforce commits this endless redirect...so I must have something messed up.

Any insight or advice is GREATLY appreciated...I've spent days pulling my hair out over this.
 
I`m new to SAML/SSO configuration and I was wondering if someone can point me in right direction. I have a requirement where I need to configure a third party app as a service provider (Salesforce to act as IdP). I have already shared my org certificate with this Third Party App engineers and in return, they have shared their ACS and entity URL with me. However, SSO is not working.
Questions -
1) Is 'Connected App' the only way to establish SSO in Salesforce?
2) In a documentation shared by this Third Party app, they have given a standard SAML/XML response. Could we create a custom functionality (without using Connected App) to establish SSO?

Any help is much appreciated.
how to identify which class is called when a SOAP request is sent from external system ?

External system is trying to create custom object records in SFDC which are errored at SFDC due to more than 200 records in an API call.

Note : I dont have access to Debug Logs.

I want to replicate the same scenario using SOAP UI but am not able to find which webservice class is called in the SFDC.

Please let me know if you need more info.

Thanks,
Navaprasad
I am on a Professional instance with API enabled. When I call a remote site using the Ajax Toolkit I am getting timeout errors for calls longer than 10 sec. I tried to set the timeout and the async params but it did not help to solve the problem.

 sforce.connection.remoteFunction({ 
                    url : endpoint_url, 
                    onSuccess : function(response) { callback_success(response);},
                    onFailure : function(response) { callback_failure(response);},  
                    method : "POST",
                    requestHeaders : {"Content-Type":"application/json", "charset":"utf-8"},
                    requestData : reqJSON,
                    timeout : 60000,
                    async : true
                });
any idea on how to extend the waiting time beyond the 10 sec?
Currently, we have email to case set up in UAT/PROD for salesforce.
When a user emails to abc@xyz.com, salesforce is configured to create a case automatically.
The problem arises when someone replies to the original email. It creates a new case.
Can anyone please investigate, if they reply to the original email it should not create a new case? Emails should append to the original case.

Thank you very much in advance!!
Hi Team,

When we try to send the REST API request from one salesforce instance (Sandbox) to another salesforce instance (Prod). We are receiving the following error:
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]

HttpRequest req= new HttpRequest(); 
req.setMethod('GET'); 
String username = 'test@salesforce.com'; 
String password = 'test123'; 
Blob headerValue = Blob.valueOf(username + ':' + password); 
String authorizationHeader = 'Basic' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader); 
Http http = new Http(); 
String url = 'https://na1.salesforce.com/services/data/v36.0/tooling/query?q=Select+Id,Name,TableEnumOrId,LastModifiedDate+From+WorkflowRule+Where+LastModifiedDate>2016-01-01'; 
req.setEndpoint(url ); 
HttpResponse res = http.send(req); 
System.debug('AAAAAAAA' +res.getBody());

Could you please anyone check and let us know what modifications required on above code.

Thanks,
Anil


        
Hi,

I need to upload few images to Amazon S3storage. Can anyone help how can i achieve this with apex code.

thanks in advance..
Hi,

Where can I find documentation for the Salesforce Toolkits for .NET?

Thanks,
Scott
Hi everyone,

I am using the REST API from .NET code and fetching one of my custom Encrypted fields from the contact object. How should i decrypt this encrypted field valud to get the actual text in C# ?

Please advise..

Thanks
 
I am creating an Asp.Net web application in which i am using oAuth 2 to authenticate user for salesforce SSO(Single Sign On) and able to fetch user data. But i want to creata a link, which on click can redirect user to thier respective "Salesforce" home page weather its a Domain based user or not. But i am not able to do this.
There is way using IDP bindings, but that will not work in my case as on my website any anonymus user can come and login with salesforce username and password. So how can i do that ?

All suggestions are welcomed.

I need a custom button in Salesforce that It redirect in other web

 

I need a custom button that redirects to another web and will automatically log. The external web only reveives by POST.

 

*** I'm trying to do the following. This returns the HTML of the web. But do not know how to paint.

 

public pagereference contactSend2() {
            HttpRequest req= new HttpRequest();
            HttpResponse res = new HttpResponse();
            Http http = new Http();
            req.setEndpoint('http://extranet.groupalia.com/user/login'); 
            req.setMethod('POST');
            req.setBody('username=***&password=***'); 
            res = http.send(req);
            return null;
   }

 

*** Also I'm trying this:

 

public static HTTPResponse contactSend() {
      HttpRequest req = new HttpRequest();
      req.setMethod('POST');
      req.setEndpoint('http://extranet.groupalia.com/user/login'); 
      req.setBody('username=***&password=***');
      req.setTimeout(60000);
      
      Http http = new Http();
      HTTPResponse res = http.send(req);
      return res;
    }

 

Please anyone have any idea? I'm going crazy.

 

Sergio.

  • February 06, 2013
  • Like
  • 1