cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MitchC3
Level: Powered On

If, length, substring in one expression help

I'm trying to check to see if the body of an email is less than 2000 characters. If it is, use the dynamic content for body. If it is not, use the substring of the first 1999 characters. This is because the form field caps at 2000 characters. I keep getting invalid expression and I have no idea what's wrong with mine.

 

if(@less(length(triggerBody()?['Body']),2000),triggerBody()?['Body'],substring(triggerBody()?['Body']),1,1999)

1 ACCEPTED SOLUTION

Accepted Solutions
MitchC3
Level: Powered On

Re: If, length, substring in one expression help

if(less(length(triggerBody()['Body']),2000),triggerBody()['Body'],substring(triggerBody()['Body'],0,1999))

2 REPLIES 2
MitchC3
Level: Powered On

Re: If, length, substring in one expression help

Removing the @ sign makes the expression valid. However, the flow fails when you run it because it says the If expression has 5 parameters instead of 3.

MitchC3
Level: Powered On

Re: If, length, substring in one expression help

if(less(length(triggerBody()['Body']),2000),triggerBody()['Body'],substring(triggerBody()['Body'],0,1999))