• Adriana Voyce
  • NEWBIE
  • 45 Points
  • Member since 2014
  • Salesforce Administrator


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 16
    Questions
  • 20
    Replies
Hello All, 

I have a trigger I created to auto-convert a lead. Basically, when a box is checked on a lead, it kicks off process builder to convert the lead. It used to work just fine but a couple of months ago it stopped working. Any idea why? How can I fix this? Any help would be gretly appreciated! 


Public class AutoConvertLeads
{
@InvocableMethod
public static void LeadAssign(List<Id> LeadIds)
{
LeadStatus CLeadStatus= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true Limit 1];
List<Database.LeadConvert> MassLeadconvert = new List<Database.LeadConvert>();

List<Lead> myLeads = [Select id, name, Studio_Sync_Account_ID__c, Stripped_Website__c, website, company from Lead where id IN:LeadIds];


for (Lead l:myLeads){

}

List<Account> matchAccount = [Select id, Account_Classification__c, Full_ID__c, Stripped_Website__c, website, Name from account ];

for(Lead currentlead: myLeads){
for (Account a:matchAccount){
if (currentlead.Studio_Sync_Account_ID__c== a.Full_ID__c){
Database.LeadConvert Leadconvert = new Database.LeadConvert();
Leadconvert.setLeadId(currentlead.id);
Leadconvert.setAccountId(a.id);
Leadconvert.setConvertedStatus(CLeadStatus.MasterLabel);
Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion
MassLeadconvert.add(Leadconvert);
Break;
}
}
}

if (!MassLeadconvert.isEmpty()) {
List<Database.LeadConvertResult> lcr = Database.convertLead(MassLeadconvert);
}
}}
I created a Custom Lightning Page Template "Record page with collapsing regions" following the instructions in this link:

https://developer.salesforce.com/blogs/2018/08/all-about-custom-lightning-page-templates.html

The issue is I need the header to be pinned so that component in the header region scrolls down as the user scrolls down. 

Any suggestions? 
Hello!

In lighting knowledge communities I am using CSS to remove the field labels since title and URL cannot not be removed from the page layout or via field level security. 

The code I am using below is removing the summary and meta data info and the labels. The problem I am having is when I use .uiOutputText - it gets rid of the additional text from title and URL which I want, but it is also removing the text from the pill which I don't want. Additionally I cannot seem to get rid of the grey lines that separate the text.

I have tried various things and this is the closest I get. Any ideas?

Code:
.selfServiceArticleLayout .article-summary{display:none;}
.meta{display:none;}
.test-id__field-label{display:none;}
.uiOutputText{display:none;}

Output:
User-added image
I am receiving the following error: We can't save this record because the “Quote Line Updates” process failed. Give your Salesforce admin these details. <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow.  Please contact your system administrator for more information. Error ID: 9681222-24286 (937709402): []

I have checked EVERYWHERE for this flow. It is not, in the list of processes under process builder. There a no visual workflows either. I have looked in the developer work bench and while all of my other processes show up there this one does not. How/Where could this be hinding???? 

Flow Details
Flow Name: Quote_Line_Updates
Type: Record Change Process
Version: 1
Status: Active
 
Hi All, 

I have a series of workflows with email alerts and filed updates for birthdays the details are here: https://help.salesforce.com/articleView?id=000181218&language=en_US&type=1 

The problem with this is that it requieres a mass update of all my records which puts thousands of records in time based workflow queue and interferes with other time based workflows that I have.

What I would like to do it the following: I have a formula that calculates "Next birthday Date" - I would like to have a scheduled batch that runs every night and for records that match that date - I want them to be checked with a checkbox that will kickoff the worklfows. I am using both regular contacts and person accounts so this needs to work on both or it has to be 2 different ones and thats ok, but I have NO IDEA!!! how to do something like this... Does any one know? 
Hi All, 

Please keep your responses as simple as possible, I am learning :)

I created A Class, A controller, and a VF template to display the approval process details, however... The values returned are UserIDs and GMT time stamp - Additionally I can't seem to get a nice table in my visualforce template it doesn't seem to respect the percentages I give it or setting it to 100%. Image of wants below along with my code.

I assume I need to tell my class to give me the Actorname but thats not one of the values I can pull from = getApprovalSteps not sure how to accomplsih this or do I do this somwhere else? 

Class: 

public class OpportunityApprovalHistoryController {
    public String opptyId {get;set;}
    public List<ProcessInstanceHistory> getApprovalSteps() 
    {if (opptyId != null) {Opportunity quote = 
        
[Select Id, 

(Select TargetObjectId, SystemModstamp, StepStatus, RemindersSent, ProcessInstanceId, OriginalActorId, IsPending, 
IsDeleted, Id, CreatedDate, CreatedById, Comments, ActorId From ProcessSteps order by SystemModstamp desc) 

from Opportunity where Id = :opptyId];

 return quote.ProcessSteps;}
 
 return new List<ProcessInstanceHistory> ();}}

Controller:
<apex:component controller="OpportunityApprovalHistoryController" access="global">

<apex:attribute name="oppId" assignTo="{!opptyId}" type="String" description="Id of the opportunity"/>

<apex:dataTable value="{!approvalSteps}" var="step">

<style></style>

<apex:facet name="caption">Approval History</apex:facet>
<apex:facet name="header">Details</apex:facet>

<apex:column width="20%">
<apex:facet name="header">Date</apex:facet>
<apex:outputText value="{!step.SystemModstamp}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Status</apex:facet>
<apex:outputText value="{!step.StepStatus}"/>
</apex:column>

<apex:column width="20%" >
<apex:facet name="header">Assigned To</apex:facet>
<apex:outputText value="{!step.OriginalActorid}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Actual Approver</apex:facet>
<apex:outputText value="{!step.ActorID}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Comments</apex:facet>
<apex:outputText value="{!step.Comments}"/>
</apex:column>

</apex:dataTable>
</apex:component>

VF Template

<messaging:emailTemplate subject="Opportunity {!relatedTo.Name} Submitted for {!relatedTo.Subscription_Discount_Percent__c}% Subscription Discount" recipientType="User" relatedToType="Opportunity">
<messaging:HtmlEmailBody >

<p>Hello {!recipient.Name},</p>

<p>Opportunity: {!relatedTo.Name} for {!relatedTo.Account.Name} has been submitted for approval: </p>

<html>
<head>
<meta content="text/css;charset=utf-8" http-equiv="Content-Type"/>
<meta name="Template" content="Response"/>
</head>
<body>
<p><b>Approval History</b>

<c:opportunityapprovalhistory oppId="{!relatedTo.Id}" />

</p>
</body>
</html>
</messaging:HtmlEmailBody>
</messaging:emailTemplate>

WHAT I WANT

User full name not ID; Date in this format 5/16/2017 Est, and columns that auto size to the text along with borders on the table. 

User-added image
I created a VF page to show a related list. For example if I was using this code, how can I customize what columns to display on the VF pg. The code below is showing the related list of my related record in a VFpage. So whatever fields I have selected in my related list are displayed in the VF page. The problem I am running across is that when I remove the related from the page layout my VF Pg display changes to just show the default which is the record name and no the columns. I do not want the related list on the layout only the VF page.
<apex:page standardController="MyMasterObject__c">
<apex:relatedList list="MyChildObjects__r" />
</apex:page>
Hi All, 

I created a visualforce page to display a related list from a custom object. It looks great and I was able to remove the edit links as well. I would like however for the list to be read only though. I want the page to show the columns and details but I do not want the user to be able to click on the record reference to try to navigate to it. If they click on the VF page I do not want anything to happen. 

Here is my code for the page. I tried readOnly="True" but it does not seem to work. 
<apex:page standardController="SBQQ__Quote__c" readOnly="true"> <apex:relatedList list="SBQQ__LineItems__r" /> <style> [Class*='actionColumn'] { display:none; visibility:hidden; } </style> <style> [Class*='linkSpan'] { display:none; visibility:hidden; } </style> </apex:page>

Any suggestions? 
Is it possible to have the images of a rich text field display on an email template? Perhaps visualforce or html? how can I accomplish this? 
Hi! I created a button that is supposed to check a checkbox on an opportunity and open a window which allows a use to download a docoument....

The button works, the checkbox is checked and the window pops up to download, but when I click the button an error appears first and then the window pops up... How do I get rid of this error?

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
var newRecords = []; 
var c = new sforce.SObject("Opportunity"); 
c.id ="{!Opportunity.Id}"; 
c.Voice_Referal__c = true; 
newRecords.push(c); 
result = sforce.connection.update(newRecords); 
window.location.replace('/apex/SDOC__SDCreate1?id={!Opportunity.Id}&Object=Opportunity')();

User-added image
I am trying to edit this code so that it updates the field if the contact role = Billin Contact and it does not have to be primary (I do not care about the promary contact only about having a billing contact) the trigger is working with a validation rule that checks if a primary contact has been added so I assume it can be tweak to be based on billing contact instead.... right? 


trigger updatecontactrolecount on Opportunity (before insert, before update)
{

Boolean isPrimary;
Integer iCount;

Map<String, Opportunity> oppty_con = new Map<String, Opportunity>();//check if the contact role is needed and add it to the oppty_con map
for (Integer i = 0; i < Trigger.new.size(); i++) 
{
        oppty_con.put(Trigger.new[i].id,
        Trigger.new[i]);      
}
isPrimary = False; 
for (List<OpportunityContactRole> oppcntctrle :[select OpportunityId from OpportunityContactRole where (OpportunityContactRole.IsPrimary = True and OpportunityContactRole.OpportunityId in :oppty_con.keySet())])
{
 if (oppcntctrle .Size() >0)
 {
 isPrimary = True;     
 }
}
iCount = 0;
for (List<OpportunityContactRole> oppcntctrle2 : [select OpportunityId from OpportunityContactRole where (OpportunityContactRole.OpportunityId in :oppty_con.keySet())])//Query for Contact Roles
{    
 if (oppcntctrle2 .Size()>0)
 {
 iCount= oppcntctrle2 .Size();     
 }
}
for (Opportunity Oppty : system.trigger.new) //Check if  roles exist in the map or contact role isn't required 
{
Oppty.Number_of_Contacts_Roles_Assigned__c = iCount;
Oppty.Primary_Contact_Assigned__c =isPrimary; 
}
}
I would like to have a screen or something show up when someone submits a quote for approval so they can write in the justification for the discount. Similar to the screnshot below... Could something similar be accomplished through a flow? Or would it requiere a visual force page? Or is there another idea? 

User-added image
We use ringlead internally to help maintain data integrity, and have over written the new button so that when new is clicked ringlead evaluates the record. 

The problem is that in our partner community the same button is used and the end user receives an error. The only way to prevent this from happening would be to create a new button that is assigned only to the partner profiles, which I can do, but I need it to call a VF page which would be the lead creation page. 

How can I recreate the lead creation page trought visual force so that partners can create leads. I am novice to developing so my knowledge is very limited and I cannot figure out the code... I need to do it for a coupoe other objects as well. 

Any help would be greatly appreciated... All I have written is

<apex:page standardcontroller="Lead" tabstyle="Lead"> <apex:form >
 
I am trying to create a button that will update the stage of an opportunity to a specific stage, and the owner to whom ever clicks the button, additionally I want the update to happen only if a specific profile clicks the button (this may be best accomplished through a validation rule though so its not in my code) 

This is what I have written just trying to get the stage to change.... I get this error: "Unexpected Token Illegal"

***Note*** I am not a developer but trying to learn so my knoweledge is mimited 


{!requireScript("/soap/ajax/10.0/connection.js")};
sforce.connection.session = "{!$Api.Session_ID}";

function updateOpportunity( )
{
    try
    {

 
var opp = new sforce.SObject(“Opportunity”); 
opp.id =”{!Opportunity.Id}”;                  
opp.StageName = "AE Qualified”;               

var saveResult = sforce.connection.update([Opportunity]); 


if (result[0].getBoolean("success") == false ) { 
alert(result[0].errors.message); 
return; 

window.top.location.href=window.top.location.href; 

catch (e) { 
alert(e); 
}    


updateOpportunity();
One one my users is receiving the following error:  script /Applications/Maildrop.app/Contents/Resources/outlook scripts/Add Email to Salesforce.com.scpt error {     NSAppleScriptErrorAppName = "Microsoft Outlook";     NSAppleScriptErrorBriefMessage = "recipient of item 1 of {incoming message id 1257036} doesn\U2019t understand the \U201ccount\U201d message.";     NSAppleScriptErrorMessage = "Microsoft Outlook got an error: recipient of item 1 of {incoming message id 1257036} doesn\U2019t understand the \U201ccount\U201d message.";     NSAppleScriptErrorNumber = -1708;     NSAppleScriptErrorRange = NSRange: {1692, 32}; }


Any ideas as to how to fix this? Is there a way to do a complete uninstall like there is for Salesforce for Outlook deleteing the DB folder? Or any other way to fix this? 
I created a trigger, and it works great in Sandbox, but when I launched it to production I receieved the following error:

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger autostaff caused an unexpected exception, contact your administrator: autostaff: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Staff__c, original object: User: []: Trigger.autostaff: line 19, column 1 

My trigger is written as follows:If creates a record on the staff object when a user is created 

trigger autostaff on User (after insert) {

List <Staff__c> newstaff = new list <Staff__c> ();

for (User U : Trigger.new){

Staff__c Staff = new Staff__c();

Staff.Employee__c = U.ID;



Staff.Name      = U.Full_Name__c;

newstaff.add(Staff);

}

insert newStaff;

}

From what I have read I need a to add System.runAs as part of my code, but I am not sure how that should be writttten...

Any help is appreaciated.... Please and thank you :) 

 
Hello All, 

I have a trigger I created to auto-convert a lead. Basically, when a box is checked on a lead, it kicks off process builder to convert the lead. It used to work just fine but a couple of months ago it stopped working. Any idea why? How can I fix this? Any help would be gretly appreciated! 


Public class AutoConvertLeads
{
@InvocableMethod
public static void LeadAssign(List<Id> LeadIds)
{
LeadStatus CLeadStatus= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true Limit 1];
List<Database.LeadConvert> MassLeadconvert = new List<Database.LeadConvert>();

List<Lead> myLeads = [Select id, name, Studio_Sync_Account_ID__c, Stripped_Website__c, website, company from Lead where id IN:LeadIds];


for (Lead l:myLeads){

}

List<Account> matchAccount = [Select id, Account_Classification__c, Full_ID__c, Stripped_Website__c, website, Name from account ];

for(Lead currentlead: myLeads){
for (Account a:matchAccount){
if (currentlead.Studio_Sync_Account_ID__c== a.Full_ID__c){
Database.LeadConvert Leadconvert = new Database.LeadConvert();
Leadconvert.setLeadId(currentlead.id);
Leadconvert.setAccountId(a.id);
Leadconvert.setConvertedStatus(CLeadStatus.MasterLabel);
Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion
MassLeadconvert.add(Leadconvert);
Break;
}
}
}

if (!MassLeadconvert.isEmpty()) {
List<Database.LeadConvertResult> lcr = Database.convertLead(MassLeadconvert);
}
}}
I am receiving the following error: We can't save this record because the “Quote Line Updates” process failed. Give your Salesforce admin these details. <b>An unhandled fault has occurred in this flow</b><br>An unhandled fault has occurred while processing the flow.  Please contact your system administrator for more information. Error ID: 9681222-24286 (937709402): []

I have checked EVERYWHERE for this flow. It is not, in the list of processes under process builder. There a no visual workflows either. I have looked in the developer work bench and while all of my other processes show up there this one does not. How/Where could this be hinding???? 

Flow Details
Flow Name: Quote_Line_Updates
Type: Record Change Process
Version: 1
Status: Active
 
Hi All, 

I have a series of workflows with email alerts and filed updates for birthdays the details are here: https://help.salesforce.com/articleView?id=000181218&language=en_US&type=1 

The problem with this is that it requieres a mass update of all my records which puts thousands of records in time based workflow queue and interferes with other time based workflows that I have.

What I would like to do it the following: I have a formula that calculates "Next birthday Date" - I would like to have a scheduled batch that runs every night and for records that match that date - I want them to be checked with a checkbox that will kickoff the worklfows. I am using both regular contacts and person accounts so this needs to work on both or it has to be 2 different ones and thats ok, but I have NO IDEA!!! how to do something like this... Does any one know? 
Hi All, 

Please keep your responses as simple as possible, I am learning :)

I created A Class, A controller, and a VF template to display the approval process details, however... The values returned are UserIDs and GMT time stamp - Additionally I can't seem to get a nice table in my visualforce template it doesn't seem to respect the percentages I give it or setting it to 100%. Image of wants below along with my code.

I assume I need to tell my class to give me the Actorname but thats not one of the values I can pull from = getApprovalSteps not sure how to accomplsih this or do I do this somwhere else? 

Class: 

public class OpportunityApprovalHistoryController {
    public String opptyId {get;set;}
    public List<ProcessInstanceHistory> getApprovalSteps() 
    {if (opptyId != null) {Opportunity quote = 
        
[Select Id, 

(Select TargetObjectId, SystemModstamp, StepStatus, RemindersSent, ProcessInstanceId, OriginalActorId, IsPending, 
IsDeleted, Id, CreatedDate, CreatedById, Comments, ActorId From ProcessSteps order by SystemModstamp desc) 

from Opportunity where Id = :opptyId];

 return quote.ProcessSteps;}
 
 return new List<ProcessInstanceHistory> ();}}

Controller:
<apex:component controller="OpportunityApprovalHistoryController" access="global">

<apex:attribute name="oppId" assignTo="{!opptyId}" type="String" description="Id of the opportunity"/>

<apex:dataTable value="{!approvalSteps}" var="step">

<style></style>

<apex:facet name="caption">Approval History</apex:facet>
<apex:facet name="header">Details</apex:facet>

<apex:column width="20%">
<apex:facet name="header">Date</apex:facet>
<apex:outputText value="{!step.SystemModstamp}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Status</apex:facet>
<apex:outputText value="{!step.StepStatus}"/>
</apex:column>

<apex:column width="20%" >
<apex:facet name="header">Assigned To</apex:facet>
<apex:outputText value="{!step.OriginalActorid}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Actual Approver</apex:facet>
<apex:outputText value="{!step.ActorID}"/>
</apex:column>

<apex:column width="20%">
<apex:facet name="header">Comments</apex:facet>
<apex:outputText value="{!step.Comments}"/>
</apex:column>

</apex:dataTable>
</apex:component>

VF Template

<messaging:emailTemplate subject="Opportunity {!relatedTo.Name} Submitted for {!relatedTo.Subscription_Discount_Percent__c}% Subscription Discount" recipientType="User" relatedToType="Opportunity">
<messaging:HtmlEmailBody >

<p>Hello {!recipient.Name},</p>

<p>Opportunity: {!relatedTo.Name} for {!relatedTo.Account.Name} has been submitted for approval: </p>

<html>
<head>
<meta content="text/css;charset=utf-8" http-equiv="Content-Type"/>
<meta name="Template" content="Response"/>
</head>
<body>
<p><b>Approval History</b>

<c:opportunityapprovalhistory oppId="{!relatedTo.Id}" />

</p>
</body>
</html>
</messaging:HtmlEmailBody>
</messaging:emailTemplate>

WHAT I WANT

User full name not ID; Date in this format 5/16/2017 Est, and columns that auto size to the text along with borders on the table. 

User-added image
Hi All, 

I created a visualforce page to display a related list from a custom object. It looks great and I was able to remove the edit links as well. I would like however for the list to be read only though. I want the page to show the columns and details but I do not want the user to be able to click on the record reference to try to navigate to it. If they click on the VF page I do not want anything to happen. 

Here is my code for the page. I tried readOnly="True" but it does not seem to work. 
<apex:page standardController="SBQQ__Quote__c" readOnly="true"> <apex:relatedList list="SBQQ__LineItems__r" /> <style> [Class*='actionColumn'] { display:none; visibility:hidden; } </style> <style> [Class*='linkSpan'] { display:none; visibility:hidden; } </style> </apex:page>

Any suggestions? 
Hi! I created a button that is supposed to check a checkbox on an opportunity and open a window which allows a use to download a docoument....

The button works, the checkbox is checked and the window pops up to download, but when I click the button an error appears first and then the window pops up... How do I get rid of this error?

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
var newRecords = []; 
var c = new sforce.SObject("Opportunity"); 
c.id ="{!Opportunity.Id}"; 
c.Voice_Referal__c = true; 
newRecords.push(c); 
result = sforce.connection.update(newRecords); 
window.location.replace('/apex/SDOC__SDCreate1?id={!Opportunity.Id}&Object=Opportunity')();

User-added image
I would like to have a screen or something show up when someone submits a quote for approval so they can write in the justification for the discount. Similar to the screnshot below... Could something similar be accomplished through a flow? Or would it requiere a visual force page? Or is there another idea? 

User-added image
We use ringlead internally to help maintain data integrity, and have over written the new button so that when new is clicked ringlead evaluates the record. 

The problem is that in our partner community the same button is used and the end user receives an error. The only way to prevent this from happening would be to create a new button that is assigned only to the partner profiles, which I can do, but I need it to call a VF page which would be the lead creation page. 

How can I recreate the lead creation page trought visual force so that partners can create leads. I am novice to developing so my knowledge is very limited and I cannot figure out the code... I need to do it for a coupoe other objects as well. 

Any help would be greatly appreciated... All I have written is

<apex:page standardcontroller="Lead" tabstyle="Lead"> <apex:form >
 
I want a button on Soltuions to be able to email me when a Soltuion needs to be udpated.  I have the following link
/_ui/core/email/author/EmailAuthor?p3_lkid={!Solution.Id}&retURL=%2F{!Solution.Id}&{!(ISPICKVAL(Solution.Status, "Needs Update"))}&p5="gilmore_staci@cat.com"&p24="mansfield_matthew@cat.com"&template_id=00X19000000QFda
The email send fine, but I can't get the fields to update.  I have it trying to change the Status field to Needs Update.  How can I get it to do this?
Status is a picklist.  I also want a checkbox to uncheck. TIA!
 
  • March 11, 2015
  • Like
  • 0
I am trying to create a button that will update the stage of an opportunity to a specific stage, and the owner to whom ever clicks the button, additionally I want the update to happen only if a specific profile clicks the button (this may be best accomplished through a validation rule though so its not in my code) 

This is what I have written just trying to get the stage to change.... I get this error: "Unexpected Token Illegal"

***Note*** I am not a developer but trying to learn so my knoweledge is mimited 


{!requireScript("/soap/ajax/10.0/connection.js")};
sforce.connection.session = "{!$Api.Session_ID}";

function updateOpportunity( )
{
    try
    {

 
var opp = new sforce.SObject(“Opportunity”); 
opp.id =”{!Opportunity.Id}”;                  
opp.StageName = "AE Qualified”;               

var saveResult = sforce.connection.update([Opportunity]); 


if (result[0].getBoolean("success") == false ) { 
alert(result[0].errors.message); 
return; 

window.top.location.href=window.top.location.href; 

catch (e) { 
alert(e); 
}    


updateOpportunity();

Hiya,

 

 Im after some advice on what i think is going to be a pretty simple bit of code.  Basically i want to write a trigger on the User object that will insert a record into a separate Staff__c object with details of the user just saved. I was unsure how to pull the details of the user just saved. 

 

Here is some rough pseudo code! Unsure if it would even work with something along these lines? But il give it a try while waiting if anyone else has a better idea :)  (updated code, works even though its rough :) )

 

Just need to work out how to get it to fire only once!

 

 

trigger userToStaff on User (after insert, after update) {

 

List<Staff__c> staffToUpdate = new List<Staff__c>();

 

for (User usr : Trigger.new) {

Staff__c staff = new Staff__c (

//User_ID__c = usr.Id

First_Name__c = usr.Name

);

staffToUpdate.add(staff);

}


 

if(staffToUpdate.size()>0){

try {

insert staffToUpdate;

} catch (exception e) {

system.debug(e.getMessage());

}

}

}

 

 

 

Any advice would be great!!! :)

 

Regards

Michael 

Message Edited by Brookesy-- on 12-21-2009 02:23 AM
Message Edited by Brookesy-- on 12-21-2009 05:33 AM
Message Edited by Brookesy-- on 12-21-2009 05:35 AM
Message Edited by Brookesy-- on 12-21-2009 05:36 AM
Message Edited by Brookesy-- on 12-21-2009 06:20 AM