Skip to content

Commit

Permalink
unescaped task description and subject
Browse files Browse the repository at this point in the history
  • Loading branch information
kreloaded committed Aug 31, 2023
1 parent 6fe53b7 commit 458e989
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ public class CreateSalesforceAccountTask implements CreateAccountTask {
public CreateTaskFormatterDto createAccountTask(User User, String accountId, CreateAccountTaskDto task) {
String salesforceUserId = User.getExternalUserId();

String taskSubject = getTaskSubjectFromDescription(task);
logger.info("createAccountTask task description: ", task.getDescription());
Util util = new Util();
String unEscapedTaskDescription = util.unEscapeSpecialCharactersForPlainText(task.getDescription());
String taskSubject = getTaskSubjectFromDescription(unEscapedTaskDescription);

logger.info("performing create task in salesforce");

Map<String, String> taskBody = new HashMap<String, String>();
taskBody.put("Subject", taskSubject);
taskBody.put("Description", task.getDescription());
taskBody.put("Description", unEscapedTaskDescription);
taskBody.put("OwnerId", task.getCrmOrganizationUserId());
taskBody.put("ActivityDate", task.getDueDate());
taskBody.put("WhatId", accountId);
Expand Down Expand Up @@ -109,14 +112,9 @@ private CreateTaskFormatterDto parseResponse(String createTaskResponse) {
* @param task CreateTaskDto object
* @return String task subject
*/
private String getTaskSubjectFromDescription(CreateAccountTaskDto task) {
private String getTaskSubjectFromDescription(String taskDescription) {
logger.info("getting task subject from description");

String taskDescription = task.getDescription();

Util util = new Util();
taskDescription = util.unEscapeSpecialCharactersForPlainText(taskDescription);

if (taskDescription.length() < 60) {
return taskDescription;
}
Expand Down

0 comments on commit 458e989

Please sign in to comment.