• Geoffrey J Flynn
  • NEWBIE
  • 300 Points
  • Member since 2014
  • Consultant


  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 54
    Replies
I'm trying to deploy an inbound change set with a flow, and the deployment keeps failing with this error:

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: Object_API_Name__c duplicates value on record with id, Stack Trace: Class.testChatterOpptyOnAccount.testChatterOppty: line 6, column 1

All the research I've done suggests that this either has something to do with field history tracking or Chatter Feed tracking.  I've disabled tracking field history on all the relevant objects referenced in the flow, and I've disabled the Chatter feed tracking as best I can.  I'm apparently not allowed to disable feed tracking for testChatterOpptyOnAccount.testChatterOppty

We hardly use Chatter at all.  This is driving me batty- how do I get this flow to deploy?

testChatterOpptyOnAccount
Hi 

 I created formula fields for copying the address fields from contact to child custom oject but the client wants only for the first time when a custom object record is created these address fields on custom object must not get updated every time when a contact mailing address is changed.

How to achieve this?
Hi, I'm trying to grab the Owner information for a custom field "Created By" so I can manipulate it to my heart's content.  However, I'm unable to convert the Owner information in a text forumla field, it simply says that the field doesn't exist.  Is it possible to access the Owner default field in any way so I don't have to have users input that data manually?
I have performance edition and I have created a custom profile. Now I wish to assign this custom profile to an existing user. When I edit a user, I am not able to change the profile for that user. When I go to the newly created profile, I can create new users on it, but not select existing users.

Also, is it possible for a user to be assigned multiple profiles in salesforce?

 
Hi,
I created a Lead then converted. After conversion, It created an Account, Contact and Opportunity. Now If I delete the converted Lead then will there be any impact on already created Account, Contact and Opportunity ?



Thanks!
I am trying to create a trigger to create an opportunity on an account when their "billing state" is == trial. Right now, everytime the account is updated to trial it is creating 2 opportunites. Here is the trigger:

trigger Opportunity_inTrial on Account (before update, after update) {
    List<opportunity>Listopp = New List<opportunity>();
    for(account acc_old:trigger.old){
       if(acc_old.Billing_State__c != 'trial'){
           for(account acc:trigger.new){
            if(acc.Billing_State__c == 'trial'){    
                Opportunity opp = New opportunity();
                opp.accountid = acc.id;
                opp.name=acc.name;
                opp.CloseDate=date.Today()+14;
                opp.StageName='0 VO Score';
                Listopp.add(opp);
               }
           }
       }
    }
    if(Listopp.size()>0 && Listopp.size()<2)
    insert Listopp;
}
Is it possible to create an autmated  task and email alert through visual workflow ? We need to create 10 automated task creations and email alerts as per our requirement . I know workflow task creation and through coding we can do it. But any ideas will be helpful
I wrote an Apex trigger and a test class for updating two fields on Accounts depending on some actions on the custom QA Release object. I am unable to get the code coverage reach 75% for some reason. Any inputs on what I might be doing wrong?

Apex Trigger
trigger UpdateVersionsOnAccounts on QA_Release__c (after update) {

set <id> qaRelIds = new set<id>();
set<id> accIds=new set<id>();
for(QA_Release__c qa:trigger.new) {
    qaRelIds.add(qa.Client__c);
    accIds.add(qa.Client__c);
   }
List<QA_Release__c> qaList=[SELECT Client__c,Objective__c,Client_Site_Type__c,Delivered_Date__c,Release_Version__c 
FROM QA_Release__c 
WHERE Client__c=:qaRelIds];

List<account> accList=[SELECT Id,Production_Version__c,UAT_Version__c FROM Account where Id in:accIds];

map <id,QA_Release__c> qaMap =new map<id,QA_Release__c>();

for(QA_Release__c qa:qaList)
{
qaMap.put(qa.Client__c,qa);
}


for( Account acc:accList){

system.debug('Entered Account list with new trigger collection');
    
    if(qaMap.containskey(acc.Id))  {
        
    date delDate=qaMap.get(acc.Id).Delivered_Date__c;
    string relVer=qaMap.get(acc.Id).Release_Version__c;
    string clInst=qaMap.get(acc.Id).Client_Site_Type__c;
    string objective=qaMap.get(acc.Id).Objective__c;
            
            if(delDate!=NULL)
            {
                if(objective=='New Build' && clInst=='Production')
                acc.Production_Version__c=relVer;
                else if(objective=='New Build' && clInst=='QA')
                acc.UAT_Version__c=relVer;
                }
                
        }  
        update accList; 
       } 
        

}

Test Class 
 
@isTest
public class TestUpdateVersionsOnAccounts {
static testMethod void insertnewQARelease() {

QA_Release__c qa= new QA_Release__c();
qa.Client__c='001M000000ce9DkIAI';
qa.Objective__c='New Build';
qa.Due_Date__c=datetime.NOW();
qa.Client_Site_Type__c='Production';
insert qa;
system.debug('QA Release Id is:'+qa.Name);

//Updating the QA task
qa.Status__c='Completed';
qa.Assignee__c='005C0000003SiStIAK';
qa.Release_Version__c='6.5.0.0';
update qa;

qa.Delivered_Date__c=date.TODAY();
update qa;



}
}

Result when I test coverage:

52% Code coverage
 
Hi everyone,
I'm trying to learn on the fly here, my knowledge is more around triggers.

I'm trying to create a List button to automatically create three records, basically I'm trying to create my own grocery list and just automate a few items.

Class and Method:
Global class addGroceries {
    WebService static void addSomeGroceries(){
        List<Groceries__c> groc = new List<Groceries__c>();
        Groceries__c g1 = new Groceries__c(Name='Garlic', Category__c='1 - Fruit and Vegetables');
        groc.add(g1);
        
        Groceries__c g2 = new Groceries__c(Name='Onions', Category__c='1 - Fruit and Vegetables');
        groc.add(g2);
        
        Groceries__c g3 = new Groceries__c(Name='Pears', Category__c='1 - Fruit and Vegetables');
        groc.add(g3);
        insert groc;            
    }
}

Onclick Javascript button:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
sforce.apex.execute("addGroceries","addSomeGroceries",{});
window.location.reload();

Error message
A problem with the OnClick JavaScript for this button or link was encountered:

args not specified

Everything I look up seems to reference passing parameters as part of the button, but I don't have anything to pass here.  
I'm assuming that it's something obvious

Thanks very much



 
Hello- 

Has anyone else receive this error when completing the challenge for the Approving Records from the Feed (Chatter Basics)?

Chatter Basics - Approving Records From the Feed
Hi everyone,
I'm trying to learn on the fly here, my knowledge is more around triggers.

I'm trying to create a List button to automatically create three records, basically I'm trying to create my own grocery list and just automate a few items.

Class and Method:
Global class addGroceries {
    WebService static void addSomeGroceries(){
        List<Groceries__c> groc = new List<Groceries__c>();
        Groceries__c g1 = new Groceries__c(Name='Garlic', Category__c='1 - Fruit and Vegetables');
        groc.add(g1);
        
        Groceries__c g2 = new Groceries__c(Name='Onions', Category__c='1 - Fruit and Vegetables');
        groc.add(g2);
        
        Groceries__c g3 = new Groceries__c(Name='Pears', Category__c='1 - Fruit and Vegetables');
        groc.add(g3);
        insert groc;            
    }
}

Onclick Javascript button:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
sforce.apex.execute("addGroceries","addSomeGroceries",{});
window.location.reload();

Error message
A problem with the OnClick JavaScript for this button or link was encountered:

args not specified

Everything I look up seems to reference passing parameters as part of the button, but I don't have anything to pass here.  
I'm assuming that it's something obvious

Thanks very much



 
Hi All it is some what urgent plz
I have User object and Location custom object.
While i am creating user details i have to select location details and one user may work for more than one location. standard obj should not be a child right. but how can i achieve

USER Details:Standard object

Name:
Email:
phone:
Address:
Company: etc
Location: it is Lookup to Location object 
                  click here -----> it is hyper link to add more locations
I'm trying to deploy an inbound change set with a flow, and the deployment keeps failing with this error:

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: Object_API_Name__c duplicates value on record with id, Stack Trace: Class.testChatterOpptyOnAccount.testChatterOppty: line 6, column 1

All the research I've done suggests that this either has something to do with field history tracking or Chatter Feed tracking.  I've disabled tracking field history on all the relevant objects referenced in the flow, and I've disabled the Chatter feed tracking as best I can.  I'm apparently not allowed to disable feed tracking for testChatterOpptyOnAccount.testChatterOppty

We hardly use Chatter at all.  This is driving me batty- how do I get this flow to deploy?

testChatterOpptyOnAccount
I'm working on the Force.com workbook and in the Visualforce section the suggested code is to pull in a map using Yahoo maps that doesn't seem to work. I found some code for Google Maps and am trying to pull the map from Google Map and display it in a section inside the Position object. Below are the objects and my code. Any help is appreciated.

I have the following custom objects:
Candidate
Employment Website
Job Application
Position
Review (master object - Job Application)
Job Posting (master object - Position, Employment Website)

<apex:page standardController="Position__c">
This map shows the locations of candidates who have applied for the {!Position__c.Name} position.
<head>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {

  var myOptions = {
    zoom: 15,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    mapTypeControl: false
  }

  var map;
  var marker;

  var geocoder = new google.maps.Geocoder();
  var address = "{! Position__c.Candidate__r.Street__c}, " + "{! Position__c.Candidate__r.City__c}, " + "{! Position__c.Candidate__r.State_Province__c}, " + "{! Position__c.Candidate__r.Zip_Postal_Code__c}";

  var infowindow = new google.maps.InfoWindow({
    content: "<b>{! Position__c.Candidate__r.First.Name__c}}, " + "{! Position__c.Candidate__r.Street__c}, " + "{! Position__c.Candidate__r.City__c}, " + "{! Position__c.Candidate__r.State_Province__c}, " + "{! Position__c.Candidate__r.Zip_Postal_Code__c}"
  });

  geocoder.geocode( { address: address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);

        //center map
        map.setCenter(results[0].geometry.location);

        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{! Position__c.Candidate__r.First.Name__c}}"
        });

        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition());
        });

      }

    } else {
      $('#map').css({'height' : '15px'});
      $('#map').html("Oops! {! Position__c.Candidate__r.First.Name__c}'s billing address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });

  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }

});
</script>

<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:250px;
  background:transparent;
}
</style>

</head>

<body>
<div id="map"></div>
</body>
</apex:page>
I would like to update the parent record of a master-child relationship when adding a new child (or editing an existing one to update), where the master record is a standard object (Opportunity) and the child record is a custom object (Memo).

I found this code : 
https://help.salesforce.com/apex/HTViewSolution?id=000005280&language=en_US
but it does nothing - doesn't throw any errors, but doesn't do the update either. Can anyone tell me why not, or whether this is the code to use or should it be done differently? This is what I have now, based on the SF code in the article from the link above:

trigger updateOpportunityWithMemoDate on Memo__c (after insert, before update) {
  
     List<Opportunity> opps = new List<Opportunity>();
     Opportunity oppty;

     for(Memo__c memo: Trigger.new)
      {
           oppty = new Opportunity(Id=memo.Opportunity__c);
           oppty.Last_Memo_Date__c = memo.CreatedDate;   //this is a custom DateTime field in Memo
           oppty.Last_Memo__c = memo.Subject__c;             //this is a custom text field
           oppty.Most_Recent_Memo__c = memo.id;              //this is a custom lookup field
           opps.add(oppty);
       }
      
      if(opps.size() > 0)
      Update opps;

}

}

I would like to also do the same when updating/adding an Opportunity Team Member, since this object doesn't have the ability like for example Product, where one can use roll-up summaries etc, so the only way to update something on the Opportunity parent seems to be via a trigger.
Hi 

 I created formula fields for copying the address fields from contact to child custom oject but the client wants only for the first time when a custom object record is created these address fields on custom object must not get updated every time when a contact mailing address is changed.

How to achieve this?
Hallo,
I'm absolutely new with APEX Code, so this is in my opinion just a simple question:
I want to validate a date field over a few objects. So I wrote a trigger and wanted to test
it, here's the code:
 
trigger TimeValidation on Time__c (before insert) {
    
Set<String> TNames = new Set<String>();

for (Time__c tt : Trigger.New){

Time__c.add(tt.Date__c);
}
    
List<Time__c> lstTT = [select id from Time__c where Date__c = tt.Date__c];
    
if (lstTT.size() > 0){
Trigger.New[0].Name.addError('Duplicate Error!!');
}
}
What I want to do is: When sombedy makes a new entry on Time__c I want to validate if there is still an entry with the same date es currently entered. When there's an entry found, I want have an error and reject the entry.

So as it is one of my first triggers I have the questions:

- In the line 'for (Time__c tt : Trigger.New){' I got the error 'unknown variable'. Does the IDE not know, that Time__c is a custom object or do I have to declare it (in another way)?
- What does this code:
Set<String> TNames = new Set<String>();
... and: Do I need it here?
- Is there still something missing/incorrect?

Thank you for your advice!

 
How would I validate the following

User enters a credit agency from a picklist and enters a numerical score. Validate that the score entered is within the range associated with the credit agency.
For example, range for equifax is 300-850, experian is 330-830. User selects experian and enters 310 which is outside the range for experian.

In total I have 5 credit agencies . Only one credit score value is entered.
 
I recently deployed a trigger to require rejection comments on an approval process along with the test class.  I didn't have any issues in sandbox and received 100% code coverage, but after deploying succesfully to production inbound change sets will sometimes fail and generate the trigger error.  Any help is greatly appreciated.  I'm not sure what I'm missing.
 
System.DmlException: Process failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Select the back button and provide a rejection reason comment.: [] 
Stack Trace: Class.RequireRejectionCommentTestClass.testRejectionWithComment: line 65, column 1
 
trigger RequireRejectionComment on License_Request__c (before update) {
       Map<Id, License_Request__c> rejectedRequests = new Map<Id, License_Request__c>{};
    
      for(License_Request__c lic: trigger.new)
      {

        License_Request__c oldLic = System.Trigger.oldMap.get(lic.Id);
    
        if (oldLic.Approval_Status__c != 'Rejected' 
         && lic.Approval_Status__c == 'Rejected')
        { 
          rejectedRequests.put(lic.Id, lic);  
        }
      }
       
      if (!rejectedRequests.isEmpty())  
      {

        
        List<Id> processInstanceIds = new List<Id>{};
        
        for (License_Request__c lics : [SELECT (SELECT ID
                                                  FROM ProcessInstances
                                                  ORDER BY CreatedDate DESC
                                                  LIMIT 1)
                                          FROM License_Request__c
                                          WHERE ID IN :rejectedRequests.keySet()])
        {
            processInstanceIds.add(lics.ProcessInstances[0].Id);
        }
          
        // Now that we have the most recent process instances, we can check
        // the most recent process steps for comments.  
        
        for (ProcessInstance pi : [SELECT TargetObjectId,
                                       (SELECT Id, StepStatus, Comments 
                                        FROM Steps
                                        ORDER BY CreatedDate DESC
                                        LIMIT 1 )
                                   FROM ProcessInstance
                                   WHERE Id IN :processInstanceIds
                                   ORDER BY CreatedDate DESC])   
        {                   
          if ((pi.Steps[0].Comments == null || 
               pi.Steps[0].Comments.trim().length() == 0))
          {
            rejectedRequests.get(pi.TargetObjectId).addError(
              'Select the back button and provide a rejection reason comment.');
          }
        }  
      } 

    }

 
Hi All,

I have set up a multi step Approval Process where a record should be approved by multiple approvers. In each step a person will approve and that record will be sent to another user to approve.But all those users have only Read only access on that object. Hence they cannot viewthe items pending for aproval.  Is there any workaround so that they can access the items that pending for Approval to those users?

Thanks,
Raghu
Hi, I'm trying to grab the Owner information for a custom field "Created By" so I can manipulate it to my heart's content.  However, I'm unable to convert the Owner information in a text forumla field, it simply says that the field doesn't exist.  Is it possible to access the Owner default field in any way so I don't have to have users input that data manually?
I need to insert a Report chart into a VisualForce page on a Custom Object named "Visit Preparation". Simple enough...

Where I'm struggling... I need to filter the Report's chart using the ID of the Account associated (via lookup relationship) with Visit Preparation Records.

I've created a field that pulls the associated Account's ID named "Salesforce_ID__c".

How do I filter the inserted Report Chart's data by the ID shown in the Salesforce_ID__c field?

Thanks in advance!