• Eager-2-Learn
  • NEWBIE
  • 395 Points
  • Member since 2009
  • Lead Programmer/Analyst

  • Chatter
    Feed
  • 13
    Best Answers
  • 6
    Likes Received
  • 0
    Likes Given
  • 202
    Questions
  • 327
    Replies

I'm trying to write a class that will delete all records in a custom object with a specific status.  Can't seem to get pass the syntax.

 

I've got this...

 

public with sharing class DeletePostedToHistory{

 

List<CustomObj__c> CustomObj = [

select status__c  

from CustomObj__c  

where status__c = 'Posted to History'];  

 

delete CustomObj;

 

}

 

But I get the error "expecting right curly bracket, found 'delete'

 

What am I missing here?

 

Thanks,



 

 

I created a custom text field and when I am in edit mode on the Matching Rule and click on the Matching Method drop down I do not see that entry Fuzzy: MyCustomField__c, for example!

All I see are the out of the box settings.
Fuzzy: First Name
Fuzzy: Last Name
Fuzzy: Company Name
Fuzzy: City
Fuzzy: Street
Fuzzy: Zip
Fuzzy: Title


Thanks for your support/help.

I have an issue that is happening in Summer '18 but not in Winter '19 sandboxes and the test class and code base is the same in both orgs.
 
I have a process that triggers from a user record being deactivated.  It performs a callout and performs the deactivation in all connected sandboxes which works like a charm.
 
My test class creates a user record and uses a mock class to get the proper code coverage.  It works like a charm in the Winter '19 sandbox; however, it still works in the Summer '18 sandbox but the code coverage drops from 100 to 82.  Further review I see the following message in the logs on the Summer or but not in the Winter org.
 
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out.
 
I saw a 2016 post stating similar issue and the work around was to read the user record from the database instead of created one within your test class and it was also marked as fixed.
 
One thing to note is I do not create the test user inside the Test.startTest() and Test.stopTest() which I believe the correct way.
 
Has anyone experienced this issue and do you have better solution than to break Salesforce's own rule not to read existing database data and create your own with in the test class.
 
Thank you for your help.

Hi,
I am trying to lookup an account (source and look up an account (destination) on a visualforce page.  Then when the Get Contacts button is clicked I plan to populate the lower half of the screen with the contacts associated with the source account that is selected.  Then I want another button that will copy the selected contacts to the destination account.  I need other things too occur with the contacts that are created but I think I can do that.  The issue I am having is getting the controller to capture the id of the accounts selected.

I discovered that I need the FORM tag to get the icon for the look up but I can't seem to get any javascript to work where it will pass the account ids to the controller. 
Can someone please help with this issue?  The code I have so far, good or bad is below.

VF Page:
<apex:page Controller="AccountMergerController" tabStyle="Account"> 
    <apex:form > 
        <apex:pageBlock title="Account Merger" > 
            <apex:pageBlockButtons >
                <apex:commandButton value="Get Source Contacts" action="{!getContacts}" reRender="pageBlockSection"/>            
            </apex:pageBlockButtons>    
            
            <apex:pageBlockSection title="Select the Source and Destination (Master) Accounts">                    
                <apex:inputField label="Source Account" value="{!sourceOpp.AccountId}" required="true" />                                 
                <apex:inputField label="Destination (Master) Account" value="{!sourceOpp.AccountId}" required="true" />                 
            </apex:pageBlockSection>
        </apex:pageBlock>        
    </apex:form>
    <apex:pageblock >
        <apex:pageBlockSection id="pageBlockSection2" title="Select Contacts to Copy to Destination Account)">
            
        </apex:pageBlockSection> 
    </apex:pageblock>
</apex:page>


Controller:

public with sharing class AccountMergerController {

    public Opportunity sourceOpp { get; set; } 
    public Opportunity destOpp { get; set; }  
    public Id id;
    public Id sourceId { get; set; }
    public Id destinationId { get; set; }
    
    public AccountMergerController() {

    }
    
    public void getContacts() {
        System.debug('sourceOpp: ' + sourceOpp.AccountId );
    }
}



 

Is anyone else having this issue where the ORDER BY StageName actually reports back Z to A?  If I do ORDER BY StageName DESC then it sorts A to Z.  This is backward!  It seems consistant but when reading the code you would expect a different result than what actually is returned.
Hi,
I am going throught the example and I am at the first part where you should be able to save dating but it doe not save data and it does not give me an error.  I put an alert statement to make sure that the button is actually firing the code.  I have no idea if the object has data in it because all the Alert returns is "[object Object]"  It is not like in the Apex debugger where you can see the content of the object.  It feels like this java script frame work is a step back in time to me.  Not user friend development at all!

Below is part of the example where I put an alert statement that does pop up but like I said it doesn't show any content that the expense object would be holding.

Any ideas -- I have looked at this code over and over and over and over and I see it to be written as I see in the book!
 
upsertExpense : function(component, expense, callback) {    
        alert("upsertExpense before saveExpense call!");
    	var action = component.get("c.saveExpense"); 
        
        alert("upsertExpense after saveExpense action! " + expense);
        
        action.setParms({
            "expense": expense
        });
        if (callback) {
        	action.setCallback(this, callback);
        }
        $A.enqueueAction(action);

    },//Delimited for future code

Thanks in advance for your support.
What is the best approach to handle timeouts (120 second max in SF) when sending data to another system via HTTP callout.
Issue:
Data is sent and received and stored in the destination system but SF doesn't get the response back in the allotted time; therefore, we receive the timeout error and log it in SF as such.  The process has to hop through several layers within our company (I don't fully understand the details on that) but nonetheless, it is confirmed that the data reaches the destination and the response just does not come back to SF in time.

In a none perfect world lets say we will never get the response back in the 120 second time frame.  What would be the best design approach.

I was thinking that we would create the error record in SF due to the 120 time as we already do.  But the destination system should perform an update back to our system on the error record settting a checkbox named Validated.  This way we can at least rule out that error record as one to follow up on research.

Need help please!  What says you? 
 
Hi,
I am trying to understand the best patter/performance way to build a map or set.  So for example, if I am building a set of say 40,000 rows that may have duplicates coming in (I know the set would over write the current position) is that faster than if I check if the value exists first with an IF statement ( i.e.: if ( !myset.contains(valueAdding)) {myset.add(valueAdding);} )?  My question is for Maps as well.

I typically have been simply adding the value and not checking because I thought if I had a large number (several thousand that the CONTAINS method check would slow the process down; however, on the other had in the background does it take a lot more processor time to add a value?  I don't know -- looking for some feedback please! :)

 
I was hoping for some suggestions on how to iterate over opportunity record's child object to get a summarized total from the opportunity child record if a date on that child record meets the criteria of 02/01/xx (year would be current year).  If no records on the child fall in the 02/01/xx then I need to look at the prior year's opportunity child record and get it's 02/01/xx (last years) summary total.

This is what I have in my mind from concept.  Using batch apex, I am getting all the opportunities that fall in the date range that the business requires as current opps.  I used those ids to build a aggregate on the child records to get the summary totals and the child date 02/01/xx.  If it exists I get that summary and put it on the opportunity parent record.

The part I can't figure out as of yet is how to handle getting the last years child summary on to the current years opportunity when the above does not have a 02/01/xx (current year records on the child object).  What I was thinking is another job that would run after the first (described above) and this time get the current years opportunities but only if the field that I wan the summary to be on is blank.  That would give me all opps that didn't get the summary total for the 02/01/xx records on the child object.  But some how I have to the prior years opportunities so that I can get to the related child records to get the summary of the 02/01/xx (last years date on the child records) and put that total on the current years opportunity that is also related to the same account record.

Any ideas on a best approach for something like this?
Hi,

I have a subclass wrapper that I use to populate a pageblocktable on the VF page.  When I take action on the row I am able to pass the row id to the controller and do some work that I need to do. 

The problem is I know want to update the row on the table with data.  I think I need to get the wrapper class row and update it and my action refreshes the pageblocktable so I think it should refresh and show the change.  The problem is I am having trouble figuring out how to use my wrapper class list and get to the specific related row so I can update the field level data in the wrapper class record.  

Since it is a list I am not certain I can do this.  Any idea on this would be helpful.
Hi,

I wanted to know if it is bad practice to update a map inside a for loop.  When I say update I do not mean a DML update--as I know better! :)  I mean can I do a get on a map and a put on that same map inside a loop.  I want to read thorugh records in my loop and if I find a matching key in my map over and over, I want to keep updating the map with the latest records data?  Once out of the loop then I figure I should be able to do my DML on the map.
We had code in place that worked but the business wanted to stop the push of data to our external app.  I took the button off of the SF page to prevent the usres from pushing the data.  Now about 1.5 year later they want to the button back on the page.  However, I now get the following error when the callout is executed.  I have been told by some that it could be the cert on the external system.  Can anyone please confirm that is a possibility or add other possible areas that I should look into.


System.CalloutException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Hi,

I saw a few posts around the "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target" error but they are not clear to me as far as being the same issue I am having.

About a year ago code that builds an http callout worked when clicking a button to submit opportunity data to another system (not a SF target).  The business decided they did not want to submit data to that system any more.  Well now a year later and they want it back on.  All I did was make the button visible on the page again and now I get the error stated above.

I do not recall a certificate on stored on the SF side during this effort.  As far as the target system and what they did on there end is unclear to me and the key players involved are no longer on the team!  

At a miminum can anyone confidently tell me if the issue is on the SF side or the Target side or both?  If I cannot get a clear cut answer if I knew what side the issue was on I could get key players involved in the right direction.

Your support is deeploy appreciated.


I am trying to understand the API versioning of classes when you make modifications in a newer salesforce release.  For example, if I create a class in spring 10 (say it was api version 22) and then I make a change to that class during the spring 14 release will the api for that class stay at api 22?

I notice there is a way to explicitly change the api from a drop down on the Version Settings tab of the class and I thought as long as I do not change that the oringal api version stays the same. 

However, I was told by an architect that if you change a class in the Spring release and that version was 22 for example, then it will compile under the Spring release version api 30 and be saved as api 30; however, I do not see that pick list change to 30 unless I explicitly change it.

Can someone put some clarity around what really happens?
Hi,

I have for lack of a better word--a data factory that I call from within my test class.  I need to see the debug statements that I have in the data factory class method but when I look at the logs I do not see the debug statements that I created.  I need to see if I am building the data correctly because I am having an issue.

Is there a way to see debug statements in test classes or the data factory class/method that I call.
Hi,

I am writing this small app to keep track of our user license in a specific way so that we know what department and cost center is paying for the license.  I created a two custom objects (master/detail).  When an action is performed on the user record the trigger executes custom code that creates a child record (detail)  with info about that user record and what department, etc.  The master object holds the allotted license count, used, and balance.  here is the issue.

Because this is an admin app and an admin has all permissions I need to know how I can prevent the admin from deleting or editing these child records.  The only way they should be edited is if the admin changed the User record's license department.  If the user is marked inactive then the trigger code deletes the child record as described above.

Is there a way to detect when a user is using the page layout delete or edit capability on the child (related list) record so that I can have my code produce a message to the admin that they are not allowed to do that but still have the trigger code on the user trigger delete or edit the records on the child record?

I have not done this yet but I was thinking the solution is this: 
Create a static variable at the user trigger level and since I would set it to a value (TRUE) when the user record is updated by the time the delete DML or update DML fires on the child record I could have code in the child record trigger test for that value.  If it is true do nothing but if it is FALSE (assumed the user clicked edit or delete at the child record level/related list show an error (child.addError('You cannot do this action").

Or will I not have scope to the variable that is created in the user trigger by the time execution gets to the child trigger?  This is what I am not certain of.
Hi,

I hope I do not sound too amature here but....

How is everyone doing integration points with other systems be it SF is calling out or another system is calling into SF?  For example,
  1. How can you tell which integration point logged in.  We cannot afford a different user license for every integration point!
  2. What do you do if you have multiple integration points and a person leaves that company in one the integration point areas that knows the log in credentials?  is that a major issue to change the password and contact every integration point with the new log in.
Looking for best practices in areas like I am describing.  Thanks.

Hi,
 

Does anyone have a best approach template for sending data to another system when data changes.  We do not want to use Outbound Messenging.
 

Would the receiving system have to supply the SF system a WSDL or the other way around?  
 

I will be using a trigger to call a class method.  That class method will build an in memory array of data from account, contact and opportunity data.  I want that array of data to be sent to the other system.

Does anyone have a high-level layout approach to do this and even a basic code example of sending an array of data would be sweet! :)
 

Hi,
I was wondering if anyone has any starter code that can satify the following use cases.
  1. When a new user is created in production that user must also be created in the full sandbox.
  2. When an existing user in production is de-activated they must be deactivated in the full sandbox.
  3. When an existing user in production is activated they must be activated in the full sandbox.
  4. When an existing user in produciton has their profile, license, etc. changed the change must occur in the full sandbox.

I was playing with the concept of exporting the user data from production daily and upserting to TEST but I had some issues when I was working with that a few months ago.  I was hoping for a more dynamic approach with API calls to the Sandbox for example.

Anyone else needing something along these lines?  Anyone have any jump start ideas/code?


Hi,
I have a situation that I have  been unable to recreate because it happens less than 10 times a year that I am aware of.  There is a future call that executes after the Opportunity Product Related List is updated and the custom field on is Checked.  That causes a fture call that grabs all product names where the checkbox is checked and strings there values in a custom field on the Opportunity page called Products_Sold__c.  There are times when the Products_Sold__c field never gets populated.

Is there a way that in the future call method I can have SF notify me if that calls fails for whatever reason such as record locking issue or whatever?

As I wrote the question I realized that I should put the DML in a TRY CATCH and send an email to Admins if a failure is detected.  Is that possible?  I will start down that avenue as I wait for an answer from someone.  


Thanks

Hi,

I am trying to create a visual force page that will have two fields Source and Destination but they both reference the same back end master/detail field.  This page uses Opportunity as the standard controller and the child table/object as the extension.  I want the user to be able to select Opp A in the source field and Opp B in the dest field for example.  This seems to work fine.  I cannot seem to get any controller action to occur using the onchange event so I am thinking I could get around this with an additional button named MOVE.

How can I reference both of the different values in these two fields from my controller when they have a VALUE setting that is the same?  Below is some of the main code snippet around the VF page.

<apex:page StandardController="Opportunity" Extensions="Enrollment_MoveLatestEnrollContr2" id="Page" tabstyle="Opportunity"
           sidebar="false" showHeader="false" title="Move Latest Enrollment" >
        
    <apex:sectionHeader title="Move Latest Enrollment" subtitle="Move Latest Enrollment" />     
    <apex:form id="myForm">
        <apex:pageMessages escape="false" />  
        <apex:PageBlock id="pbSrceDest" rendered="{!isAdmin}">                 
            <apex:pageBlockSection columns="1" title="Select a Destination Opportunity"  collapsible="false" >
                <apex:inputField id="SourceOpp" label="Source Opportunity" value="{!Enrollment.Opportunity__c}" />            
                <apex:inputField id="DestOpp" label="Destination Opportunity" value="{!Enrollment.Opportunity__c}" />               
            </apex:pageBlockSection>
...
...

Thanks in advance for your assistance:)

 

What is the best approach to handle timeouts (120 second max in SF) when sending data to another system via HTTP callout.
Issue:
Data is sent and received and stored in the destination system but SF doesn't get the response back in the allotted time; therefore, we receive the timeout error and log it in SF as such.  The process has to hop through several layers within our company (I don't fully understand the details on that) but nonetheless, it is confirmed that the data reaches the destination and the response just does not come back to SF in time.

In a none perfect world lets say we will never get the response back in the 120 second time frame.  What would be the best design approach.

I was thinking that we would create the error record in SF due to the 120 time as we already do.  But the destination system should perform an update back to our system on the error record settting a checkbox named Validated.  This way we can at least rule out that error record as one to follow up on research.

Need help please!  What says you? 
 
Hi,

I am writing this small app to keep track of our user license in a specific way so that we know what department and cost center is paying for the license.  I created a two custom objects (master/detail).  When an action is performed on the user record the trigger executes custom code that creates a child record (detail)  with info about that user record and what department, etc.  The master object holds the allotted license count, used, and balance.  here is the issue.

Because this is an admin app and an admin has all permissions I need to know how I can prevent the admin from deleting or editing these child records.  The only way they should be edited is if the admin changed the User record's license department.  If the user is marked inactive then the trigger code deletes the child record as described above.

Is there a way to detect when a user is using the page layout delete or edit capability on the child (related list) record so that I can have my code produce a message to the admin that they are not allowed to do that but still have the trigger code on the user trigger delete or edit the records on the child record?

I have not done this yet but I was thinking the solution is this: 
Create a static variable at the user trigger level and since I would set it to a value (TRUE) when the user record is updated by the time the delete DML or update DML fires on the child record I could have code in the child record trigger test for that value.  If it is true do nothing but if it is FALSE (assumed the user clicked edit or delete at the child record level/related list show an error (child.addError('You cannot do this action").

Or will I not have scope to the variable that is created in the user trigger by the time execution gets to the child trigger?  This is what I am not certain of.
Hi,
I was wondering if anyone has any starter code that can satify the following use cases.
  1. When a new user is created in production that user must also be created in the full sandbox.
  2. When an existing user in production is de-activated they must be deactivated in the full sandbox.
  3. When an existing user in production is activated they must be activated in the full sandbox.
  4. When an existing user in produciton has their profile, license, etc. changed the change must occur in the full sandbox.

I was playing with the concept of exporting the user data from production daily and upserting to TEST but I had some issues when I was working with that a few months ago.  I was hoping for a more dynamic approach with API calls to the Sandbox for example.

Anyone else needing something along these lines?  Anyone have any jump start ideas/code?


I am struggling with the understanding of API usage.  I saw an example in the cook book where I could consume the Apex Partner WSDL in a Salesforce ORG.  Now I am trying to actually query data from one developer org  and by using the partner classes generated the WSDL import actually insert records into another developer org via API calls.

 

The examples that I find in the API developer guide are all around C# or Java apps doing this.  I want to do this from one SF org to another SF org.

 

In addition, I do not see any full-complete examples of how to encrypt the password so that the actual Apex code inside of SF does not allow someone to see the password in its normal view.

 

Any help would be appreciated.

Is it ok to use Salesforce case management to support your own internal users. I notice that the contacts field must stay on the page even though it is not required but it seems to be driven from an external customer/contact perspective!

Has anyone set it up for there own user support and do you have any best practices and hard road experience that you would not mind sharing?

Hi,

I found a code snippet that shows how to encrypt and decrypt using a key that is built on the fly but I can't figure out how to have a hard-code key in the code or store the key in SFDC and retrieve it within the same code chunk.

 

What I am doing is building a small app that will allow users to store website information, user id and passwords but I want only the owner to be able to see the password information.  I want it so that even me as an admin permission, not to be able to see the password.

 

 

This is the code sample that I referered too:

// Use generateAesKey to generate the private key  
    
Blob cryptoKey = Crypto.generateAesKey(256);

// Generate the data to be encrypted.  
    
Blob data = Blob.valueOf('Test data to encrypted');

// Encrypt the data and have Salesforce.com generate the initialization vector   
    
Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data);

// Decrypt the data  
    
Blob decryptedData = Crypto.decryptWithManagedIV('AES256', cryptoKey, encryptedData);

 

.

 

 

 

I was hoping for some suggestions on how to iterate over opportunity record's child object to get a summarized total from the opportunity child record if a date on that child record meets the criteria of 02/01/xx (year would be current year).  If no records on the child fall in the 02/01/xx then I need to look at the prior year's opportunity child record and get it's 02/01/xx (last years) summary total.

This is what I have in my mind from concept.  Using batch apex, I am getting all the opportunities that fall in the date range that the business requires as current opps.  I used those ids to build a aggregate on the child records to get the summary totals and the child date 02/01/xx.  If it exists I get that summary and put it on the opportunity parent record.

The part I can't figure out as of yet is how to handle getting the last years child summary on to the current years opportunity when the above does not have a 02/01/xx (current year records on the child object).  What I was thinking is another job that would run after the first (described above) and this time get the current years opportunities but only if the field that I wan the summary to be on is blank.  That would give me all opps that didn't get the summary total for the 02/01/xx records on the child object.  But some how I have to the prior years opportunities so that I can get to the related child records to get the summary of the 02/01/xx (last years date on the child records) and put that total on the current years opportunity that is also related to the same account record.

Any ideas on a best approach for something like this?
Hi,

I have a subclass wrapper that I use to populate a pageblocktable on the VF page.  When I take action on the row I am able to pass the row id to the controller and do some work that I need to do. 

The problem is I know want to update the row on the table with data.  I think I need to get the wrapper class row and update it and my action refreshes the pageblocktable so I think it should refresh and show the change.  The problem is I am having trouble figuring out how to use my wrapper class list and get to the specific related row so I can update the field level data in the wrapper class record.  

Since it is a list I am not certain I can do this.  Any idea on this would be helpful.
I am trying to understand the API versioning of classes when you make modifications in a newer salesforce release.  For example, if I create a class in spring 10 (say it was api version 22) and then I make a change to that class during the spring 14 release will the api for that class stay at api 22?

I notice there is a way to explicitly change the api from a drop down on the Version Settings tab of the class and I thought as long as I do not change that the oringal api version stays the same. 

However, I was told by an architect that if you change a class in the Spring release and that version was 22 for example, then it will compile under the Spring release version api 30 and be saved as api 30; however, I do not see that pick list change to 30 unless I explicitly change it.

Can someone put some clarity around what really happens?
Hi,

I have for lack of a better word--a data factory that I call from within my test class.  I need to see the debug statements that I have in the data factory class method but when I look at the logs I do not see the debug statements that I created.  I need to see if I am building the data correctly because I am having an issue.

Is there a way to see debug statements in test classes or the data factory class/method that I call.
Hi,

I am writing this small app to keep track of our user license in a specific way so that we know what department and cost center is paying for the license.  I created a two custom objects (master/detail).  When an action is performed on the user record the trigger executes custom code that creates a child record (detail)  with info about that user record and what department, etc.  The master object holds the allotted license count, used, and balance.  here is the issue.

Because this is an admin app and an admin has all permissions I need to know how I can prevent the admin from deleting or editing these child records.  The only way they should be edited is if the admin changed the User record's license department.  If the user is marked inactive then the trigger code deletes the child record as described above.

Is there a way to detect when a user is using the page layout delete or edit capability on the child (related list) record so that I can have my code produce a message to the admin that they are not allowed to do that but still have the trigger code on the user trigger delete or edit the records on the child record?

I have not done this yet but I was thinking the solution is this: 
Create a static variable at the user trigger level and since I would set it to a value (TRUE) when the user record is updated by the time the delete DML or update DML fires on the child record I could have code in the child record trigger test for that value.  If it is true do nothing but if it is FALSE (assumed the user clicked edit or delete at the child record level/related list show an error (child.addError('You cannot do this action").

Or will I not have scope to the variable that is created in the user trigger by the time execution gets to the child trigger?  This is what I am not certain of.
Hi,
I have a situation that I have  been unable to recreate because it happens less than 10 times a year that I am aware of.  There is a future call that executes after the Opportunity Product Related List is updated and the custom field on is Checked.  That causes a fture call that grabs all product names where the checkbox is checked and strings there values in a custom field on the Opportunity page called Products_Sold__c.  There are times when the Products_Sold__c field never gets populated.

Is there a way that in the future call method I can have SF notify me if that calls fails for whatever reason such as record locking issue or whatever?

As I wrote the question I realized that I should put the DML in a TRY CATCH and send an email to Admins if a failure is detected.  Is that possible?  I will start down that avenue as I wait for an answer from someone.  


Thanks
Hi,
I found the same question that was posted back in 2007; however, there was no answer to the question so I decided to ask again.

Is there a way to hide or show custom button on a standard page based on a condition.  In my case I want the button only to show if a system administrator is logged in, all other users should not see this button as it would be used to do some adminstrative work  such as call a VF page/controller.


HI,

I am wondering if my approach on programming a trigger and calling a class is the best approach.  This is what I am coding.

 

I created a class (not static).  In the class I have public member variables that are set from the trigger that intantiates the class.  These variables hold things like Trigger.New, isUpdate, isInsert, etc.  In the trigger I use IF logic to detect the type of trigger even and then instantiate the class and set the member variables accordingly.  Below is an example.  What would your feedback, best practices say about this approach?  Am I on target or are there flaws with this approach and if so what do you suggest?  Thank you in advance for your assistance.

 

trigger Contact_trigger on Contact ( after insert, after delete, after update, before insert, before update, before delete ) {   
    EmployerGroupPortal egp = new EmployerGroupPortal();
    egp.isInsert = Trigger.isInsert;            
    egp.isUpdate = Trigger.isUpdate;
    egp.isDelete = Trigger.isDelete;
    egp.oldMap = Trigger.oldMap;
    if ( Trigger.isBefore ) {
        if ( Trigger.isInsert || Trigger.isUpdate ) {            
            egp.contacts = Trigger.new;
        }  
        if ( Trigger.isDelete ) { 
            egp.contacts = Trigger.old;
        }
        egp.egpValidation();
    }
}

 

I am struggling with the understanding of API usage.  I saw an example in the cook book where I could consume the Apex Partner WSDL in a Salesforce ORG.  Now I am trying to actually query data from one developer org  and by using the partner classes generated the WSDL import actually insert records into another developer org via API calls.

 

The examples that I find in the API developer guide are all around C# or Java apps doing this.  I want to do this from one SF org to another SF org.

 

In addition, I do not see any full-complete examples of how to encrypt the password so that the actual Apex code inside of SF does not allow someone to see the password in its normal view.

 

Any help would be appreciated.

I am struggling with the understanding of API usage.  I saw an example in the cook book where I could consume the Apex Partner WSDL in a Salesforce ORG.  Now I am trying to actually query data from one developer org  and by using the partner classes generated the WSDL import actually insert records into another developer org via API calls.

 

The examples that I find in the API developer guide are all around C# or Java apps doing this.  I want to do this from one SF org to another SF org.

 

In addition, I do not see any full-complete examples of how to encrypt the password so that the actual Apex code inside of SF does not allow someone to see the password in its normal view.

 

Any help would be appreciated.

Hi,

 

Can someone help me figure out how to get account, contact and opportunity data on a single line record per related group (3)?  To be clear I am not asking for Opportunity Contact Role I am asking for the data at the contact level that is related to the account.  For example if I had the folliwing situation:

 

Account Data&colon;

      Account Name =  A1

            Related Contact Data&colon;          

                First Name: = C1

                First Name = C2

            Related Opportunity Data&colon;

                Opp Name = O1

                Opp Name = O2

                Opp Name = 03

 

Then the record in the flat file would look like this:

Account Name      First Name      Opp Name

A1                C1              O1

A1                C1              O2

A1                C1              03

A1                C2              O1

A1                C2              O2

A1                C2              O3      

 

 

 

 

I started a for loop as shown below but am not sure if this is the correct approach and if it is now I can manage to build the structure to provide the results as shown above.

for ( Account a: [ SELECT Name, (SELECT FirstName, LastName, Email 
                                 FROM Contacts ), (SELECT Name, Field2 
                                                   FROM Opportunities
                                                   WHERE Effective_Date__c >= LAST_N_MONTHS:12 AND Effective_Date__c <= LAST_MONTH) 
                   FROM Account 
                   WHERE Type = 'Customer' LIMIT 10 ] ) {
	
	for ( Contact c: a.Contacts ) {
                           
    }
    // Loop and get the opportunites                   
    for ( Opportunity o: a.Opportunities ) {
                           
    }
                     
                     
}

 

 

 

              

Hi,

 

Up front I do not see any scheduled job reporting capabilities--bummer!

 

So I thought what a great opportunity for me to write some code and iterate through the CronTrigger table--bummer again!


To be specific my goal is to be able to report on all scheduled reports that are a year from reaching the scheduled end date.  Thr ConTrigger object does not seem to have a field for what is scheduled, be it a report or an apex class.

 

Is there any undocumented information for a possible hidden field that gives me this information on the CronTrigger object?

 

I see this is a big issue and high maintenance because you can only schedule 5 years out.  If you are not baby-sitting these jobs then you could potentially code or reports that stop running!

 

Any support on this would be appreciated very much.