Discussions

 View Only
Expand all | Collapse all

Error in a URL Button

  • 1.  Error in a URL Button

    Posted 09-28-2021 15:27
    Any ideas why I am getting the followon error for this URL button:

    I have the following code for a URL Button:
    If((not([showcalledby]) or [Unclaim Lead]),
    URLRoot() & "db/" & [_DBID_LEAD_NOTES] & "?a=API_EditRecord&rid=" & [Record ID#] &
    "&rid=" & [Record ID#] &
    "&_fid_39=" & URLEncode ([Current User]) &"&rdr="&URLEncode(URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl()))

    but I am getting the following error:
    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <qdbapi>
    <action>API_EditRecord</action>
    <errcode>30</errcode>
    <errtext>No such record</errtext>
    <errdetail>Missing "rid" parameter.</errdetail>
    </qdbapi>


    ------------------------------
    George Bramhall
    ------------------------------


  • 2.  RE: Error in a URL Button

    Posted 09-28-2021 15:51
    You have "&rid=" & [Record ID#] & twice. Remove the second instance.

    If((not([showcalledby]) or [Unclaim Lead]),
    URLRoot() & "db/" & [_DBID_LEAD_NOTES] & "?a=API_EditRecord&rid=" & [Record ID#] &
    "&rid=" & [Record ID#] & //REMOVE THIS LINE
    "&_fid_39=" & URLEncode ([Current User]) &"&rdr="&URLEncode(URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl()))

    ------------------------------
    Michael Tamoush
    ------------------------------



  • 3.  RE: Error in a URL Button

    Posted 09-28-2021 15:57
    Ok, fixed that but still get the same error.

    ------------------------------
    George Bramhall
    ------------------------------



  • 4.  RE: Error in a URL Button

    Posted 09-28-2021 16:03
    Does the record ID exist yet? ie - are you pushing the button when creating a new record, or has it been saved and the rid created?

    ------------------------------
    Michael Tamoush
    ------------------------------



  • 5.  RE: Error in a URL Button

    Posted 09-28-2021 16:22
    Ahhh, I was creating a new record. In all cases the record ID will have been created. Thanks!!!

    ------------------------------
    George Bramhall
    ------------------------------



  • 6.  RE: Error in a URL Button

    Posted 09-28-2021 16:35
    Not necessarily. There is a new functionality to deal with that. I haven't played around with it a lot, but here are my notes on it:

    Use record ID# as a parameter when you click a custom hyperlink from an add record form. This lets you leverage newly created record IDs and expands custom code page workflow options. Use record ID# in formulas with data-replaceRid=true and %%rid%% where you would like the RID.
    Note: You can only use this parameter when the hyperlink navigates to the same tab, not when it is set to open in a new tab or popup.

    Here's an example of a formula-rich text field that uses this feature:

    var text rid =
    If([Record ID#]>0,
    ToText([Record ID#]), // Record ID already exists
    "%%rid%%" // New record, no Record ID exists yet
    )
    ;
    var text url = URLRoot() & "db/" & Dbid() & "?a=er&rid=" & $rid;

    ------------------------------
    Michael Tamoush
    ------------------------------



  • 7.  RE: Error in a URL Button

    Posted 09-28-2021 16:44
    That's interesting but in our case the Button should only appear for an existing record. We do not allow the user that uses the button to create a new record.  The user that does create the record uses a form where the button doesn't exist.

    ------------------------------
    George Bramhall
    ------------------------------



  • 8.  RE: Error in a URL Button

    Posted 09-30-2021 09:42
    Edited by George Bramhall 09-30-2021 10:08
    Hi Michael,
    After further investigation, When I use the totext([Record ID#] instead of just [RecordID#] in the code above, I don't get the error but the change to field 39 does not happen.
    George

    ------------------------------
    George Bramhall
    ------------------------------



  • 9.  RE: Error in a URL Button

    Posted 09-30-2021 12:24
    That's a new one for me. Maybe someone else will have thoughts. When it's text you may have to wrap it in URLEncode, but there should be no reason to make the record ID text. If it isn't working using the record ID, you have a fundamental issue (likely that the ID doesn't exist).

    ------------------------------
    Michael Tamoush
    ------------------------------



  • 10.  RE: Error in a URL Button

    Posted 09-30-2021 13:40
    Edited by George Bramhall 09-30-2021 13:50
    UPDATE: When I use this code it works!!!

    var text viewlead = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#] & "&dfid=10";

    var text url = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&_fid_39=" & URLEncode ([Current User]);

    If((not([showcalledby]) or [Unclaim Lead]),
    $url&"&rdr="&URLEncode($viewlead))


    ------------------------------
    George Bramhall
    ------------------------------



  • 11.  RE: Error in a URL Button

    Posted 09-30-2021 13:52
    The message is telling you there are no errors, but the redirect is wrong so it doesnt know what to do, and just lands you on the page.

    the redirect can just be &URLEncode($ViewLead).

    I've never put the form ID (&dfid=10) at the end. I usuallyput it before the &rid but it may work both ways, that's beyond my knowledge level!

    ------------------------------
    Michael Tamoush
    ------------------------------



  • 12.  RE: Error in a URL Button

    Posted 09-30-2021 14:12
    My edit to my message and your response must have passed each other in webnet land. It now works and I am happy. I just wish I understood why dodirect doesn't work here and the rdr above does, but that's for another day. Thanks for your help Michael.

    ------------------------------
    George Bramhall
    ------------------------------



  • 13.  RE: Error in a URL Button

    Posted 09-30-2021 14:24
    The doredirect is new. Perhaps it gets confused when launched from an embedded report. Maybe it tries to just land you back on the report? Not sure, but when in doubt, I just tell it exactly where to land.

    ------------------------------
    Michael Tamoush
    ------------------------------