You need to sign in to do that
Don't have an account?

Need help with a trigger to update multiple fields on a case
I have several fields on my Case object that I want to auto populate depending on certain conditions. For the most part, I have my trigger set up to do what I want. The issue I am running into is at the end of the trigger. The field (c.Task_Steps__c) is a text field with the ability to have 255 characters. Currently, how my trigger is written, it populates the text field with a horizontal list like such:
1. Review Quote 2. Approve / Reject Quote 3. Complete task in Salesforce
However, I want to populate this field with vertical list values so that it looks like the following:
- Review Quote
- Approve / Reject Quote
- Complete task in Salesforce
Is this even possible? I am new to writing Apex and Triggers so any information / code modification would be greatly appreciated :)!
Code:
trigger SEApproveRejectQuote_assignment on Case (Before update)
{for (Case c: Trigger.new)
{if(c.Reason=='Approve / Reject Quote' && c.Status=='New')
{
c.Origin='End User Request';
c.Type='SE Task';
c.Subject='Approve / Reject Quote';
c.Description='Quote approval is needed';
c.Task_Steps__c='1. Review Quote 2. Approve / Reject Quote 3. Complete task in Salesforce';
}}}
Here is how you would add new lines (this will only work if the Task_Steps__c field is a text area)
The '\n' indicates to add a newline character.
I hope this helps!
All Answers
Here is how you would add new lines (this will only work if the Task_Steps__c field is a text area)
The '\n' indicates to add a newline character.
I hope this helps!
c.Task_Steps__c='1. Review Quote \n\r2. Approve / Reject Quote \n\r3. Complete task in Salesforce';
And my apologies, I thought I said that the field was a Text Area, but I guess I just said text...oops.