• Volly
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 9
    Replies

Using the approval process one can lock a record from being edited. Can I use Dataloader to unlock a record and insert some data? I would then have the user complete some work, then submit the record for approval again to lock the record.

 

Is this possible?

  • March 30, 2011
  • Like
  • 0

On a previous thread:

http://community.salesforce.com/t5/Apex-Code-Development/Map-user-custom-field-to-custom-object-via-trigger/td-p/188212

I had an issue with mapping custom fields from the owner of an account to a custom object. I have that working but I now have one small issue. I mapped the standard field "Role" and I'm populating the "User Role" field in my custom object with the following code:

 

        if (xxx.Owner_Role__c == null)
            xxx.Owner_Role__c = approversAccount.owner.UserRole.id;

 The problem is it is showing the record ID, not the text in the field from the user record. The field in the user record has "200" as the role. In my test I'm getting 00E30000000bwlUXXX  in the custom object field. How do I fix this so it will show "200" in the custom object field?

 

  • June 10, 2010
  • Like
  • 0

I have a trigger that pulls information from the owner of the account and places it in the custom object. There are 7 fields in the user object that I need to pull data from. 3 are standard objects, 4 are custom objects. My question is how do I pull the custom field information from the account owner's user record to the custom object fields?

 

My code:

 

trigger Escalation_Trigger on test1__c (before insert, before update) 
{

    list<id> accountIds = new list<id>();
    for (test1__c xxx : trigger.new)
        accountIds.add(xxx.account__c);
    //Map works fine on standard objects in User object.
	map<id,account> approvers = new map<id,account>([select id, owner.id, owner.manager.id, owner.UserRole.id from account where id in :accountIds]);

	//create map of Escalation Manager, Escalation Manager email, DDSM email, LOB email
	//Receiving error on line 12. I do not understand why. 
	map<id,account> managersescalation = new map<id,account>([select owner.Escalation_Manager_Email__c,  DDSM_email__c, LOB_Manager_s_email__c, RP_email__c from account where id in :account]);	

    for (test1 xxx : trigger.new)
    {
        Account approversAccount = approvers.get(xxx.account__c);
        // The first 3 work fine. THey are standard fields on the user object       
        if (xxx.Approving_M__c == null)
            xxx.Approving_M__c = approversAccount.owner.id; 
            
        if (xxx.Approving_Manager__c == null)
            xxx.Approving_Manager__c = approversAccount.owner.manager.id;
 
        if (xxx.Owner_Role__c == null)
            xxx.Owner_Role__c = approversAccount.owner.UserRole.id;
        //----------------
        // These 4 do not work. I do not know why. 
        // Do I reference the field name or API name?	

        if (xxx.Escalation_Email__c == null)
            xxx.Escalation_Email__c = managersescalationAccount.owner.Escalation_Manager_Email__c.id;	        
		
		if (xxx.DDSM_Email__c == null)
            xxx.DDSM_Email__c = managersescalationAccount.owner.DDSM_Email__c;
						
        if (xxx.LOB_Manager_s_email__c == null)
            xxx.LOB_Manager_s_email__c = managersescalationAccount.owner.LOB_Manager_s_email__c.id;	
			
        if (xxx.RP_email__c == null)
            xxx.RP_email__c = managersescalationAccount.owner.RP_email__c.id;	
    }
}   		
		

 

 

  • June 10, 2010
  • Like
  • 0

I'm new to Apex and I'm having a bit of a time understanding it. I'm hoping for a bit of assistance. I have a huge amount of workflow rules (+180) to handle email alerts as well as field updates. This is real messy and I really like to have an Apex trigger handle most of the work.

 

What I'm having a hard time wraping my mind around is how to do field updates. What I'm looking to do for the moment is make a simple Apex trigger that simply reads the Pick list value from a pick list that contains email addresses and then sets that value in the email field. I then can use one workflow to read that email address field and send the email. This will elimate %80 of the workflows I'm having to use on this custom object.

 

Would someone be so kind in showing me a code example specifically on how to do this? I've been searching for hours in books, online, and so forth. I know I'm asking for someone to code this and normally I know I should make an attempt, but I'm a bit lost. Thanks.

  • April 16, 2010
  • Like
  • 0

Looking for community input on recommendations or the best approach to merge the business process and data from one instance of Salesforce into another Salesforce instance.

 

Nothing to detailed, just high level approaches. Even better if anybody has had previous experience with this same scenario, or a method to do this. I am sure given the size and adoption of Salesforce over the years the process of a parent company performing a buyout of a smaller company and merging a Salesforce instance into another Salesforce instance has happened many times before. There has already been some preliminary analysis on Salesforce editions, accounts, and data to be merged.

Hi,

 

Is there a way to set only one data record uneditable and undeleteble?

 

Should not be editable and deletable from anywhere (on the web, through any API and Dataloader).

 

I would appreciate any help on this.

 

Thanks

Arif

  • March 29, 2011
  • Like
  • 0

I have a trigger that pulls information from the owner of the account and places it in the custom object. There are 7 fields in the user object that I need to pull data from. 3 are standard objects, 4 are custom objects. My question is how do I pull the custom field information from the account owner's user record to the custom object fields?

 

My code:

 

trigger Escalation_Trigger on test1__c (before insert, before update) 
{

    list<id> accountIds = new list<id>();
    for (test1__c xxx : trigger.new)
        accountIds.add(xxx.account__c);
    //Map works fine on standard objects in User object.
	map<id,account> approvers = new map<id,account>([select id, owner.id, owner.manager.id, owner.UserRole.id from account where id in :accountIds]);

	//create map of Escalation Manager, Escalation Manager email, DDSM email, LOB email
	//Receiving error on line 12. I do not understand why. 
	map<id,account> managersescalation = new map<id,account>([select owner.Escalation_Manager_Email__c,  DDSM_email__c, LOB_Manager_s_email__c, RP_email__c from account where id in :account]);	

    for (test1 xxx : trigger.new)
    {
        Account approversAccount = approvers.get(xxx.account__c);
        // The first 3 work fine. THey are standard fields on the user object       
        if (xxx.Approving_M__c == null)
            xxx.Approving_M__c = approversAccount.owner.id; 
            
        if (xxx.Approving_Manager__c == null)
            xxx.Approving_Manager__c = approversAccount.owner.manager.id;
 
        if (xxx.Owner_Role__c == null)
            xxx.Owner_Role__c = approversAccount.owner.UserRole.id;
        //----------------
        // These 4 do not work. I do not know why. 
        // Do I reference the field name or API name?	

        if (xxx.Escalation_Email__c == null)
            xxx.Escalation_Email__c = managersescalationAccount.owner.Escalation_Manager_Email__c.id;	        
		
		if (xxx.DDSM_Email__c == null)
            xxx.DDSM_Email__c = managersescalationAccount.owner.DDSM_Email__c;
						
        if (xxx.LOB_Manager_s_email__c == null)
            xxx.LOB_Manager_s_email__c = managersescalationAccount.owner.LOB_Manager_s_email__c.id;	
			
        if (xxx.RP_email__c == null)
            xxx.RP_email__c = managersescalationAccount.owner.RP_email__c.id;	
    }
}   		
		

 

 

  • June 10, 2010
  • Like
  • 0

I'm new to Apex and I'm having a bit of a time understanding it. I'm hoping for a bit of assistance. I have a huge amount of workflow rules (+180) to handle email alerts as well as field updates. This is real messy and I really like to have an Apex trigger handle most of the work.

 

What I'm having a hard time wraping my mind around is how to do field updates. What I'm looking to do for the moment is make a simple Apex trigger that simply reads the Pick list value from a pick list that contains email addresses and then sets that value in the email field. I then can use one workflow to read that email address field and send the email. This will elimate %80 of the workflows I'm having to use on this custom object.

 

Would someone be so kind in showing me a code example specifically on how to do this? I've been searching for hours in books, online, and so forth. I know I'm asking for someone to code this and normally I know I should make an attempt, but I'm a bit lost. Thanks.

  • April 16, 2010
  • Like
  • 0