You need to sign in to do that
Don't have an account?
Salesforce Beginner
how to read description field of the task in Salesforce
Hello All,
I am writing a trigger on Task. When a new task is created, I am using the who.id (in my case mostly lead) and converting lead in to Account, contact and opp. Duing this process I am reading subject line (standard subject pattern) of the task to use the fields in the contact creation. example subject line: NewTask-email@email.com-field3-field4.
Note : ' - ' is the delimiter.
I am using as below:
if(task.Subject.indexOf('NewTask-') > -1)
Now, I have a similar requirement to read the standard pattern (company-firstname-lastname-phoneno) etc from the decription(body/comments) field of the task.
If anybody has any thoughts please share.
I am writing a trigger on Task. When a new task is created, I am using the who.id (in my case mostly lead) and converting lead in to Account, contact and opp. Duing this process I am reading subject line (standard subject pattern) of the task to use the fields in the contact creation. example subject line: NewTask-email@email.com-field3-field4.
Note : ' - ' is the delimiter.
I am using as below:
if(task.Subject.indexOf('NewTask-') > -1)
Now, I have a similar requirement to read the standard pattern (company-firstname-lastname-phoneno) etc from the decription(body/comments) field of the task.
If anybody has any thoughts please share.
I tried below and I got what I was looking for. Posting it here in case if anybody in future comes across this.
Statements:
string test = tk.Description;
system.debug('The description of the task is'+test);
List descFields = test.split('-', 4); // This statement does the trick
system.debug('The new body fields are: '+descFields[0]);
system.debug('The new body fields are: '+descFields[1]);
system.debug('The new body fields are: '+descFields[2]);
system.debug('The new body fields are: '+descFields[3]);