• Jeff Bloomer
  • NEWBIE
  • 160 Points
  • Member since 2012

  • Chatter
    Feed
  • 5
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 39
    Replies

Hi,

 

I have two fileds. Opportunity Notes date and Opportunity note. My requirement is that until opportunity Note date is blank,Opportunity Notes is disabled. When date is entered in Opportunity Notes date, Opportunity Notes is Enabled.

 

Opportunity Notes Date is blank-----Opporutnity Notes Disabled.

Opportunity Notes Date  has a date-----Opporutnity Notes Enabled.

 

Is it possible to achieve this through workflow?

 

Any help would be appreciated.

 

Thanks,

Alok

 

  • October 30, 2013
  • Like
  • 0

Feeling really dumb today, because I can't figure this out.

 

Anyway, all I'm trying to do is return the three-digit prefix from the NAICS Code in the Data.com information on an Account.  When I do so, I get this error:

 

Save error: Invalid field NaicsCode for SObject Account /SR Salesforce - STAGE/src/classes line 50 Force.com save problem AccountUtils.cls

 

I'm not doing anything all that difficult, and I validated that my user profile has the field visible.

 

public static void addThreeDigitNAICS(List<Account> acctList) {

    Id naicsId = null;
    String threeDigit = null;
    List<NAICS_Code__c> naicsCode = new List<NAICS_Code__c>();

    for (Account a: acctList){
        threeDigit = a.NaicsCode.left(3);
        ...
        ...
    }
}

 I have access to view the field in just about everything else.  Am I just hosed?

 

 

This code works just fine for individual record updates, but I'm trying to get it to work for a mass upload of data.  Any insights?

 

trigger TRG_SurveyFeedback_UpdateParentAccounts on Survey_Feedback__c (before insert, before update) {

	Set<ID> setAcctId = new Set<ID>();						//Holds the Account Id from the Survey Feedback			
	List<Account> currentAccount = new List<Account>();		//Holds Related Account on Survey Feedback
	List<Account> parentAccount = new List<Account>();		//Holds list of Parent Accounts for Related Account
	String relAcctId = '';									//Related Account Id
	Integer topAccount = 0;									//Holds number of top-most account in parentAccount list
	Boolean boolParentAssnd = false;						//Is Parent Account Assigned yet?


	for (Survey_Feedback__c sfb: Trigger.new){
        setAcctId.add(sfb.Account__c);
	}
	
	currentAccount = [SELECT Id, Name FROM Account WHERE Id in :setAcctId];
	relAcctId = currentAccount[0].Id; 
	
	//Get the list of Accounts in the hierarchy for relAcctId.
	parentAccount = getAccountHierarchy(relAcctId);
	
	/**
		getAccountHeirarchy(string)
		
		@description
		The getAccountHierarchy function, which requires an accountId as a paramenter,
		fetches the list of accounts appearing above the accountId in he hierarchy.
		It returns a list (accList) that contains the following information for the Account:
		
		Id, Name, ParentId, and Location_Type__c	
	*/
	List<Account> getAccountHierarchy(String accountId){
		
		List<Account> accList = new List<Account>();		//Holds list of accounts above accountId
        Boolean isTop = false;								//Is this the top-most account?
        
        while (!isTop){
            Account a = [SELECT Id, Name, ParentId, Location_Type__c FROM Account WHERE Id =: accountId limit 1];
            if (a.ParentId != null){
            	accountId = a.ParentId;
            }else{
            	isTop = true;
            }
            accList.add(a);
        }
        return accList;
	}
	
	//Get the index of the top-most account in parentAccount
	topAccount = parentAccount.size() - 1;
	
	for(Survey_Feedback__c sfb: Trigger.new){
	
		//Note: start with index 1, because index 0 is the Related Account.
		for(Integer i = 1; i < parentAccount.size(); i++){
	
			if(parentAccount[i].Location_Type__c == 'Parent' && boolParentAssnd == false){
				sfb.Parent_Account__c = parentAccount[i].Id;
				boolParentAssnd = true;
			}
		}
		if(parentAccount[topAccount].Location_Type__c == 'Ultimate Parent' && parentAccount[topAccount].Id !=  relAcctId){
			sfb.Ultimate_Parent_Account__c = parentAccount[topAccount].Id;
		}		
	}
}

 

I'm writing a trigger that updates two fields in a custom object leverages a Related Account lookup field to populate two other lookups for the Parent account and Ultimate Parent account.  The Related Account Id already exists in the data fed by survey information received through ClickTools, but the trigger's job is to populate Parent account and Ultimate Parent account.  The point is, I need to populate Parent account with the first parent it finds and  then the Ultimate parent at the top of the list.  It seems to me that the only way I can effectively do this is by counting the number of parent accounts up the hierarchy from the account receiving the data, so here is my issue:

 

I've seen a number of examples for counting child accounts, but what I'm wanting to do is count the number of accounts above an account all the way to the top of the tree.  Here's an example:

 

  • Account 1
    • Account 2
      • Account 3
        • Account 4
        • Account 5
          • Account 7
        • Account 6

I want to know that, for Account 7, there are three parents above it.  I also want to obtain the ID and Type from each Parent above it.

 

This being said, I want to be able to do this in a variable situation, whether it's 2 or 10 layers deep.  Any ideas?

 

 

It appears that only the System Admin is getting the e-mails when an unhandled error happens in our Production instance of SF.  How do I enable so that I am copied on these messages as well?

Before I even start spinning my wheels, is it reasonable to assume that I can create a trigger that would create an attachment for an object after it's been created that contains an Excel file with the data that was just populated within it?

 

I've been told that if I can conceive of it, then it's most likely possible.  Also, if there is something similar out there that someone has already done, I would be greatly appreciative if you could point me down that path.

 

Thanks in advance!

Is it possible to do a SOQL query that allows me to obtain the SF Id of a master-detail custom field I have in a custom object?  I'm not wanting the ID for a record in the object I want the Id for the actual field.  Field API name is Opportunity__c in a custom object with an API name of Win_Form__c.

I have a very simple trigger I've written for adding two text fields to Opportunity Team Member that I then use in a flow.  It must be because it's the end of the day and I'm not thinking clearly, but I just need it to line up so that it doesn't mismatch the text values for the users with the actual records.  Right now, if I add more than 1 member to the Oppportunity Team, it enters the wrong person's name into Team Member Name and Team Member last name.  I just need to get them to match up as they're being entered.

 

trigger TRG_OpptyTeamMemberName on OpportunityTeamMember (before insert, before update) {

	List<User> teamMemberInfo = new List<User>();
	Set<ID> setTeamMemberID = new Set<ID>();
	Integer index = 0;
	
	for (OpportunityTeamMember otm: Trigger.new){
		setTeamMemberID.add(otm.UserId);
	}
	
	teamMemberInfo = [Select u.Name, u.LastName, u.Id From User u where u.Id in: setTeamMemberID];
	
	for (OpportunityTeamMember otm: Trigger.new){
		otm.Team_Member_Name__c = teamMemberInfo[index].Name;
		otm.Team_Member_LastName__c = teamMemberInfo[index].LastName;
		index +=1;
	}
	
}

Can someone please set me straight so that the values align as they go back into the record?

There are times that Salesforce.com really frustrates me!!  You would think that it would be easy to just add a text formula custom field that would allow you to populate it with the Full Name of an Opportunity Team Member.  What kind of gyrations to I have to get to a field that should otherwise be available for me to access through a standard database relationship.  This is where having the ability to do a SOQL select query in a formula field would really come in handy.  Come on Salesforce developers.  What happened to common sense?!?

Is it possible to have a case assignment rule that changes the case owner and adds case team as the result of a case being created by a flow?

The current custom Forecasting object is centered around Opportunity pipeline.  It's forecasting what our sales reps believe will close within a particular time period.  What my company wants to do is also set up forecasting for revenue once the Opportunity has been set to Closed - Won.  I'd like to have the ability to replicate the forecasting object, pages and components via Apex & Visualforce, but it's not possible for me to view all of the fields or how the Forecasting piece is implemented.  The idea is to have a similar interface where people can enter their projections around what they would expect to be invoiced in a particular month.  They could possibly have an input gui that shows all 12 months of the year containing prior year volume on one line and then current time period on the bottom where they can enter the current forecast.

 

If there is anyone else out there that has done this or something similar in the past and can provide the insight for me to get the information I need to do this, I would be very grateful.  Thanks in advance for any advice you can provide.

I'm using flows to create a case, and I want to know if there is a way to have it specify a TRUE for it to use the assignments rules when the case is created.  I don't just want to make that the default choice, because once the case is accepted by a user from the queue, I don't want it to reassign the case to the queue.

 

Any and all insights are welcome.  Thanks!

 

Jeff Bloomer

I have a version of this Dynamic Search that I've placed into a SFDC site.  Just curious if anyone has adapted it to have NEXT and PREVIOUS buttons.  I'm thinking it may be too kluge to implement, but if anyone has an answer, I would be very grateful.  Thanks in advance!

 

Jeff

So, here's a newbie question (this is my very FIRST development project). I have a custom object called Account Corrections (Account_Correction__c), that we're using to document Account Owner change requests. On the form, there is a lookup field where the user looks up the Proposed Account Owner (Proposed_Account_Owner__c). Consequently, I want another lookup field to self-populate with the Proposed Account Owner's Manager (Proposed_Account_Owner_s_Manager__c). The reason I'm doing this is to facilitate an Approval Process on the backend that works best with lookup fields to dynamically specify approvers.

Anyway, I'm trying to use an "after insert" trigger to do the job , but I'm not clear on the approach to take. If someone could just put me on the right track, I would be VERY appreciative. If it helps, here are the fields from the Account Corrections object:
Status__c, Request_Details__c, Related_Account__c, Proposed_Account_Owner_s_Manager__c, Proposed_Account_Owner__c, OwnerId, Name, Id, Current_Acct_Owner_s_Manager__c, Current_Account_Owner__c, Assigned_To__c

 

The code below is as far as I've gotten:

trigger TRG_AccountCorrectionRequest_ChangeOwner on Account_Correction__c (after insert, after update) {

	for (Account_Correction__c ac: Trigger.new){
		if (ac.Status__c == 'Submitted' && ac.Request_Details__c == 'Assign Different Account Owner'){
			ac.Current_Acct_Owner_s_Manager__c = ac.Current_Account_Owner__r.ManagerId;
			ac.Proposed_Account_Owner_s_Manager__c = ac.Proposed_Account_Owner__r.ManagerId;
		}
	}
}

 Any assistance is very much appreciated.  Thanks in advance!

Is it possible to do a SOQL query that allows me to obtain the SF Id of a master-detail custom field I have in a custom object?  I'm not wanting the ID for a record in the object I want the Id for the actual field.  Field API name is Opportunity__c in a custom object with an API name of Win_Form__c.

There are times that Salesforce.com really frustrates me!!  You would think that it would be easy to just add a text formula custom field that would allow you to populate it with the Full Name of an Opportunity Team Member.  What kind of gyrations to I have to get to a field that should otherwise be available for me to access through a standard database relationship.  This is where having the ability to do a SOQL select query in a formula field would really come in handy.  Come on Salesforce developers.  What happened to common sense?!?

Hi,

 

I have two fileds. Opportunity Notes date and Opportunity note. My requirement is that until opportunity Note date is blank,Opportunity Notes is disabled. When date is entered in Opportunity Notes date, Opportunity Notes is Enabled.

 

Opportunity Notes Date is blank-----Opporutnity Notes Disabled.

Opportunity Notes Date  has a date-----Opporutnity Notes Enabled.

 

Is it possible to achieve this through workflow?

 

Any help would be appreciated.

 

Thanks,

Alok

 

  • October 30, 2013
  • Like
  • 0

Feeling really dumb today, because I can't figure this out.

 

Anyway, all I'm trying to do is return the three-digit prefix from the NAICS Code in the Data.com information on an Account.  When I do so, I get this error:

 

Save error: Invalid field NaicsCode for SObject Account /SR Salesforce - STAGE/src/classes line 50 Force.com save problem AccountUtils.cls

 

I'm not doing anything all that difficult, and I validated that my user profile has the field visible.

 

public static void addThreeDigitNAICS(List<Account> acctList) {

    Id naicsId = null;
    String threeDigit = null;
    List<NAICS_Code__c> naicsCode = new List<NAICS_Code__c>();

    for (Account a: acctList){
        threeDigit = a.NaicsCode.left(3);
        ...
        ...
    }
}

 I have access to view the field in just about everything else.  Am I just hosed?

 

 

This code works just fine for individual record updates, but I'm trying to get it to work for a mass upload of data.  Any insights?

 

trigger TRG_SurveyFeedback_UpdateParentAccounts on Survey_Feedback__c (before insert, before update) {

	Set<ID> setAcctId = new Set<ID>();						//Holds the Account Id from the Survey Feedback			
	List<Account> currentAccount = new List<Account>();		//Holds Related Account on Survey Feedback
	List<Account> parentAccount = new List<Account>();		//Holds list of Parent Accounts for Related Account
	String relAcctId = '';									//Related Account Id
	Integer topAccount = 0;									//Holds number of top-most account in parentAccount list
	Boolean boolParentAssnd = false;						//Is Parent Account Assigned yet?


	for (Survey_Feedback__c sfb: Trigger.new){
        setAcctId.add(sfb.Account__c);
	}
	
	currentAccount = [SELECT Id, Name FROM Account WHERE Id in :setAcctId];
	relAcctId = currentAccount[0].Id; 
	
	//Get the list of Accounts in the hierarchy for relAcctId.
	parentAccount = getAccountHierarchy(relAcctId);
	
	/**
		getAccountHeirarchy(string)
		
		@description
		The getAccountHierarchy function, which requires an accountId as a paramenter,
		fetches the list of accounts appearing above the accountId in he hierarchy.
		It returns a list (accList) that contains the following information for the Account:
		
		Id, Name, ParentId, and Location_Type__c	
	*/
	List<Account> getAccountHierarchy(String accountId){
		
		List<Account> accList = new List<Account>();		//Holds list of accounts above accountId
        Boolean isTop = false;								//Is this the top-most account?
        
        while (!isTop){
            Account a = [SELECT Id, Name, ParentId, Location_Type__c FROM Account WHERE Id =: accountId limit 1];
            if (a.ParentId != null){
            	accountId = a.ParentId;
            }else{
            	isTop = true;
            }
            accList.add(a);
        }
        return accList;
	}
	
	//Get the index of the top-most account in parentAccount
	topAccount = parentAccount.size() - 1;
	
	for(Survey_Feedback__c sfb: Trigger.new){
	
		//Note: start with index 1, because index 0 is the Related Account.
		for(Integer i = 1; i < parentAccount.size(); i++){
	
			if(parentAccount[i].Location_Type__c == 'Parent' && boolParentAssnd == false){
				sfb.Parent_Account__c = parentAccount[i].Id;
				boolParentAssnd = true;
			}
		}
		if(parentAccount[topAccount].Location_Type__c == 'Ultimate Parent' && parentAccount[topAccount].Id !=  relAcctId){
			sfb.Ultimate_Parent_Account__c = parentAccount[topAccount].Id;
		}		
	}
}

 

I'm writing a trigger that updates two fields in a custom object leverages a Related Account lookup field to populate two other lookups for the Parent account and Ultimate Parent account.  The Related Account Id already exists in the data fed by survey information received through ClickTools, but the trigger's job is to populate Parent account and Ultimate Parent account.  The point is, I need to populate Parent account with the first parent it finds and  then the Ultimate parent at the top of the list.  It seems to me that the only way I can effectively do this is by counting the number of parent accounts up the hierarchy from the account receiving the data, so here is my issue:

 

I've seen a number of examples for counting child accounts, but what I'm wanting to do is count the number of accounts above an account all the way to the top of the tree.  Here's an example:

 

  • Account 1
    • Account 2
      • Account 3
        • Account 4
        • Account 5
          • Account 7
        • Account 6

I want to know that, for Account 7, there are three parents above it.  I also want to obtain the ID and Type from each Parent above it.

 

This being said, I want to be able to do this in a variable situation, whether it's 2 or 10 layers deep.  Any ideas?

 

 

It appears that only the System Admin is getting the e-mails when an unhandled error happens in our Production instance of SF.  How do I enable so that I am copied on these messages as well?

Before I even start spinning my wheels, is it reasonable to assume that I can create a trigger that would create an attachment for an object after it's been created that contains an Excel file with the data that was just populated within it?

 

I've been told that if I can conceive of it, then it's most likely possible.  Also, if there is something similar out there that someone has already done, I would be greatly appreciative if you could point me down that path.

 

Thanks in advance!

Where can I find the documentation on building the "regex_text" part of the REGEX function? All I can find in Help/Training/Release Notes is  a few examples of a working formula. There is nothing that explains the different characters and codes that can be used in the "regex_text" part of this function.
 
Syntax:
REGEX(text, regex_text)
 
Instructions:
Replace text with the text field, and regex_text with the regular expression you want to match
 
Examples:
REGEX(Drivers_License__c, "([A-Z]\\d{7})?")
REGEX(BillingPostalCode, "\\d{5}(-\\d{4})?")
REGEX(Credit_Card_Number__c, "(((\\d{4}-){3}\\d{4})|\\d{16})?")
REGEX(IP_Address__c, "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" )
REGEX(Social_Security_Number__c, "[0-9]{3}-[0-9]{2}-[0-9]{4}")