How to Pre-Populate a Field in a Form?
Hello Smartsheet Community,
I am trying to pre-populate my Work Order ID field in a form with the number it is assigned in its row. A while back, we were given a complex formula to include specific fields but it is very complex and hard to understand.
Can someone please let me know how to add the Work Order ID to the form with the "Substitute" formula? Our current formula is just the form link. Any help is greatly appreciated!
Here is our old complex formula that we used to pre-populate certain fields:
="http/app.smartsheet.co/b/form/" + "Site%20Name=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Site Name]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Oppty%20%23=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Oppty #]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Visit%20Type=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Visit Type]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Centrics%20IT%20PC%2FPM=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([PC/PM Contact]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Date=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([End Date]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&End%20User%20Company=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([End User Company]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Field%20Engineer%20Name=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Resource Name]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Field%20Engineer%20Company=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Vendor Company]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&FE%20Level=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([FE Level]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Projected%20Margin%20%24=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Projected Margin $]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F")
Answers
-
The easiest thing to do is to copy a section, edit it and add it to the end.... so, if you copied the last field:
+ "&Projected%20Margin%20%24=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Projected Margin $]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F")
You could edit it for your Work Order ID (Assuming that is the exact spelling of the column name - spaces matter)
+ "&Work%20Order%20ID=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Work Order ID]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F")
Now... if your work order ID is numbers only, no spaces, no special characters (Like # or $), then you could actually simplify and do this:
+ "&Work%20Order%20ID=" + [Work Order ID]@row
So your final formula would look like this:
="http/app.smartsheet.co/b/form/" + "Site%20Name=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Site Name]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Oppty%20%23=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Oppty #]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Visit%20Type=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Visit Type]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Centrics%20IT%20PC%2FPM=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([PC/PM Contact]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Date=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([End Date]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&End%20User%20Company=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([End User Company]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Field%20Engineer%20Name=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Resource Name]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Field%20Engineer%20Company=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Vendor Company]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&FE%20Level=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([FE Level]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F") + "&Projected%20Margin%20%24=" + SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([Projected Margin $]@row, "#", "%23"), "$", "%24"), " ", "%20"), ",", "%2C"), "/", "%2F")+ "&Work%20Order%20ID=" + [Work Order ID]@row
For additional information on setting up this kind of formula, see: https://help.smartsheet.com/articles/2478871-url-query-string-form-default-values
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64K Get Help
- 410 Global Discussions
- 220 Industry Talk
- 459 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 138 Just for fun
- 57 Community Job Board
- 459 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 298 Events
- 37 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!