Add child record through parent form and redirect back to parent form in edit mode
- 7 months ago
Sorry, Mark is right, I forgot a very important part. It needs to be a formula rich text. Also, you need to have data-replaceRid=true and SaveBeforeNavigating in the button code as shown below.
Try changing your field to a formula rich text and using this code:
var text RID = If([Record ID#]>0, ToText([Record ID#]), "%%rid%%");
var text RedirectNoRecordID=URLRoot()&"db/"&Dbid()&"?a=er&rid="; // REDIRECT TO THE FORM IN EDIT
var text url = URLRoot() & "db/" & [_DBID_PROVIDER_DETAILS] & "?a=API_AddRecord&apptoken=xxxxxx"
& "&_fid_48=" & $RID
& "&_fid_39=" & [Data Source 2]
& "&_fid_25=" & [Brief description of data]
& "&_fid_42=" & [Approx # Interfaces]
& "&_fid_37=" & [Data Classification]
& "&_fid_41=" & [Record ID#]; //why is field 41 here? what is field 48 then? This is incorrect but we can only set one field to $RID, so pick the related field."<a class='SaveBeforeNavigating' data-replaceRid=true style=\"text-decoration:none; background: #1ba802; border-radius: 5px; color: #ffffff; display: inline-block; padding: 4px 6px; text-align: center; text-shadow: none; border: 2px solid #1ba802; font-size: 12px \"href='"
& $url
& "&rdr=" & URLEncode($RedirectNoRecordID) & $RID
& "'>Button Words here</a>"//You can use any rich text button code, but you must include the data-replaceRID=true.