Text formatting in Salesforce workflow | XM Community
Skip to main content
Solved

Text formatting in Salesforce workflow


MsIreen
Level 5 ●●●●●
Forum|alt.badge.img+23
  • Level 5 ●●●●●
  • 456 replies

Hi,

We are automatically creating a task and assigning it to a person in SF based on certain criteria. We would like to created a nice looking text with paragraphs in the SF Task Description field. However, it seems like the Qualtrics Workflow only allows text as a line without breaks etc. Anyone knows how to get around it?

 

 

Best answer by chackbusch

Hi @MsIreen. We used a code task for that in the past and defined the text as HTML. This only works if the target field in Salesforce is some HTML compatible field. 

The code task is placed before the Salesforce action and should output the HTML formatted string.

Setup like this (ignore the condition): 

Code task e.g.,: 

function codeTask() {
	var q1 = '<h4><strong>What did you like the most about working with XYZ?</strong></h4>';
	var a1 = '${q://QID105/ChoiceTextEntryValue}<br /><br />';
	var q2 = '<h4><strong>What is the single essential topic that XYZ should improve in?</strong></h4>';
	var a2 = '${q://QID56/ChoiceTextEntryValue}';

	return {
		"feedbackHtml": q1.concat(a1,q2,a2)
	}
}

This embedded data can then be piped in the Salesforce action. 

Best
Christian

View original

5 replies

chackbusch
QPN Level 5 ●●●●●
Forum|alt.badge.img+22
  • QPN Level 5 ●●●●●
  • 414 replies
  • Answer
  • August 5, 2024

Hi @MsIreen. We used a code task for that in the past and defined the text as HTML. This only works if the target field in Salesforce is some HTML compatible field. 

The code task is placed before the Salesforce action and should output the HTML formatted string.

Setup like this (ignore the condition): 

Code task e.g.,: 

function codeTask() {
	var q1 = '<h4><strong>What did you like the most about working with XYZ?</strong></h4>';
	var a1 = '${q://QID105/ChoiceTextEntryValue}<br /><br />';
	var q2 = '<h4><strong>What is the single essential topic that XYZ should improve in?</strong></h4>';
	var a2 = '${q://QID56/ChoiceTextEntryValue}';

	return {
		"feedbackHtml": q1.concat(a1,q2,a2)
	}
}

This embedded data can then be piped in the Salesforce action. 

Best
Christian


MsIreen
Level 5 ●●●●●
Forum|alt.badge.img+23
  • Author
  • Level 5 ●●●●●
  • 456 replies
  • August 5, 2024

Thanks, @chackbusch , I will check this out.


MsIreen
Level 5 ●●●●●
Forum|alt.badge.img+23
  • Author
  • Level 5 ●●●●●
  • 456 replies
  • August 5, 2024

The code result came out with no formatting and with all HTML tags, unfortunately. So i guess the SF field is not accepting HTML

 


chackbusch
QPN Level 5 ●●●●●
Forum|alt.badge.img+22
  • QPN Level 5 ●●●●●
  • 414 replies
  • August 5, 2024

@MsIreen You might discuss with your technical SF responsible then on which options exist to set a formatted text for the task description field… Unfortunatelly, I do not see any other option. 


MsIreen
Level 5 ●●●●●
Forum|alt.badge.img+23
  • Author
  • Level 5 ●●●●●
  • 456 replies
  • August 5, 2024

@chackbusch yep, checked with the admin, and this field doesn’t support HTML formatting. So while the breaks can be added manually, the </br> is not gonna work.

 

thanks anyways, great solution. I will try it out on some other fields in the future 😀


Leave a Reply