function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dmasondmason 

Reassign records based on criteria Message contains a hyperlink

 

Hey All 

 

hope is well, i need some advice / pointers

 

I understand that with the new 14 release we can create triggers on the user object (not sure if this is the case)

 

Aim - In this example https://www.youtube.com/watch?v=QrtVN8vZGJU you can see that “Jim Smith” is going through the  de-activation process . What i want to do, is when you press save, an apex trigger  is triggered and automatically re-assigns “Jim Smith” Leads into this appropriate manager

 

Looking around, It shouldn't be an issue to grab the users's id, and the manager id and change ownership of those leads to the new user, but i may be mistaken and i need some help.

 

The Main issues that potentally could stop this from working is 

 

1.  If there isn't a manager listed you could not assign.

2.  If the manager is also inactive you will not be able to assign the leads (you can only assign records to active users).

3.  If any of the leads have not been edited by the current user and there is validation on the lead that hasn't been completed then the lead will not get reassigned.

Vinita_SFDCVinita_SFDC

Hello,

 

Yes we have got the ability to create trigger on User object in Winter'14 release and the requirement can be achieved.

 

1.  If there isn't a manager listed you could not assign.-- Setup a default owner/user for this case.

 

2.  If the manager is also inactive you will not be able to assign the leads (you can only assign records to active users).--Assign lead to default Owner and notify him with an email.

 

3. If any of the leads have not been edited by the current user and there is validation on the lead that hasn't been completed then the lead will not get reassigned.-- popup a message that the user has pending leads and can not be deactivated.

 

 

dmasondmason

Hi Vinita_SFDC

Thank you for your response

 

I’ve never written a trigger before, do you have any sample code, which could point me in the correct direction? I been researching for weeks online for some sample code, but to no avail and i am very new to SF and apex L

Vinita_SFDCVinita_SFDC

Hello,

 

Below is the link of Apex guide. Refer section: Adding an Apex Trigger

http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf