2

Hi I have a report with filter say Account.Name = 'Test Account', for Dynamic reference for different Accounts I created a URL like below

reportId?pv0={!Account.Name}

To use this in Lightning I need to replace pv0 to fv0 when I did this the URL encode takes space as + which is expected, but passes the Same to the Filter value.

for Example if Account Name is "Test Account" the filter value returns to be "Test+Account", because of this the report is not returning any result.

Please let me know if any of faced the same problem.

  • how are you forming the url? can you try using encodeURIComponent() function in your lightning controller function and try to pass the account name ? var url_val = "/one/one.app#/sObject/00Od0000004AYPFEA4/view?a:t=1495057260375&fv0="+encodeURIComponent(account_name); – Rao May 17 '17 at 22:17
  • yes, I did the Same, see for ex my URL is like this /one/one.app#/sObject/00Od0000004AYPFEA4/view?fv0={!URLENCODE(account.na‌​me)) – GI Joe May 17 '17 at 22:40
  • can you post your component and controller code? – Rao May 17 '17 at 23:03
  • No, i am creating a custom link with type URL. – GI Joe May 17 '17 at 23:07
1

Try substituting %2B with %20.

Looks like space is getting converted to + and + gets encoded as %2B. Instead of encoding just let the url convert the space to + and substitute + with space

/one/one.app#/sObject/00Od0000004AYPFEA4/view?fv0={!SUBSTITUTE(Account.Name, "%2B", "%20") }

I tested this and the URL resulted to:

/one/one.app#/sObject/00Od0000004AYPFEA4/view?fv0=test%2034%2023&a:t=1495063836386

enter image description here

  • No luck, i tried this erlier, now I have tried again, /one/one.app#/sObject/00Ow0000006qBDUEA2/view?fv0={!SUBSTITUTE('test Account',"%2B","%20")} still adding " +" even I replaced the %2B with + still no luck – GI Joe May 18 '17 at 3:18
  • It worked fine for me, how abt you just put in the merge field and try with the substitute function. – Rao May 18 '17 at 3:31
  • I tried all those options ! I dont know where im missing!!! – GI Joe May 18 '17 at 3:37
  • Are you building this as a detail page link on the object? What is ur resulting url when you click the detail page link? – Rao May 18 '17 at 4:02
  • yes it is a detail page link , heres how it looks, after loading properly, it substitues %2B since + is substituted. one/one.app#/sObject/00Ow0000006qBDUEA2/view?fv0=test%2BAccount – GI Joe May 18 '17 at 4:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.