Pass Record Summary URL dynamically to a process variable is failing

Hi All, 

I have created a rule that gives the correct output of a record summary page URL dynamically based on the case ID. However, when I'm passing the same rule in a process model to a PV, it's not working. getting the wrong URL. The use case of this is to store the Record Summary URL dynamically in CRM. Please suggest if the process model is doing any conversion for the URL? Thanks, in advance.

Rule to get Summary URL Code dynamically:

= load(
local!tempoUrl: "/tempo/records/item/",
local!url: urlforrecord(
ri!recordType,
ri!recordIdentifier
) & "?signin=ping",
if(
rule!APN_isBlank(
ri!siteUrl
),
urlforrecord(
ri!recordType,
ri!recordIdentifier
),
replace(
local!url,
find(
local!tempoUrl,
local!url
),
len(
local!tempoUrl
),
"/" & ri!siteUrl & "/record/"
)
)
)

Below is the same rule that has values and being stored to a PV of type text:

rule!CUR_RULE_getTaskUrl(
recordType: cons!SAFETY_CLIENT_UPDATE_REQUEST_CASE,
recordIdentifier: pv!SAFETY_cases.caseID,
siteUrl: cons!SAFETY_SITESALLCASESURL
)

  Discussion posts and replies are publicly visible