Expression Failing with Null Value

Hello,

I am trying to figure out how to rewrite an expression that is causing a failure in a data action. The data action is used to create a case in Salesforce.
The initial expression was:
If(IsNotSetOrEmpty(Flow.PageUrl), "", Flow.PageUrl)

However, it can happen that the URL exceeds 255 characters which causes a failure because the Salesforce field cannot hold a value exceeding 255 characters. As a result, I updated the expression to:
If(IsNotSetOrEmpty(Flow.PageUrl), Left(Flow.PageUrl, 255), ToString(""))

This expression is now causing a failure when the Flow.PageUrl value is null. Is there a way to write and solve the 2 issues mentioned above?

This expression means if PageUrl is Not Set or Empty then Select first 255 characters from PageUrl which does not make sense. Reverse the position of last two parameters

@zubair Looks like it worked.
One more question. Are these 2 expression the same?
If(IsNotSetOrEmpty(Flow.PageUrl), ToString(""), Left(Flow.PageUrl, 255))
If(IsNotSetOrEmpty(Flow.PageUrl), "", Left(Flow.PageUrl, 255))

I would definitely expect "" to be equivalent to ToString("")

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.