Skip to main content
Question

Formula Text Button that opens in a new tab

  • October 10, 2017
  • 0 replies
  • 108 views

I have a formula text button that I need to open a child record in a new tab when clicked. Can someone please help me out?

My formula is:

var text rdr = URLRoot() & "db/" & [_DBID_ASSETS] & "?a=API_GenAddRecordForm"&
"&_fid_112=" & URLEncode ("Part") &
"&_fid_162=" & [Sales Order #] &
"&_fid_338=" & URLEncode ([Record ID#]) &
"&_fid_14=" & URLEncode ([Related Part Assignment]);

var text url =

  URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=biyf682cpfpeqfbfpv8pida6k3gy" &
       "&_fid_142=true"&
       "&_fid_101=" &Now();


If(IsNull([Exchange Received])=false and [Line Type]="Part" and [Type]="Exchange",
"<a class=\"Vibrant Primary\" href=\"javascript:" & "$.get('" & $url &
    "', function(){" & "window.location.href ='" & $rdr & "';" & "});" &  
    "void(0);\">Receive Exchange</a>",
If([Exchange Received]=true and [Line Type]="Part" and [Type]="Exchange",
"<a class=\"Vibrant Success\" href=\"javascript:" & "$.get('" & $url &
    "', function(){" & "location.reload();" & "});" &
    "void(0);\">Exchange Received</a>"
))
This topic has been closed for replies.

  • Registered
  • October 10, 2017
href='"&$URL&"' target='_blank'

The blank target will use the browser default (which is usually a new tab)

  • Registered
  • October 10, 2017
Sorry for the confusion.

Your current href is designed to refresh the page, correct?  (window.location .... void)

you will replace all of that with the simple href="'& $URL &'" target='_blank'

So it will preform your edit, but then open the rdr in a new tab.

"<a class=\"Vibrant Primary\"
href='" & $url & "&rdr=" & URLEncode($rdr) & "' target='_blank'
>Receive Exchange</a>

  • Registered
  • October 11, 2017
I think a good user experience would be to have the button, do the edit, and rdr to the new form all in the same window, BUT add the "nextURL" parameter.

That way as soon as they click the "save & Close" it sends them back to the PO where they started.

Sometimes opening new tabs throws people off because they forget to close them, and still don't know where they end up.