Expand all | Collapse all

How to Add CurrentUser to User List field

  • 1.  How to Add CurrentUser to User List field

    Posted 17 days ago
    I have searched the API, formulas and community and don't see anything. Wondering if there is an API function for adding the current user to a User List through a URL Formula?

    The idea is to expose a button on a report that says Subscribe on it. When the User clicks the button their username is added to the User List field. The report is displayed on the App Home page, where each record is a separate topic of interest.

    We won't have a lot of Subscribers so a User List is ok. We want to experience to exclude opening the record and adding the User name to the list.

    This doesn't work:
    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&_fid61=User()&apptoken=

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&_fid61=[??WHAT DO IT PUT HERE??]&apptoken=


    Jim Harrison


  • 2.  RE: How to Add CurrentUser to User List field

    Posted 17 days ago
    var text MyUserList = Totext([userlist2]); // insert your List User field here

    var text NewUserList = List(";",$MyUserList, totext(User()));

    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_99=" & $NewUserList;

    var Text DoIt =

    "javascript:" &
    "$.get('" &
    $URL &
    "',function(){" &
    "location.reload(true);" &
    & "void(0);";

    if(not contains($MyUserList, Totext(User())),$DoIt) // only add the Current user iF not already subscribed

    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach

  • 3.  RE: How to Add CurrentUser to User List field

    Posted 16 days ago
    Works like a button!

    [Subscribe Button]

    var text SubscribersUL = ToText([Subscribers]);
    var text UserListUpd = List(";",$SubscribersUL, ToText(User()));
    var text btnName = If([Subscribed]>0,"Subscribed","+ Subscribe");
    var text urlOne = If([Subscribed]>0,"",URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&_fid_<<[Subscribers_fid]>>=" & $UserListUpd & "&apptoken=<<app_token>>");
    var text urlTwo = URLRoot() & "db/<<app Home page dbid>>";
    var text url = $urlOne & "&rdr=" & URLEncode($urlTwo);
    var text style = If([Subscribed]>0,[styleGrey],[styleAdd]);
    var bool popup = false;
    var text target = If($popup = true, "target = _Blank ", "");
    var text title = "Add name to [Subscribers] User List";
    "<a title=\"" & $title & "\"style =\"" & $style & "\"" & $target & "href=" & If([Subscribed]=1,$urlTwo,$url) & ">" & $btnName & "</a>"

    Thank you Coach!!

    Jim Harrison