Forum Discussion

ShawnSchrotber1's avatar
ShawnSchrotber1
Qrew Member
8 months ago

Formula URL - Edit then Add

Hello Everyone,  

I'm trying to create a single button that will allow our users to add an effective end date to a record on form ID 11 and then when that is saved redirect to the add record api using form ID 10 populated with data from the previous record.  Since I haven't been able to get it to work in a single button I created 2 buttons.  Indivually both buttons work but combining them isn't.  Any ideas?

Step 1 code: 

URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#] &"&dfid=11" & "&rdr="

Step 2 code:

URLRoot() & "db/" & Dbid() & "?act=API_GenAddRecordForm&dfid=10" & "&_fid_6=" & [Paragraph]  & "&_fid_7=" & [Publication]  & "&_fid_8=" & [Description]  & "&_fid_11=" & URLEncode([Staff Contact])  & "&_fid_17=" & [Effective End Date]    & "&_fid_19=" & [Record ID#]

When I combine the code I'm using this

URLRoot() & "db\n/" & Dbid() & "?a=er&rid=" & [Record ID#] 
  &"&dfid=11"
  & "&rdr="
&URLEncode(URLRoot() & "db/" & Dbid() & "?act=API_GenAddRecordForm&dfid=10" 
  & "&_fid_6=" & [Paragraph]
  & "&_fid_7=" & [Publication]
  & "&_fid_8=" & [Description]
  & "&_fid_11=" & URLEncode([Staff Contact])
  & "&_fid_17=" & [Effective End Date]  
  & "&_fid_19=" & [Record ID#])

I feel like I need a pause before the   & "&rdr=" in the third line as I get an error saying something went wrong.

For now I will keep it 2 separate buttons but it would be great to combine them and using the save function on the edit record to trigger the second step.  

  • Try this

     

    URLRoot() & "db\" & Dbid() & "?a=er&rid=" & [Record ID#] 
      &"&dfid=11"
      & "&NextURL="
    &URLEncode(URLRoot() & "db/" & Dbid() & "?act=API_GenAddRecordForm&dfid=10" 
      & "&_fid_6=" & [Paragraph]
      & "&_fid_7=" & [Publication]
      & "&_fid_8=" & [Description]
      & "&_fid_11=" & URLEncode([Staff Contact])
      & "&_fid_17=" & [Effective End Date]  
      & "&_fid_19=" & [Record ID#])

  • Marks answer should work, but I just wanted to add that this will only work on desktop version, as $NextURL does not function on mobile, so just be careful of that.

  • The Button will not see your input into the Effective End Date field until you Tab out if it.  Sort of like excel does not see input until you leave the cell.  can you contrive a way for the user to have to tab out of the field?   Maybe even a dummy checkbox field they click to cause them to leave that date field. Maybe call the field [Carry forward end date?].  Give that a try to see if that solves the issue.

  • Try this

     

    URLRoot() & "db\" & Dbid() & "?a=er&rid=" & [Record ID#] 
      &"&dfid=11"
      & "&NextURL="
    &URLEncode(URLRoot() & "db/" & Dbid() & "?act=API_GenAddRecordForm&dfid=10" 
      & "&_fid_6=" & [Paragraph]
      & "&_fid_7=" & [Publication]
      & "&_fid_8=" & [Description]
      & "&_fid_11=" & URLEncode([Staff Contact])
      & "&_fid_17=" & [Effective End Date]  
      & "&_fid_19=" & [Record ID#])

  • Marks answer should work, but I just wanted to add that this will only work on desktop version, as $NextURL does not function on mobile, so just be careful of that.

  • Thank you Mark,  That is working really well.  The only issue I'm having is the Effective End Date entered in the first step isn't coming through to populate the & "&_fid_17=.  However this is a small issue, so thank you for the  & "&NextURL=".

    Mike,  Thank you for the heads up on the mobile function.