Prefilled Value with a Button
Hi everyone,
I’ve created a “Copy Line Item” button that is supposed to create a new record and prefill it with the same values selected by the user in the original record.
The button works, but I’m running into an issue: the following fields are not being prefilled when the new record is created:
[Related Trademark]
[Related Beverage Type]
[Related Package]
All three of these fields are text field types, populated through relationships from their parent tables. The values that show up in them are alphanumeric (e.g., A1, B1, C700, etc.), and they are key fields in their respective tables.
For some reason, when I click the button, these related fields don’t carry over into the new record. Has anyone run into this issue before, or know how to get these relationship-based fields to prefill correctly?
For reference the code is in the attachment section.
var text nonNational = URLRoot() & "db/" & [_DBID_PR_LINE_ITEMS] & "?a=API_GenAddRecordForm&dfid=22&_fid_13=" & URLEncode([Related Price Request])
& "&_fid_10=" & URLEncode([Start Date])
& If(IsNull([End Date]), "&_fid_11=" & URLEncode("2050-12-31"), "&_fid_11=" & URLEncode([End Date]))
& "&_fid_12=" & URLEncode([Rate])
& "&_fid_6=" & URLEncode([Customer Option]) &
If([Customer Option] = "Customer", "&_fid_376=" & URLEncode([Related Customer4])
, [Customer Option] = "Local Chain","&_fid_360=" & URLEncode([Regional Account - LocalChainId])
, [Customer Option] = "Promo Plan","&_fid_365=" & URLEncode([Related RegionalPromo])
, [Customer Option Channel] = "Channel","&_fid_34=" & URLEncode([Related Market])
)
& "&_fid_85=" & URLEncode([Geography Option]) &
If([Geography Option] = "Included All Price Zone", ""
, [Geography Option] = "Specific Price Zone","&_fid_73=" & URLEncode([Related Price Zone])
, [Geography Option] = "Specific Sales Office","&_fid_73=" & URLEncode([Related Price Zone]) & "&_fid_74=" & URLEncode([Related Price Zone - Sales Office Relationship])
)
& "&_fid_55=" & URLEncode([Product Option]) &
If([Product Option] = "Material", "&_fid_70=" & URLEncode([Related Material])
, [Product Option] = "Beverage Type & Package Size","&_fid_42=" & URLEncode([Related Beverage Type]) & "&_fid_46=" & URLEncode([Related Beverage Type - Package Relationship])
, [Product Option] = "Trademark & Package Size","&_fid_50=" & URLEncode([Related Trademark]) & "&_fid_52=" & URLEncode([Related Trademark - Package Relationship])
, [Product Option] = "Package Size Only","&_fid_72=" & URLEncode([Related Package])
);
$nonNational
Thanks in advance for your help!