+ Start a Discussion
MT0478MT0478 

Update a Standard Field

Hi,

 

I would like to update a Standard Field value (Text) with formula value that is created after saving a record.

First i tried with Workflow Rule and Field Update, but it didn't work.

Is it possible to deal with this matter with standard customization?

If the Trigger or something is required, please advise me how to write the code.

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

You can update it using workflow and field update there should not be any issue in it. Just verify these

 

1)You have created workflow and field update on the object which you want to update.

2)Please recheck your entry criteria for workflow execution ,  is it satisfied in your case so that field update is done.

3)Workflow is Active

 

You can trace workflow execution in debug logs.

 

In any case if you are ok with using a trigger then just do this

 

Replace your objects API Name with MyObject__c, and Stansard field's API Name with FieldName

 

trigger updateFields on MyObject__c(before insert , before update)
{

for(MyObject__c obj : trigger.new)
{
//Add new value as per you req
obj.FieldName = 'NewValue';
}

}

 

All Answers

bob_buzzardbob_buzzard

You should be able to use workflow to update a standard field - for example, I have a workflow rule that prepends some text to every account that is created.

 

When you say it didn't work, did you get errors or did it just not fire?  It would be useful if you could give us a bit more information about how you configured this.

Shashikant SharmaShashikant Sharma

You can update it using workflow and field update there should not be any issue in it. Just verify these

 

1)You have created workflow and field update on the object which you want to update.

2)Please recheck your entry criteria for workflow execution ,  is it satisfied in your case so that field update is done.

3)Workflow is Active

 

You can trace workflow execution in debug logs.

 

In any case if you are ok with using a trigger then just do this

 

Replace your objects API Name with MyObject__c, and Stansard field's API Name with FieldName

 

trigger updateFields on MyObject__c(before insert , before update)
{

for(MyObject__c obj : trigger.new)
{
//Add new value as per you req
obj.FieldName = 'NewValue';
}

}

 

This was selected as the best answer
MT0478MT0478

Dear  All,

My workflow condition was not satisfied in actual case.

Now the FieldUpdate works fine.

Thank you!